Skip to content

Commit

Permalink
Merge pull request #12236 from rtibbles/lets_get_topical
Browse files Browse the repository at this point in the history
Revert change that prevented search redirect in all cases.
  • Loading branch information
rtibbles authored Jun 8, 2024
2 parents 470c490 + d2484c8 commit cb1fcd7
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions kolibri/plugins/learn/assets/src/views/TopicsPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -399,24 +399,19 @@
};
function _handleTopicRedirect(route, children, id, skipped) {
if (children.every(c => c.is_leaf) && route.name !== PageNames.TOPICS_TOPIC_SEARCH) {
// if all children are leaf nodes (i.e. they have no children themselves)
if (!children.some(c => !c.is_leaf) && route.name !== PageNames.TOPICS_TOPIC_SEARCH) {
// if there are no children which are not leaf nodes (i.e. they have children themselves)
// which is equivalent to saying that all children are leaf nodes
// then redirect to search results
if (children.every(c => c.title == '')) {
router.replace({
name: PageNames.TOPICS_TOPIC_SEARCH,
params: { ...route.params, id },
query: route.query,
});
} else {
sidePanelIsOpen.value = false;
}
router.replace({
name: PageNames.TOPICS_TOPIC_SEARCH,
params: { ...route.params, id },
query: route.query,
});
} else if (skipped) {
// If we have skipped down the topic tree, replace to the new top level topic
router.replace({ name: route.name, params: { ...route.params, id }, query: route.query });
return true;
} else {
sidePanelIsOpen.value = false;
}
}
Expand Down Expand Up @@ -489,6 +484,7 @@
set(channel, null);
set(contents, []);
set(isRoot, false);
set(sidePanelIsOpen, false);
const shouldResolve = samePageCheckGenerator(store);
let promise;
if (props.deviceId) {
Expand Down

0 comments on commit cb1fcd7

Please sign in to comment.