From d471476f5b88228eb507be2b93b81f6136353dde Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 14 May 2026 17:51:21 +0200 Subject: [PATCH] fix(CollectiveActions): opening from start page with defined extra action Opening the three-dot menu in the collectives list without a current collective (i.e. from the app start page) failed when having an extra action defined (e.g. when the pandoc app is installed). This was because getters used in `collectiveExtraAction` computed depended on currentCollective. Signed-off-by: Jonas --- .../Collective/NcActionCollectiveActions.vue | 4 ++-- src/stores/pages.js | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/Collective/NcActionCollectiveActions.vue b/src/components/Collective/NcActionCollectiveActions.vue index 600ede43a..6def4d469 100644 --- a/src/components/Collective/NcActionCollectiveActions.vue +++ b/src/components/Collective/NcActionCollectiveActions.vue @@ -140,7 +140,7 @@ export default { 'isCollectiveAdmin', ]), - ...mapState(usePagesStore, ['pagesTreeWalk']), + ...mapState(usePagesStore, ['pagesTreeWalkForCollective']), circleLink() { return generateUrl('/apps/contacts/direct/circle/' + this.collective.circleId) @@ -160,7 +160,7 @@ export default { return null } - const pageIds = this.pagesTreeWalk().map((p) => p.id) + const pageIds = this.pagesTreeWalkForCollective(this.collective).map((p) => p.id) return { title: collectiveExtraAction.title ?? t('collectives', 'Extra action'), click: () => collectiveExtraAction.click(pageIds) ?? function() {}, diff --git a/src/stores/pages.js b/src/stores/pages.js index 6a449f68e..fbb775d21 100644 --- a/src/stores/pages.js +++ b/src/stores/pages.js @@ -305,10 +305,29 @@ export const usePagesStore = defineStore('pages', { } }, + visibleSubpagesForCollective(state) { + return (collective, parentId) => { + return state.sortedSubpagesForCollective(collective, parentId) + } + }, + visibleSubpages: (state) => (parentId) => { return state.sortedSubpages(parentId) }, + pagesTreeWalkForCollective(state) { + return (collective, parentId = 0) => { + const pages = [] + for (const page of state.visibleSubpagesForCollective(collective, parentId)) { + pages.push(page) + for (const subpage of state.pagesTreeWalkForCollective(collective, page.id)) { + pages.push(subpage) + } + } + return pages + } + }, + pagesTreeWalk: (state) => (parentId = 0) => { const pages = [] for (const page of state.visibleSubpages(parentId)) { @@ -352,6 +371,9 @@ export const usePagesStore = defineStore('pages', { sortByDefault() { const collectivesStore = useCollectivesStore() + if (!collectivesStore.currentCollective) { + return 'byOrder' + } return sortOrders.pageOrdersByNumber[collectivesStore.currentCollective.userPageOrder] },