FIX: TL4 users cannot unhide posts. (#13211)

"PostsGuardian#can_unhide_post?" only returns true if the user is a staff member. We shouldn't let TL4 users see the Unhide post button.
This commit is contained in:
Roman Rizzi 2021-05-31 16:39:25 -03:00 committed by GitHub
parent 869518e3d2
commit 9ecd17b083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -65,7 +65,7 @@ export function buildManageButtons(attrs, currentUser, siteSettings) {
});
}
if (attrs.canManage && attrs.hidden) {
if (currentUser.staff && attrs.hidden) {
contents.push({
icon: "far-eye",
label: "post.controls.unhide",

View File

@ -734,6 +734,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) {
{{mount-widget widget="post" args=args unhidePost=unhidePost}}
`,
beforeEach() {
this.currentUser.admin = true;
this.set("args", { canManage: true, hidden: true });
this.set("unhidePost", () => (this.unhidden = true));
},