Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Collective/NcActionCollectiveActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default {
'isCollectiveAdmin',
]),

...mapState(usePagesStore, ['pagesTreeWalk']),
...mapState(usePagesStore, ['pagesTreeWalkForCollective']),

circleLink() {
return generateUrl('/apps/contacts/direct/circle/' + this.collective.circleId)
Expand All @@ -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() {},
Expand Down
22 changes: 22 additions & 0 deletions src/stores/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -352,6 +371,9 @@ export const usePagesStore = defineStore('pages', {

sortByDefault() {
const collectivesStore = useCollectivesStore()
if (!collectivesStore.currentCollective) {
return 'byOrder'
}
return sortOrders.pageOrdersByNumber[collectivesStore.currentCollective.userPageOrder]
},

Expand Down
Loading