From 9b33a874f76e0df8dcd4f19bf05f3d98021326e5 Mon Sep 17 00:00:00 2001 From: taoerman Date: Fri, 1 Aug 2025 16:45:19 -0700 Subject: [PATCH 1/3] Update channel logic to support publishing channel draft update tests for publish draft using main tree Enhanced publish functionality to support three publish types fixed fix frontend tests --- .../pages/StagingTreePage/index.vue | 4 +- .../vuex/currentChannel/actions.js | 4 + .../shared/data/__tests__/changes.spec.js | 5 +- .../frontend/shared/data/changes.js | 5 +- .../frontend/shared/data/resources.js | 5 +- .../frontend/shared/data/serverSync.js | 2 +- .../tests/test_exportchannel.py | 113 +++++++++++++++++- .../contentcuration/tests/viewsets/base.py | 4 +- .../tests/viewsets/test_channel.py | 4 +- .../contentcuration/utils/publish.py | 40 ++++--- .../contentcuration/viewsets/channel.py | 24 ++-- .../contentcuration/viewsets/sync/utils.py | 3 +- 12 files changed, 169 insertions(+), 44 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/pages/StagingTreePage/index.vue b/contentcuration/contentcuration/frontend/channelEdit/pages/StagingTreePage/index.vue index 6c7240e25f..612a870f7a 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/pages/StagingTreePage/index.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/pages/StagingTreePage/index.vue @@ -552,7 +552,7 @@ ...mapActions('currentChannel', [ 'loadCurrentChannelStagingDiff', 'deployCurrentChannel', - 'publishDraftChannel', + 'publishStagingChannel', 'reloadCurrentChannelStagingDiff', ]), ...mapActions('currentChannel', { loadCurrentChannel: 'loadChannel' }), @@ -646,7 +646,7 @@ this.displayPublishDraftDialog = false; this.isPublishingDraft = true; - this.publishDraftChannel() + this.publishStagingChannel() .then(() => { this.isPublishingDraft = false; this.showSnackbar({ diff --git a/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js b/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js index df5f528cd4..7659c0630d 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js +++ b/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js @@ -59,6 +59,10 @@ export function publishDraftChannel(context) { return Channel.publishDraft(context.state.currentChannelId); } +export function publishStagingChannel(context) { + return Channel.publishDraft(context.state.currentChannelId, true); +} + export function channelLanguageExistsInResources(context) { const channelId = context.state.currentChannelId; return Channel.languageExistsInResources(channelId); diff --git a/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js b/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js index 51b69efe8b..9ea28f3e54 100644 --- a/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js +++ b/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js @@ -257,6 +257,9 @@ describe('Change Types', () => { const change = new PublishedNextChange({ key: '1', table: TABLE_NAMES.CHANNEL, + use_staging_tree: false, + version_notes: 'Test version notes', + language: 'en', source: CLIENTID, }); const rev = await change.saveChange(); @@ -264,7 +267,7 @@ describe('Change Types', () => { expect(persistedChange).toEqual({ rev, channel_id: change.key, - ...pick(change, ['type', 'key', 'table', 'source']), + ...pick(change, ['type', 'key', 'table', 'use_staging_tree', 'version_notes', 'language', 'source']), }); }); diff --git a/contentcuration/contentcuration/frontend/shared/data/changes.js b/contentcuration/contentcuration/frontend/shared/data/changes.js index 8c7f02d49a..a59e06ffeb 100644 --- a/contentcuration/contentcuration/frontend/shared/data/changes.js +++ b/contentcuration/contentcuration/frontend/shared/data/changes.js @@ -439,7 +439,7 @@ export class PublishedChange extends Change { } export class PublishedNextChange extends Change { - constructor(fields) { + constructor({ use_staging_tree, version_notes, language, ...fields }) { fields.type = CHANGE_TYPES.PUBLISHED_NEXT; super(fields); if (this.table !== TABLE_NAMES.CHANNEL) { @@ -447,6 +447,9 @@ export class PublishedNextChange extends Change { `${this.changeType} is only supported by ${TABLE_NAMES.CHANNEL} table but ${this.table} was passed instead`, ); } + this.setAndValidateBoolean(use_staging_tree, 'use_staging_tree'); + this.setAndValidateIsDefined(version_notes, 'version_notes'); + this.setAndValidateIsDefined(language, 'language'); this.setChannelAndUserId({ id: this.key }); } } diff --git a/contentcuration/contentcuration/frontend/shared/data/resources.js b/contentcuration/contentcuration/frontend/shared/data/resources.js index 17e3431cb7..b55245ffbd 100644 --- a/contentcuration/contentcuration/frontend/shared/data/resources.js +++ b/contentcuration/contentcuration/frontend/shared/data/resources.js @@ -1234,9 +1234,12 @@ export const Channel = new CreateModelResource({ }); }, - publishDraft(id) { + publishDraft(id, use_staging_tree=false, version_notes="") { const change = new PublishedNextChange({ key: id, + use_staging_tree: use_staging_tree, + version_notes: version_notes, + language: currentLanguage, table: this.tableName, source: CLIENTID, }); diff --git a/contentcuration/contentcuration/frontend/shared/data/serverSync.js b/contentcuration/contentcuration/frontend/shared/data/serverSync.js index 72c8c60e4c..0015766058 100644 --- a/contentcuration/contentcuration/frontend/shared/data/serverSync.js +++ b/contentcuration/contentcuration/frontend/shared/data/serverSync.js @@ -36,7 +36,7 @@ const ChangeTypeMapFields = { 'excluded_descendants', ]), [CHANGE_TYPES.PUBLISHED]: commonFields.concat(['version_notes', 'language']), - [CHANGE_TYPES.PUBLISHED_NEXT]: commonFields, + [CHANGE_TYPES.PUBLISHED_NEXT]: commonFields.concat(['use_staging_tree', 'version_notes', 'language']), [CHANGE_TYPES.SYNCED]: commonFields.concat([ 'titles_and_descriptions', 'resource_details', diff --git a/contentcuration/contentcuration/tests/test_exportchannel.py b/contentcuration/contentcuration/tests/test_exportchannel.py index 95d75e7886..c7c3097a4c 100644 --- a/contentcuration/contentcuration/tests/test_exportchannel.py +++ b/contentcuration/contentcuration/tests/test_exportchannel.py @@ -885,6 +885,7 @@ def run_publish_channel(self): send_email=False, progress_tracker=None, language="fr", + is_draft_version=True, use_staging_tree=True, ) @@ -894,11 +895,9 @@ def test_none_staging_tree(self): with self.assertRaises(NoneContentNodeTreeError): self.run_publish_channel() - def test_staging_tree_published(self): - self.assertFalse(self.content_channel.staging_tree.published) + def test_staging_tree_not_published_for_draft(self): self.run_publish_channel() - self.content_channel.refresh_from_db() - self.assertTrue(self.content_channel.staging_tree.published) + self.assertFalse(self.content_channel.staging_tree.published) def test_next_version_exported(self): self.run_publish_channel() @@ -928,6 +927,7 @@ def test_staging_tree_used_for_publish(self): self.admin_user.id, True, progress_tracker=None, + is_draft_version=True, use_staging_tree=True, ) set_active_content_database(self.tempdb) @@ -944,3 +944,108 @@ def test_staging_tree_used_for_publish(self): set_active_content_database(None) if os.path.exists(self.tempdb): os.remove(self.tempdb) + +class PublishDraftUsingMainTreeTestCase(StudioTestCase): + @classmethod + def setUpClass(cls): + super(PublishDraftUsingMainTreeTestCase, cls).setUpClass() + cls.patch_copy_db = patch("contentcuration.utils.publish.save_export_database") + cls.mock_save_export = cls.patch_copy_db.start() + + @classmethod + def tearDownClass(cls): + super(PublishDraftUsingMainTreeTestCase, cls).tearDownClass() + cls.patch_copy_db.stop() + + def setUp(self): + super(PublishDraftUsingMainTreeTestCase, self).setUp() + + self.channel_version = 3 + self.incomplete_video_in_main = "Incomplete video in main tree" + self.complete_video_in_main = "Complete video in main tree" + + self.content_channel = channel() + self.content_channel.version = self.channel_version + self.content_channel.save() + + # Incomplete node in main_tree should be excluded. + new_node = create_node( + {"kind_id": "video", "title": self.incomplete_video_in_main, "children": []} + ) + new_node.complete = False + new_node.parent = self.content_channel.main_tree + new_node.published = False + new_node.save() + + # Complete node in main_tree should be included. + new_node = create_node( + {"kind_id": "video", "title": self.complete_video_in_main, "children": []} + ) + new_node.complete = True + new_node.parent = self.content_channel.main_tree + new_node.published = False + new_node.save() + + def run_publish_channel(self): + publish_channel( + self.admin_user.id, + self.content_channel.id, + version_notes="", + force=False, + force_exercises=False, + send_email=False, + progress_tracker=None, + language="fr", + is_draft_version=True, + use_staging_tree=False, + ) + + def test_next_version_exported(self): + self.run_publish_channel() + self.mock_save_export.assert_called_with( + self.content_channel.id, + "next", + True, + ) + + def test_main_tree_not_impacted(self): + self.assertFalse(self.content_channel.main_tree.published) + self.run_publish_channel() + self.content_channel.refresh_from_db() + self.assertFalse(self.content_channel.main_tree.published) + + def test_channel_version_not_incremented(self): + self.assertEqual(self.content_channel.version, self.channel_version) + self.run_publish_channel() + self.content_channel.refresh_from_db() + self.assertEqual(self.content_channel.version, self.channel_version) + + def test_main_tree_used_for_publish(self): + set_channel_icon_encoding(self.content_channel) + self.tempdb = create_content_database( + self.content_channel, + True, + self.admin_user.id, + True, + progress_tracker=None, + is_draft_version=True, + use_staging_tree=False, + ) + set_active_content_database(self.tempdb) + + nodes = kolibri_models.ContentNode.objects.all() + self.assertEqual(nodes.filter(title=self.incomplete_video_in_main).count(), 0) + self.assertEqual(nodes.filter(title=self.complete_video_in_main).count(), 1) + + cleanup_content_database_connection(self.tempdb) + set_active_content_database(None) + if os.path.exists(self.tempdb): + os.remove(self.tempdb) + + def test_only_next_file_created(self): + self.mock_save_export.reset_mock() + self.run_publish_channel() + self.assertEqual(self.mock_save_export.call_count, 1) + call_args = self.mock_save_export.call_args + self.assertEqual(call_args[0][1], "next") + self.assertEqual(call_args[0][2], True) diff --git a/contentcuration/contentcuration/tests/viewsets/base.py b/contentcuration/contentcuration/tests/viewsets/base.py index 617d23bb26..23cea48f53 100644 --- a/contentcuration/contentcuration/tests/viewsets/base.py +++ b/contentcuration/contentcuration/tests/viewsets/base.py @@ -94,8 +94,8 @@ def generate_publish_channel_event(channel_id): return event -def generate_publish_next_event(channel_id): - event = base_generate_publish_next_event(channel_id) +def generate_publish_next_event(channel_id, use_staging_tree=False): + event = base_generate_publish_next_event(channel_id, use_staging_tree=use_staging_tree) event["rev"] = random.randint(1, 10000000) return event diff --git a/contentcuration/contentcuration/tests/viewsets/test_channel.py b/contentcuration/contentcuration/tests/viewsets/test_channel.py index 067e442ede..3bf8cf86d3 100644 --- a/contentcuration/contentcuration/tests/viewsets/test_channel.py +++ b/contentcuration/contentcuration/tests/viewsets/test_channel.py @@ -492,7 +492,7 @@ def test_publish_next(self): self.assertEqual(response.status_code, 200) modified_channel = models.Channel.objects.get(id=channel.id) - self.assertEqual(modified_channel.staging_tree.published, True) + self.assertEqual(modified_channel.staging_tree.published, False) def test_publish_next_with_incomplete_staging_tree(self): channel = testdata.channel() @@ -507,7 +507,7 @@ def test_publish_next_with_incomplete_staging_tree(self): channel.save() self.assertEqual(channel.staging_tree.published, False) - response = self.sync_changes([generate_publish_next_event(channel.id)]) + response = self.sync_changes([generate_publish_next_event(channel.id, use_staging_tree=True)]) self.assertEqual(response.status_code, 200) self.assertTrue( diff --git a/contentcuration/contentcuration/utils/publish.py b/contentcuration/contentcuration/utils/publish.py index 841f440134..fbd4b0651a 100644 --- a/contentcuration/contentcuration/utils/publish.py +++ b/contentcuration/contentcuration/utils/publish.py @@ -146,18 +146,22 @@ def create_content_database( user_id, force_exercises, progress_tracker=None, + is_draft_version=False, use_staging_tree=False, ): """ :type progress_tracker: contentcuration.utils.celery.ProgressTracker|None """ + if not is_draft_version and use_staging_tree: + raise ValueError("Staging tree is only supported for draft versions") + # increment the channel version - if not use_staging_tree and not force: + if not is_draft_version and not force: raise_if_nodes_are_all_unchanged(channel) fh, tempdb = tempfile.mkstemp(suffix=".sqlite3") with using_content_database(tempdb): - if not use_staging_tree and not channel.main_tree.publishing: + if not is_draft_version and not channel.main_tree.publishing: channel.mark_publishing(user_id) call_command( @@ -183,11 +187,11 @@ def create_content_database( progress_tracker.track(90) map_prerequisites(base_tree) # Need to save as version being published, not current version - version = "next" if use_staging_tree else channel.version + 1 + version = "next" if is_draft_version else channel.version + 1 save_export_database( channel.pk, version, - use_staging_tree, + is_draft_version, ) if channel.public: mapper = ChannelMapper(kolibri_channel) @@ -1127,14 +1131,14 @@ def mark_all_nodes_as_published(tree): logging.info("Marked all nodes as published.") -def save_export_database(channel_id, version, use_staging_tree=False): +def save_export_database(channel_id, version, is_draft_version=False): logging.debug("Saving export database") current_export_db_location = get_active_content_database() target_paths = [ os.path.join(settings.DB_ROOT, "{}-{}.sqlite3".format(channel_id, version)) ] # Only create non-version path if not using the staging tree - if not use_staging_tree: + if not is_draft_version: target_paths.append( os.path.join(settings.DB_ROOT, "{id}.sqlite3".format(id=channel_id)) ) @@ -1297,6 +1301,7 @@ def publish_channel( # noqa: C901 send_email=False, progress_tracker=None, language=settings.LANGUAGE_CODE, + is_draft_version=False, use_staging_tree=False, ): """ @@ -1317,23 +1322,23 @@ def publish_channel( # noqa: C901 user_id, force_exercises, progress_tracker=progress_tracker, - use_staging_tree=use_staging_tree, + is_draft_version=is_draft_version, + use_staging_tree=use_staging_tree, ) add_tokens_to_channel(channel) - if not use_staging_tree: + if not is_draft_version: increment_channel_version(channel) sync_contentnode_and_channel_tsvectors(channel_id=channel.id) mark_all_nodes_as_published(base_tree) fill_published_fields(channel, version_notes) - - # Attributes not getting set for some reason, so just save it here - base_tree.publishing = False - base_tree.changed = False - base_tree.published = True - base_tree.save() + base_tree.publishing = False + base_tree.changed = False + base_tree.published = True + base_tree.save() + # Delete public channel cache. - if not use_staging_tree and channel.public: + if not is_draft_version and channel.public: delete_public_channel_cache_keys() if send_email: @@ -1355,8 +1360,9 @@ def publish_channel( # noqa: C901 finally: if kolibri_temp_db and os.path.exists(kolibri_temp_db): os.remove(kolibri_temp_db) - base_tree.publishing = False - base_tree.save() + if not is_draft_version: + base_tree.publishing = False + base_tree.save() elapsed = time.time() - start diff --git a/contentcuration/contentcuration/viewsets/channel.py b/contentcuration/contentcuration/viewsets/channel.py index 1fd6625030..eb80790c5c 100644 --- a/contentcuration/contentcuration/viewsets/channel.py +++ b/contentcuration/contentcuration/viewsets/channel.py @@ -606,28 +606,29 @@ def publish(self, pk, version_notes="", language=None): raise def publish_next_from_changes(self, changes): + errors = [] for publish in changes: try: - self.publish_next(publish["key"]) + self.publish_next( + publish["key"], + version_notes=publish.get("version_notes"), + language=publish.get("language"), + use_staging_tree=publish.get("use_staging_tree", False), + ) except Exception as e: log_sync_exception(e, user=self.request.user, change=publish) publish["errors"] = [str(e)] errors.append(publish) return errors - def publish_next(self, pk): + def publish_next(self, pk, version_notes="", language=None, use_staging_tree=False): logging.debug("Entering the publish staging channel endpoint") channel = self.get_edit_queryset().get(pk=pk) if channel.deleted: raise ValidationError("Cannot publish a deleted channel") - elif channel.staging_tree.publishing: - raise ValidationError("Channel staging tree is already publishing") - - channel.staging_tree.publishing = True - channel.staging_tree.save() with create_change_tracker( pk, CHANNEL, channel.id, self.request.user, "export-channel-staging-tree" @@ -636,8 +637,11 @@ def publish_next(self, pk): channel = publish_channel( self.request.user.pk, channel.id, + version_notes=version_notes, progress_tracker=progress_tracker, - use_staging_tree=True, + language=language, + is_draft_version=True, + use_staging_tree=use_staging_tree, ) Change.create_changes( [ @@ -653,12 +657,8 @@ def publish_next(self, pk): applied=True, ) except ChannelIncompleteError: - channel.staging_tree.publishing = False - channel.staging_tree.save() raise ValidationError("Channel is not ready to be published") except Exception: - channel.staging_tree.publishing = False - channel.staging_tree.save() raise def sync_from_changes(self, changes): diff --git a/contentcuration/contentcuration/viewsets/sync/utils.py b/contentcuration/contentcuration/viewsets/sync/utils.py index a0073ce731..5fa93c8a6f 100644 --- a/contentcuration/contentcuration/viewsets/sync/utils.py +++ b/contentcuration/contentcuration/viewsets/sync/utils.py @@ -97,10 +97,11 @@ def generate_update_descendants_event(key, mods, channel_id=None, user_id=None): return event -def generate_publish_next_event(key, version_notes="", language=None): +def generate_publish_next_event(key, version_notes="", language=None, use_staging_tree=False): event = _generate_event(key, CHANNEL, PUBLISHED_NEXT, key, None) event["version_notes"] = version_notes event["language"] = language + event["use_staging_tree"] = use_staging_tree return event From 1720d0e75d98bd10db7df9f39f34143cdac325db Mon Sep 17 00:00:00 2001 From: taoerman Date: Thu, 7 Aug 2025 23:54:13 -0700 Subject: [PATCH 2/3] delete version_notes and language for publish next --- .../channelEdit/vuex/currentChannel/actions.js | 4 ++-- .../frontend/shared/data/changes.js | 2 -- .../frontend/shared/data/resources.js | 14 ++++++++++---- contentcuration/contentcuration/utils/publish.py | 2 +- .../contentcuration/viewsets/channel.py | 8 +++----- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js b/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js index 7659c0630d..33e084e453 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js +++ b/contentcuration/contentcuration/frontend/channelEdit/vuex/currentChannel/actions.js @@ -56,11 +56,11 @@ export function publishChannel(context, version_notes) { } export function publishDraftChannel(context) { - return Channel.publishDraft(context.state.currentChannelId); + return Channel.publishDraft(context.state.currentChannelId, {use_staging_tree: false}); } export function publishStagingChannel(context) { - return Channel.publishDraft(context.state.currentChannelId, true); + return Channel.publishDraft(context.state.currentChannelId, { use_staging_tree: true }); } export function channelLanguageExistsInResources(context) { diff --git a/contentcuration/contentcuration/frontend/shared/data/changes.js b/contentcuration/contentcuration/frontend/shared/data/changes.js index a59e06ffeb..a67e224973 100644 --- a/contentcuration/contentcuration/frontend/shared/data/changes.js +++ b/contentcuration/contentcuration/frontend/shared/data/changes.js @@ -448,8 +448,6 @@ export class PublishedNextChange extends Change { ); } this.setAndValidateBoolean(use_staging_tree, 'use_staging_tree'); - this.setAndValidateIsDefined(version_notes, 'version_notes'); - this.setAndValidateIsDefined(language, 'language'); this.setChannelAndUserId({ id: this.key }); } } diff --git a/contentcuration/contentcuration/frontend/shared/data/resources.js b/contentcuration/contentcuration/frontend/shared/data/resources.js index b55245ffbd..2d7e4dc89f 100644 --- a/contentcuration/contentcuration/frontend/shared/data/resources.js +++ b/contentcuration/contentcuration/frontend/shared/data/resources.js @@ -1234,12 +1234,18 @@ export const Channel = new CreateModelResource({ }); }, - publishDraft(id, use_staging_tree=false, version_notes="") { + publishDraft(id, opts={}) { + const { + use_staging_tree = false, + version_notes = '', + language = currentLanguage, + } = opts; + const change = new PublishedNextChange({ key: id, - use_staging_tree: use_staging_tree, - version_notes: version_notes, - language: currentLanguage, + use_staging_tree, + version_notes, + language, table: this.tableName, source: CLIENTID, }); diff --git a/contentcuration/contentcuration/utils/publish.py b/contentcuration/contentcuration/utils/publish.py index fbd4b0651a..a04a05d1e5 100644 --- a/contentcuration/contentcuration/utils/publish.py +++ b/contentcuration/contentcuration/utils/publish.py @@ -1137,7 +1137,7 @@ def save_export_database(channel_id, version, is_draft_version=False): target_paths = [ os.path.join(settings.DB_ROOT, "{}-{}.sqlite3".format(channel_id, version)) ] - # Only create non-version path if not using the staging tree + # Only create non-version path if not is_draft_version if not is_draft_version: target_paths.append( os.path.join(settings.DB_ROOT, "{id}.sqlite3".format(id=channel_id)) diff --git a/contentcuration/contentcuration/viewsets/channel.py b/contentcuration/contentcuration/viewsets/channel.py index 59bc208dab..bf4feb2053 100644 --- a/contentcuration/contentcuration/viewsets/channel.py +++ b/contentcuration/contentcuration/viewsets/channel.py @@ -620,8 +620,8 @@ def publish_next_from_changes(self, changes): try: self.publish_next( publish["key"], - version_notes=publish.get("version_notes"), - language=publish.get("language"), + # version_notes=publish.get("version_notes"), + # language=publish.get("language"), use_staging_tree=publish.get("use_staging_tree", False), ) except Exception as e: @@ -630,7 +630,7 @@ def publish_next_from_changes(self, changes): errors.append(publish) return errors - def publish_next(self, pk, version_notes="", language=None, use_staging_tree=False): + def publish_next(self, pk, use_staging_tree=False): logging.debug("Entering the publish staging channel endpoint") channel = self.get_edit_queryset().get(pk=pk) @@ -645,9 +645,7 @@ def publish_next(self, pk, version_notes="", language=None, use_staging_tree=Fal channel = publish_channel( self.request.user.pk, channel.id, - version_notes=version_notes, progress_tracker=progress_tracker, - language=language, is_draft_version=True, use_staging_tree=use_staging_tree, ) From 225bd384f05fa4649c924a802f1943220c6f5ac1 Mon Sep 17 00:00:00 2001 From: taoerman Date: Fri, 8 Aug 2025 00:36:06 -0700 Subject: [PATCH 3/3] delete all version_notes and language for publish_next --- .../frontend/shared/data/__tests__/changes.spec.js | 4 +--- .../contentcuration/frontend/shared/data/changes.js | 2 +- .../contentcuration/frontend/shared/data/resources.js | 4 ---- .../contentcuration/frontend/shared/data/serverSync.js | 2 +- contentcuration/contentcuration/tests/test_exportchannel.py | 4 ---- contentcuration/contentcuration/viewsets/channel.py | 2 -- contentcuration/contentcuration/viewsets/sync/utils.py | 4 +--- 7 files changed, 4 insertions(+), 18 deletions(-) diff --git a/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js b/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js index 9ea28f3e54..76a9264276 100644 --- a/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js +++ b/contentcuration/contentcuration/frontend/shared/data/__tests__/changes.spec.js @@ -258,8 +258,6 @@ describe('Change Types', () => { key: '1', table: TABLE_NAMES.CHANNEL, use_staging_tree: false, - version_notes: 'Test version notes', - language: 'en', source: CLIENTID, }); const rev = await change.saveChange(); @@ -267,7 +265,7 @@ describe('Change Types', () => { expect(persistedChange).toEqual({ rev, channel_id: change.key, - ...pick(change, ['type', 'key', 'table', 'use_staging_tree', 'version_notes', 'language', 'source']), + ...pick(change, ['type', 'key', 'table', 'use_staging_tree', 'source']), }); }); diff --git a/contentcuration/contentcuration/frontend/shared/data/changes.js b/contentcuration/contentcuration/frontend/shared/data/changes.js index a67e224973..acb9f963e2 100644 --- a/contentcuration/contentcuration/frontend/shared/data/changes.js +++ b/contentcuration/contentcuration/frontend/shared/data/changes.js @@ -439,7 +439,7 @@ export class PublishedChange extends Change { } export class PublishedNextChange extends Change { - constructor({ use_staging_tree, version_notes, language, ...fields }) { + constructor({ use_staging_tree, ...fields }) { fields.type = CHANGE_TYPES.PUBLISHED_NEXT; super(fields); if (this.table !== TABLE_NAMES.CHANNEL) { diff --git a/contentcuration/contentcuration/frontend/shared/data/resources.js b/contentcuration/contentcuration/frontend/shared/data/resources.js index 2d7e4dc89f..cb7a3dc73b 100644 --- a/contentcuration/contentcuration/frontend/shared/data/resources.js +++ b/contentcuration/contentcuration/frontend/shared/data/resources.js @@ -1237,15 +1237,11 @@ export const Channel = new CreateModelResource({ publishDraft(id, opts={}) { const { use_staging_tree = false, - version_notes = '', - language = currentLanguage, } = opts; const change = new PublishedNextChange({ key: id, use_staging_tree, - version_notes, - language, table: this.tableName, source: CLIENTID, }); diff --git a/contentcuration/contentcuration/frontend/shared/data/serverSync.js b/contentcuration/contentcuration/frontend/shared/data/serverSync.js index 0015766058..29efce4c16 100644 --- a/contentcuration/contentcuration/frontend/shared/data/serverSync.js +++ b/contentcuration/contentcuration/frontend/shared/data/serverSync.js @@ -36,7 +36,7 @@ const ChangeTypeMapFields = { 'excluded_descendants', ]), [CHANGE_TYPES.PUBLISHED]: commonFields.concat(['version_notes', 'language']), - [CHANGE_TYPES.PUBLISHED_NEXT]: commonFields.concat(['use_staging_tree', 'version_notes', 'language']), + [CHANGE_TYPES.PUBLISHED_NEXT]: commonFields.concat(['use_staging_tree']), [CHANGE_TYPES.SYNCED]: commonFields.concat([ 'titles_and_descriptions', 'resource_details', diff --git a/contentcuration/contentcuration/tests/test_exportchannel.py b/contentcuration/contentcuration/tests/test_exportchannel.py index c7c3097a4c..f8dd4cf08a 100644 --- a/contentcuration/contentcuration/tests/test_exportchannel.py +++ b/contentcuration/contentcuration/tests/test_exportchannel.py @@ -879,12 +879,10 @@ def run_publish_channel(self): publish_channel( self.admin_user.id, self.content_channel.id, - version_notes="", force=False, force_exercises=False, send_email=False, progress_tracker=None, - language="fr", is_draft_version=True, use_staging_tree=True, ) @@ -990,12 +988,10 @@ def run_publish_channel(self): publish_channel( self.admin_user.id, self.content_channel.id, - version_notes="", force=False, force_exercises=False, send_email=False, progress_tracker=None, - language="fr", is_draft_version=True, use_staging_tree=False, ) diff --git a/contentcuration/contentcuration/viewsets/channel.py b/contentcuration/contentcuration/viewsets/channel.py index bf4feb2053..be7f26e799 100644 --- a/contentcuration/contentcuration/viewsets/channel.py +++ b/contentcuration/contentcuration/viewsets/channel.py @@ -620,8 +620,6 @@ def publish_next_from_changes(self, changes): try: self.publish_next( publish["key"], - # version_notes=publish.get("version_notes"), - # language=publish.get("language"), use_staging_tree=publish.get("use_staging_tree", False), ) except Exception as e: diff --git a/contentcuration/contentcuration/viewsets/sync/utils.py b/contentcuration/contentcuration/viewsets/sync/utils.py index 99922ee6c8..8f5ce98a05 100644 --- a/contentcuration/contentcuration/viewsets/sync/utils.py +++ b/contentcuration/contentcuration/viewsets/sync/utils.py @@ -98,10 +98,8 @@ def generate_update_descendants_event(key, mods, channel_id=None, user_id=None): return event -def generate_publish_next_event(key, version_notes="", language=None, use_staging_tree=False): +def generate_publish_next_event(key, use_staging_tree=False): event = _generate_event(key, CHANNEL, PUBLISHED_NEXT, key, None) - event["version_notes"] = version_notes - event["language"] = language event["use_staging_tree"] = use_staging_tree return event