Skip to content

Commit

Permalink
fix(pageShare): No page deletion and page trash in page shares
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Dec 11, 2023
1 parent 78935e5 commit 012eeb5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/Controller/PublicPageTrashController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ private function getShare(): CollectiveShareInfo {
if ($this->share === null) {
throw new NotFoundException('Failed to get shared collective');
}

if ($this->share->getPageId() !== 0) {
throw new NotFoundException('Shared page does not support page trash');
}
}

return $this->share;
Expand Down
5 changes: 3 additions & 2 deletions src/components/Collective.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default {
...mapGetters([
'currentCollective',
'currentCollectiveCanEdit',
'currentCollectiveIsPageShare',
'currentFileIdPage',
'currentPage',
'loading',
Expand Down Expand Up @@ -172,7 +173,7 @@ export default {
async getPages() {
await this.dispatchGetPages()
.catch(displayError('Could not fetch pages'))
if (this.currentCollectiveCanEdit) {
if (this.currentCollectiveCanEdit && !this.currentCollectiveIsPageShare) {
await this.dispatchGetTrashPages()
.catch(displayError('Could not fetch page trash'))
}
Expand All @@ -184,7 +185,7 @@ export default {
async getPagesBackground() {
await this.dispatchGetPages(false)
.catch(displayError('Could not fetch pages'))
if (this.currentCollectiveCanEdit) {
if (this.currentCollectiveCanEdit && !this.currentCollectiveIsPageShare) {
await this.dispatchGetTrashPages()
.catch(displayError('Could not fetch page trash'))
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/Page/PageActionMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
</NcActionButton>

<!-- Delete page -->
<NcActionButton v-if="currentCollectiveCanEdit && !isLandingPage"
<NcActionButton v-if="displayDeleteAction"
:close-after-click="true"
@click="deletePage(pageId)">
<template #icon>
Expand Down Expand Up @@ -203,6 +203,7 @@ export default {
...mapGetters([
'currentCollective',
'currentCollectiveCanEdit',
'currentCollectiveIsPageShare',
'hasSubpages',
'isFullWidthView',
'loading',
Expand All @@ -224,6 +225,12 @@ export default {
return this.lastUserId && this.lastUserDisplayName
},
displayDeleteAction() {
return this.currentCollectiveCanEdit
&& !this.currentCollectiveIsPageShare
&& !this.isLandingPage
},
toggleOutlineString() {
return this.showing('outline')
? t('collectives', 'Hide outline')
Expand Down
1 change: 1 addition & 0 deletions src/components/PageList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export default {
displayTrash() {
return this.currentCollectiveCanEdit
&& !this.currentCollectiveIsPageShare
&& ('files_trashbin' in this.OC.appswebroots)
&& !this.loading('collectives')
},
Expand Down

0 comments on commit 012eeb5

Please sign in to comment.