diff --git a/contentcuration/contentcuration/frontend/channelEdit/router.js b/contentcuration/contentcuration/frontend/channelEdit/router.js index 1336a434b8..69615e4d7b 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/router.js +++ b/contentcuration/contentcuration/frontend/channelEdit/router.js @@ -13,6 +13,22 @@ import ChannelDetailsModal from 'shared/views/channel/ChannelDetailsModal'; import ChannelModal from 'shared/views/channel/ChannelModal'; import { RouteNames as ChannelRouteNames } from 'frontend/channelList/constants'; +const importBeforeEnter = function (to, from, next) { + const promises = [ + // search recommendations require ancestors to be loaded + store.dispatch('contentNode/loadAncestors', { id: to.params.destNodeId }), + ]; + + if (!store.getters['currentChannel/currentChannel']) { + // ensure the current channel is loaded, in case of hard refresh on this route. + // alternatively, the page could be reactive to this getter's value, although that doesn't + // seem to work properly + promises.push(store.dispatch('currentChannel/loadChannel')); + } + + return Promise.all(promises).then(() => next()); +}; + const router = new VueRouter({ routes: [ { @@ -38,27 +54,14 @@ const router = new VueRouter({ path: '/import/:destNodeId/browse/:channelId?/:nodeId?', component: SearchOrBrowseWindow, props: true, - beforeEnter: (to, from, next) => { - const promises = [ - // search recommendations require ancestors to be loaded - store.dispatch('contentNode/loadAncestors', { id: to.params.destNodeId }), - ]; - - if (!store.getters['currentChannel/currentChannel']) { - // ensure the current channel is loaded, in case of hard refresh on this route. - // alternatively, the page could be reactive to this getter's value, although that doesn't - // seem to work properly - promises.push(store.dispatch('currentChannel/loadChannel')); - } - - return Promise.all(promises).then(() => next()); - }, + beforeEnter: importBeforeEnter, }, { name: RouteNames.IMPORT_FROM_CHANNELS_SEARCH, path: '/import/:destNodeId/search/:searchTerm', component: SearchOrBrowseWindow, props: true, + beforeEnter: importBeforeEnter, }, { name: RouteNames.IMPORT_FROM_CHANNELS_REVIEW, diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchOrBrowseWindow.vue b/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchOrBrowseWindow.vue index 8783dcc822..4ff6879c98 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchOrBrowseWindow.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchOrBrowseWindow.vue @@ -395,6 +395,10 @@ return false; } + if (this.embedTopicRequest === null) { + return false; + } + if (!validateEmbedTopicRequest(this.embedTopicRequest)) { // log to sentry-- this is unexpected, since we use the channel's language as a fallback // and channels are required to have a language @@ -472,6 +476,14 @@ }); }, embedTopicRequest() { + // Ensure destination folder is loaded, and it and its ancestors have titles + if ( + !this.importDestinationFolder || + !this.importDestinationFolder.title || + this.topicAncestors.some(n => !n.title) + ) { + return null; + } return { topics: [ { diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/__tests__/SearchOrBrowseWindow.spec.js b/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/__tests__/SearchOrBrowseWindow.spec.js index d579142977..e254bb21ab 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/__tests__/SearchOrBrowseWindow.spec.js +++ b/contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/__tests__/SearchOrBrowseWindow.spec.js @@ -78,7 +78,7 @@ describe('SearchOrBrowseWindow', () => { 'currentChannel/currentChannel': () => ({ language: 'en' }), 'importFromChannels/savedSearchesExist': () => true, isAIFeatureEnabled: () => true, - 'contentNode/getContentNodeAncestors': () => () => [{ id: 'node-1' }], + 'contentNode/getContentNodeAncestors': () => () => [{ id: 'node-1', title: 'Test folder' }], }; store = new Store({ diff --git a/contentcuration/contentcuration/frontend/shared/styles/main.scss b/contentcuration/contentcuration/frontend/shared/styles/main.scss index 03242da506..8e3188950c 100644 --- a/contentcuration/contentcuration/frontend/shared/styles/main.scss +++ b/contentcuration/contentcuration/frontend/shared/styles/main.scss @@ -53,7 +53,8 @@ body { outline: 2px solid var(--v-secondary-base) !important; } - > .v-dialog__content { + > .v-dialog__content, + > .v-overlay { z-index: 16 !important; } }