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

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.

diff --git a/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js b/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js
index dd56714..f689d5a 100644
--- a/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js
+++ b/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js
@@ -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",
diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js
index 3e2cda1..995ec59 100644
--- a/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js
@@ -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));
     },

GitHub sha: 9ecd17b0

This commit appears in #13211 which was approved by eviltrout. It was merged by romanrizzi.