logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

moderation_tools.vue (6133B)


  1. <template>
  2. <div>
  3. <Popover
  4. trigger="click"
  5. class="moderation-tools-popover"
  6. placement="bottom"
  7. :offset="{ y: 5 }"
  8. @show="setToggled(true)"
  9. @close="setToggled(false)"
  10. >
  11. <template #content>
  12. <div class="dropdown-menu">
  13. <span v-if="canGrantRole">
  14. <button
  15. class="menu-item dropdown-item menu-item"
  16. @click="toggleRight(&quot;admin&quot;)"
  17. >
  18. {{ $t(!!user.rights.admin ? 'user_card.admin_menu.revoke_admin' : 'user_card.admin_menu.grant_admin') }}
  19. </button>
  20. <button
  21. class="menu-item dropdown-item menu-item"
  22. @click="toggleRight(&quot;moderator&quot;)"
  23. >
  24. {{ $t(!!user.rights.moderator ? 'user_card.admin_menu.revoke_moderator' : 'user_card.admin_menu.grant_moderator') }}
  25. </button>
  26. <div
  27. v-if="canChangeActivationState || canDeleteAccount"
  28. role="separator"
  29. class="dropdown-divider"
  30. />
  31. </span>
  32. <button
  33. v-if="canChangeActivationState"
  34. class="menu-item dropdown-item menu-item"
  35. @click="toggleActivationStatus()"
  36. >
  37. {{ $t(!!user.deactivated ? 'user_card.admin_menu.activate_account' : 'user_card.admin_menu.deactivate_account') }}
  38. </button>
  39. <button
  40. v-if="canDeleteAccount"
  41. class="menu-item dropdown-item menu-item"
  42. @click="deleteUserDialog(true)"
  43. >
  44. {{ $t('user_card.admin_menu.delete_account') }}
  45. </button>
  46. <div
  47. v-if="canUseTagPolicy"
  48. role="separator"
  49. class="dropdown-divider"
  50. />
  51. <span v-if="canUseTagPolicy">
  52. <button
  53. class="menu-item dropdown-item menu-item"
  54. @click="toggleTag(tags.FORCE_NSFW)"
  55. >
  56. <span
  57. class="input menu-checkbox"
  58. :class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_NSFW) }"
  59. />
  60. {{ $t('user_card.admin_menu.force_nsfw') }}
  61. </button>
  62. <button
  63. class="menu-item dropdown-item menu-item"
  64. @click="toggleTag(tags.STRIP_MEDIA)"
  65. >
  66. <span
  67. class="input menu-checkbox"
  68. :class="{ 'menu-checkbox-checked': hasTag(tags.STRIP_MEDIA) }"
  69. />
  70. {{ $t('user_card.admin_menu.strip_media') }}
  71. </button>
  72. <button
  73. class="menu-item dropdown-item menu-item"
  74. @click="toggleTag(tags.FORCE_UNLISTED)"
  75. >
  76. <span
  77. class="input menu-checkbox"
  78. :class="{ 'menu-checkbox-checked': hasTag(tags.FORCE_UNLISTED) }"
  79. />
  80. {{ $t('user_card.admin_menu.force_unlisted') }}
  81. </button>
  82. <button
  83. class="menu-item dropdown-item menu-item"
  84. @click="toggleTag(tags.SANDBOX)"
  85. >
  86. <span
  87. class="input menu-checkbox"
  88. :class="{ 'menu-checkbox-checked': hasTag(tags.SANDBOX) }"
  89. />
  90. {{ $t('user_card.admin_menu.sandbox') }}
  91. </button>
  92. <button
  93. v-if="user.is_local"
  94. class="menu-item dropdown-item menu-item"
  95. @click="toggleTag(tags.DISABLE_REMOTE_SUBSCRIPTION)"
  96. >
  97. <span
  98. class="input menu-checkbox"
  99. :class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_REMOTE_SUBSCRIPTION) }"
  100. />
  101. {{ $t('user_card.admin_menu.disable_remote_subscription') }}
  102. </button>
  103. <button
  104. v-if="user.is_local"
  105. class="menu-item dropdown-item menu-item"
  106. @click="toggleTag(tags.DISABLE_ANY_SUBSCRIPTION)"
  107. >
  108. <span
  109. class="input menu-checkbox"
  110. :class="{ 'menu-checkbox-checked': hasTag(tags.DISABLE_ANY_SUBSCRIPTION) }"
  111. />
  112. {{ $t('user_card.admin_menu.disable_any_subscription') }}
  113. </button>
  114. <button
  115. v-if="user.is_local"
  116. class="menu-item dropdown-item menu-item"
  117. @click="toggleTag(tags.QUARANTINE)"
  118. >
  119. <span
  120. class="input menu-checkbox"
  121. :class="{ 'menu-checkbox-checked': hasTag(tags.QUARANTINE) }"
  122. />
  123. {{ $t('user_card.admin_menu.quarantine') }}
  124. </button>
  125. </span>
  126. </div>
  127. </template>
  128. <template #trigger>
  129. <button
  130. class="btn button-default btn-block moderation-tools-button"
  131. :class="{ toggled }"
  132. >
  133. {{ $t('user_card.admin_menu.moderation') }}
  134. <FAIcon icon="chevron-down" />
  135. </button>
  136. </template>
  137. </Popover>
  138. <teleport to="#modal">
  139. <DialogModal
  140. v-if="showDeleteUserDialog"
  141. :on-cancel="deleteUserDialog.bind(this, false)"
  142. >
  143. <template #header>
  144. {{ $t('user_card.admin_menu.delete_user') }}
  145. </template>
  146. <p>{{ $t('user_card.admin_menu.delete_user_confirmation') }}</p>
  147. <template #footer>
  148. <button
  149. class="btn button-default"
  150. @click="deleteUserDialog(false)"
  151. >
  152. {{ $t('general.cancel') }}
  153. </button>
  154. <button
  155. class="btn button-default danger"
  156. @click="deleteUser()"
  157. >
  158. {{ $t('user_card.admin_menu.delete_user') }}
  159. </button>
  160. </template>
  161. </DialogModal>
  162. </teleport>
  163. </div>
  164. </template>
  165. <script src="./moderation_tools.js"></script>
  166. <style lang="scss">
  167. .moderation-tools-popover {
  168. height: 100%;
  169. .trigger {
  170. /* stylelint-disable-next-line declaration-no-important */
  171. display: flex !important;
  172. height: 100%;
  173. }
  174. }
  175. .moderation-tools-button {
  176. svg,
  177. i {
  178. font-size: 0.8em;
  179. }
  180. }
  181. </style>