From ece9e9cd2eaae1489d2814652ab6b1eac48fdca7 Mon Sep 17 00:00:00 2001 From: taoerman Date: Fri, 7 Nov 2025 08:34:25 -0800 Subject: [PATCH 01/10] Show resubmit channel to community library CTA after channel publish --- .../modals/ResubmitChannelModal.vue | 162 ++++++++++++++++++ .../sidePanels/PublishSidePanel.vue | 4 +- .../views/TreeView/TreeViewBase.vue | 47 +++++ .../strings/communityChannelsStrings.js | 24 +++ 4 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue new file mode 100644 index 0000000000..703de8c2d5 --- /dev/null +++ b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue @@ -0,0 +1,162 @@ + + + + + + + diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue index 9c0027442d..8d9fac95c4 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue @@ -328,6 +328,8 @@ }); } + emit('published', { channelId: currentChannel.value.id }); + await Channel.publish(currentChannel.value.id, version_notes.value); emit('close'); @@ -402,7 +404,7 @@ }; }, - emits: ['close'], + emits: ['close', 'published'], }; diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue index 6ca82f5d2d..527c532317 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue @@ -235,12 +235,20 @@ + - + const emit = defineEmits(['dismiss', 'resubmit', 'input']); + const title = computed(() => communityChannelsStrings.resubmitModalTitle$()); - + diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue index 8d9fac95c4..b85b1bb877 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue @@ -137,10 +137,16 @@ - {{ submitText }} + + + + {{ submitText }} @@ -154,7 +160,7 @@ import { ref, computed, getCurrentInstance, onMounted } from 'vue'; import SidePanelModal from 'shared/views/SidePanelModal'; - import { Channel } from 'shared/data/resources'; + import { Channel, CommunityLibrarySubmission } from 'shared/data/resources'; import { forceServerSync } from 'shared/data/serverSync'; import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings'; import { LanguagesList } from 'shared/leUtils/Languages'; @@ -173,6 +179,7 @@ const mode = ref(PublishModes.LIVE); const version_notes = ref(''); const submitting = ref(false); + const checkingResubmit = ref(false); const language = ref({}); const showLanguageInvalidText = ref(false); const showVersionNotesInvalidText = ref(false); // lazy validation @@ -328,15 +335,41 @@ }); } + await Channel.publish(currentChannel.value.id, version_notes.value); + emit('published', { channelId: currentChannel.value.id }); - await Channel.publish(currentChannel.value.id, version_notes.value); + if (mode.value === PublishModes.LIVE) { + checkingResubmit.value = true; + try { + const response = await CommunityLibrarySubmission.fetchCollection({ + channel: currentChannel.value.id, + max_results: 1, + }); + + const submissions = response?.results || []; + + if (submissions.length > 0) { + const latestSubmission = submissions[0]; + emit('showResubmitCommunityLibraryModal', { + channel: currentChannel.value ? { ...currentChannel.value } : null, + latestSubmissionVersion: latestSubmission?.channel_version ?? null, + }); + } + } catch (error) { + store.dispatch('shared/handleAxiosError', error); + } finally { + checkingResubmit.value = false; + submitting.value = false; + } + } else { + submitting.value = false; + } emit('close'); } } catch (error) { store.dispatch('shared/handleAxiosError', error); - } finally { submitting.value = false; } }; @@ -371,6 +404,7 @@ mode, version_notes, submitting, + checkingResubmit, language, showLanguageInvalidText, showVersionNotesInvalidText, @@ -404,7 +438,7 @@ }; }, - emits: ['close', 'published'], + emits: ['close', 'published', 'showResubmitCommunityLibraryModal'], }; diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue index 527c532317..163c839bd7 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue @@ -236,6 +236,7 @@ v-if="showPublishSidePanel" @close="showPublishSidePanel = false" @published="handleChannelPublished" + @showResubmitCommunityLibraryModal="handleShowResubmitModal" /> @@ -358,7 +360,7 @@ import PublishSidePanel from '../../components/sidePanels/PublishSidePanel'; import SubmitToCommunityLibrarySidePanel from '../../components/sidePanels/SubmitToCommunityLibrarySidePanel'; import ResubmitChannelModal from '../../components/modals/ResubmitChannelModal'; - import { Channel, CommunityLibrarySubmission } from 'shared/data/resources'; + import { Channel } from 'shared/data/resources'; import MainNavigationDrawer from 'shared/views/MainNavigationDrawer'; import ToolBar from 'shared/views/ToolBar'; import ChannelTokenModal from 'shared/views/channel/ChannelTokenModal'; @@ -410,6 +412,7 @@ showDeleteModal: false, syncing: false, resubmitModalChannel: null, + resubmitModalSubmissionVersion: null, }; }, computed: { @@ -566,32 +569,12 @@ handleDismissResubmit() { this.showResubmitModal = false; this.resubmitModalChannel = null; + this.resubmitModalSubmissionVersion = null; }, - async handleChannelPublished({ channelId }) { - if (!channelId || !this.currentChannel || this.currentChannel.id !== channelId) { - return; - } - - const response = await CommunityLibrarySubmission.fetchCollection({ - channel: channelId, - max_results: 1, - }); - - let submissions = []; - if (Array.isArray(response)) { - submissions = response; - } else if (response && response.results && Array.isArray(response.results)) { - submissions = response.results; - } - - if (submissions.length > 0) { - const latestSubmission = submissions[0]; - this.resubmitModalChannel = { - ...this.currentChannel, - version: latestSubmission.channel_version, - }; - this.showResubmitModal = true; - } + handleShowResubmitModal({ channel, latestSubmissionVersion }) { + this.resubmitModalChannel = channel; + this.resubmitModalSubmissionVersion = latestSubmissionVersion || null; + this.showResubmitModal = true; }, trackClickEvent(eventLabel) { this.$analytics.trackClick('channel_editor_toolbar', eventLabel); From 98e811550de0bb9205921320382470f3de29fc12 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:42:11 +0000 Subject: [PATCH 04/10] [pre-commit.ci lite] apply automatic fixes --- .../channelEdit/components/sidePanels/PublishSidePanel.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue index b85b1bb877..e378705834 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue @@ -344,7 +344,7 @@ try { const response = await CommunityLibrarySubmission.fetchCollection({ channel: currentChannel.value.id, - max_results: 1, + max_results: 1, }); const submissions = response?.results || []; From 14a38ff8989c5ca27fd58eb0f21d310bc4402009 Mon Sep 17 00:00:00 2001 From: taoerman Date: Mon, 17 Nov 2025 09:48:40 -0800 Subject: [PATCH 05/10] fix code --- .../modals/ResubmitChannelModal.vue | 22 +++++++++---------- .../sidePanels/PublishSidePanel.vue | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue index d9bc9cf936..8bd047b1cf 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue @@ -24,17 +24,17 @@ import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings'; const props = defineProps({ - value: { - type: Boolean, - default: false, - }, - channel: { - type: Object, - required: true, - validator(value) { - return value && typeof value.name === 'string' && typeof value.version === 'number'; + value: { + type: Boolean, + default: false, + }, + channel: { + type: Object, + required: true, + validator(value) { + return value && typeof value.name === 'string' && typeof value.version === 'number'; + }, }, - }, latestSubmissionVersion: { type: Number, default: null, @@ -46,7 +46,7 @@ const title = computed(() => communityChannelsStrings.resubmitModalTitle$()); const publishedVersion = computed(() => { - return props.latestSubmissionVersion; + return props.latestSubmissionVersion != null ? props.latestSubmissionVersion : props.channel.version; }); const description = computed(() => diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue index b85b1bb877..e378705834 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/sidePanels/PublishSidePanel.vue @@ -344,7 +344,7 @@ try { const response = await CommunityLibrarySubmission.fetchCollection({ channel: currentChannel.value.id, - max_results: 1, + max_results: 1, }); const submissions = response?.results || []; From 6d943d1cf41d134a32d3246b7af09a64bedae08f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 17:51:42 +0000 Subject: [PATCH 06/10] [pre-commit.ci lite] apply automatic fixes --- .../modals/ResubmitChannelModal.vue | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue index 8bd047b1cf..43b462918c 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue @@ -24,17 +24,17 @@ import { communityChannelsStrings } from 'shared/strings/communityChannelsStrings'; const props = defineProps({ - value: { - type: Boolean, - default: false, - }, - channel: { - type: Object, - required: true, - validator(value) { - return value && typeof value.name === 'string' && typeof value.version === 'number'; - }, + value: { + type: Boolean, + default: false, + }, + channel: { + type: Object, + required: true, + validator(value) { + return value && typeof value.name === 'string' && typeof value.version === 'number'; }, + }, latestSubmissionVersion: { type: Number, default: null, @@ -46,7 +46,9 @@ const title = computed(() => communityChannelsStrings.resubmitModalTitle$()); const publishedVersion = computed(() => { - return props.latestSubmissionVersion != null ? props.latestSubmissionVersion : props.channel.version; + return props.latestSubmissionVersion != null + ? props.latestSubmissionVersion + : props.channel.version; }); const description = computed(() => From 1b6fe9449420de20b2def5905c1e2d61b3e565df Mon Sep 17 00:00:00 2001 From: taoerman Date: Mon, 17 Nov 2025 09:58:34 -0800 Subject: [PATCH 07/10] fix code --- .../frontend/channelEdit/views/TreeView/TreeViewBase.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue index 163c839bd7..bd48fff629 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue @@ -360,7 +360,6 @@ import PublishSidePanel from '../../components/sidePanels/PublishSidePanel'; import SubmitToCommunityLibrarySidePanel from '../../components/sidePanels/SubmitToCommunityLibrarySidePanel'; import ResubmitChannelModal from '../../components/modals/ResubmitChannelModal'; - import { Channel } from 'shared/data/resources'; import MainNavigationDrawer from 'shared/views/MainNavigationDrawer'; import ToolBar from 'shared/views/ToolBar'; import ChannelTokenModal from 'shared/views/channel/ChannelTokenModal'; From bd77b0c6e7ebf0d13be9a0bfaa1c212db139fb19 Mon Sep 17 00:00:00 2001 From: taoerman Date: Wed, 19 Nov 2025 18:49:46 -0800 Subject: [PATCH 08/10] fix bug --- .../modals/ResubmitChannelModal.vue | 18 +++---- .../sidePanels/PublishSidePanel.vue | 47 ++++++------------- .../views/TreeView/TreeViewBase.vue | 28 +++++------ .../strings/communityChannelsStrings.js | 12 ++--- 4 files changed, 39 insertions(+), 66 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue index 43b462918c..28b74958d7 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/modals/ResubmitChannelModal.vue @@ -1,7 +1,6 @@ @@ -179,7 +173,6 @@ const mode = ref(PublishModes.LIVE); const version_notes = ref(''); const submitting = ref(false); - const checkingResubmit = ref(false); const language = ref({}); const showLanguageInvalidText = ref(false); const showVersionNotesInvalidText = ref(false); // lazy validation @@ -340,36 +333,27 @@ emit('published', { channelId: currentChannel.value.id }); if (mode.value === PublishModes.LIVE) { - checkingResubmit.value = true; - try { - const response = await CommunityLibrarySubmission.fetchCollection({ - channel: currentChannel.value.id, - max_results: 1, - }); + const response = await CommunityLibrarySubmission.fetchCollection({ + channel: currentChannel.value.id, + max_results: 1, + }); - const submissions = response?.results || []; - - if (submissions.length > 0) { - const latestSubmission = submissions[0]; - emit('showResubmitCommunityLibraryModal', { - channel: currentChannel.value ? { ...currentChannel.value } : null, - latestSubmissionVersion: latestSubmission?.channel_version ?? null, - }); - } - } catch (error) { - store.dispatch('shared/handleAxiosError', error); - } finally { - checkingResubmit.value = false; - submitting.value = false; + const submissions = response?.results || []; + + if (submissions.length > 0) { + const latestSubmission = submissions[0]; + emit('showResubmitCommunityLibraryModal', { + channel: { ...currentChannel.value }, + latestSubmissionVersion: latestSubmission.channel_version, + }); } - } else { - submitting.value = false; } emit('close'); } } catch (error) { store.dispatch('shared/handleAxiosError', error); + } finally { submitting.value = false; } }; @@ -404,7 +388,6 @@ mode, version_notes, submitting, - checkingResubmit, language, showLanguageInvalidText, showVersionNotesInvalidText, diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue index bd48fff629..3f844c51df 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/TreeView/TreeViewBase.vue @@ -244,12 +244,11 @@ @close="showSubmitToCommunityLibrarySidePanel = false" />