Skip to content

Commit

Permalink
Merge pull request #16680 from dannon/page-owner-edit-restrict
Browse files Browse the repository at this point in the history
[23.1] Only show 'edit' on published pages when viewer is the owner.
  • Loading branch information
mvdbeek authored Sep 13, 2023
2 parents a7caa73 + c26e5b6 commit 5f4107d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions client/src/components/PageDisplay/PageDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:enable_beta_markdown_export="config.enable_beta_markdown_export"
:download-endpoint="stsUrl(config)"
:export-link="exportUrl"
:read-only="!userOwnsPage"
@onEdit="onEdit" />
<PageHtml v-else :page="page" />
</div>
Expand All @@ -22,6 +23,8 @@
import { urlData } from "utils/url";
import { withPrefix } from "utils/redirect";
import ConfigProvider from "components/providers/ConfigProvider";
import { mapState } from "pinia";
import { useUserStore } from "@/stores/userStore";
import Markdown from "components/Markdown/Markdown";
import Published from "components/Common/Published";
import PageHtml from "./PageHtml";
Expand All @@ -45,6 +48,10 @@ export default {
};
},
computed: {
...mapState(useUserStore, ["currentUser"]),
userOwnsPage() {
return this.currentUser.username === this.page.username;
},
dataUrl() {
return `/api/pages/${this.pageId}`;
},
Expand Down

0 comments on commit 5f4107d

Please sign in to comment.