DEV: Only allow expanding hidden posts for author and staff (#21052)

This commit is contained in:
Ted Johansson
2023-04-25 13:37:29 +08:00
committed by GitHub
parent 9cc1b6a959
commit 02625d1edd
4 changed files with 46 additions and 3 deletions

View File

@@ -497,7 +497,10 @@ createWidget("post-contents", {
result = result.concat(applyDecorators(this, "after-cooked", attrs, state));
if (attrs.cooked_hidden) {
if (
attrs.cooked_hidden &&
(this.currentUser?.isLeader || attrs.user_id === this.currentUser?.id)
) {
result.push(this.attach("expand-hidden", attrs));
}