From 56d1232588cac825b960782868e2ea3148371f33 Mon Sep 17 00:00:00 2001
From: Ilja <ilja@ilja.space>
Date: Sat, 6 Aug 2022 22:33:38 +0200
Subject: Show moderation drop down menu and items based on privileges

There's a seperator between certain blocks of items. I show/hide the seperator together with the block under it.
When a block with a seperator is at the top, the seperator doesn't show, keeping a consistent look with seperators only between blocks.

I also hide granting roles for deactivated accounts because that doesn't make much sense to me.

For the rest the items are hidden when you're not privileged. When there's no privileges that show items, the menu isn't shown either.
---
 src/components/moderation_tools/moderation_tools.vue | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'src/components/moderation_tools/moderation_tools.vue')

diff --git a/src/components/moderation_tools/moderation_tools.vue b/src/components/moderation_tools/moderation_tools.vue
index 34fe2e7c..8535ef27 100644
--- a/src/components/moderation_tools/moderation_tools.vue
+++ b/src/components/moderation_tools/moderation_tools.vue
@@ -10,7 +10,7 @@
     >
       <template #content>
         <div class="dropdown-menu">
-          <span v-if="user.is_local">
+          <span v-if="canGrantRole">
             <button
               class="button-default dropdown-item"
               @click="toggleRight(&quot;admin&quot;)"
@@ -24,28 +24,31 @@
               {{ $t(!!user.rights.moderator ? 'user_card.admin_menu.revoke_moderator' : 'user_card.admin_menu.grant_moderator') }}
             </button>
             <div
+              v-if="canChangeActivationState || canDeleteAccount"
               role="separator"
               class="dropdown-divider"
             />
           </span>
           <button
+            v-if="canChangeActivationState"
             class="button-default dropdown-item"
             @click="toggleActivationStatus()"
           >
             {{ $t(!!user.deactivated ? 'user_card.admin_menu.activate_account' : 'user_card.admin_menu.deactivate_account') }}
           </button>
           <button
+            v-if="canDeleteAccount"
             class="button-default dropdown-item"
             @click="deleteUserDialog(true)"
           >
             {{ $t('user_card.admin_menu.delete_account') }}
           </button>
           <div
-            v-if="hasTagPolicy"
+            v-if="canUseTagPolicy"
             role="separator"
             class="dropdown-divider"
           />
-          <span v-if="hasTagPolicy">
+          <span v-if="canUseTagPolicy">
             <button
               class="button-default dropdown-item"
               @click="toggleTag(tags.FORCE_NSFW)"
-- 
cgit v1.2.3-70-g09d2

