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 (7036B)


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