From ec739099b6f66cb86df89a51e9571c4bfeb3950e Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sun, 4 Oct 2020 22:01:09 +0300 Subject: [PATCH] Add select for managing tags --- src/lang/en.js | 3 +- .../users/components/ModerationDropdown.vue | 128 ++++++++++++++++-- src/views/users/index.vue | 49 +------ 3 files changed, 119 insertions(+), 61 deletions(-) diff --git a/src/lang/en.js b/src/lang/en.js index 3994f384..385811ad 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -283,7 +283,8 @@ export default { confirmEnablingTagPolicy: 'Are you sure you want to add TagPolicy to the list of enabled MRF policies?', enableTagPolicySuccessMessage: 'MRF TagPolicy was enabled', createCustomTag: 'Create custom tag and add it to user', - moderateTags: 'Moderate Tags' + customTags: 'Custom Tags', + defaultTags: 'Default Tags' }, statuses: { statuses: 'Statuses', diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue index 242e4563..a54f47ea 100644 --- a/src/views/users/components/ModerationDropdown.vue +++ b/src/views/users/components/ModerationDropdown.vue @@ -67,8 +67,8 @@ @click.native="handleConfirmationResend(user)"> {{ $t('users.resendConfirmation') }} - - + {{ $t('users.disableMfa') }} + + + + + + + + + + {{ $t('users.enableTagPolicy') }} + @@ -168,7 +213,7 @@ export default { }, data() { return { - tagsOpen: [] + selectedTags: [] } }, computed: { @@ -185,14 +230,48 @@ export default { }) } }, + customTags() { + return this.$store.state.users.tags.filter(tag => !Object.keys(this.mapTags).includes(tag)) + }, + defaultTags() { + return Object.keys(this.mapTags) + .filter(tag => this.$store.state.users.tags.includes(tag)) + .reduce((acc, el) => { + acc[el] = this.mapTags[el] + return acc + }, {}) + }, isDesktop() { return this.$store.state.app.device === 'desktop' }, + mapTags() { + return { + 'mrf_tag:media-force-nsfw': 'NSFW', + 'mrf_tag:media-strip': 'Strip Media', + 'mrf_tag:force-unlisted': 'Unlisted', + 'mrf_tag:sandbox': 'Sandbox', + 'mrf_tag:verified': 'Verified', + 'mrf_tag:disable-remote-subscription': 'Disable remote subscription', + 'mrf_tag:disable-any-subscription': 'Disable any subscription' + } + }, tagPolicyEnabled() { return this.$store.state.users.mrfPolicies.includes('Pleroma.Web.ActivityPub.MRF.TagPolicy') } }, methods: { + addCustomTag() { + this.$store.dispatch('AddTag', { + users: [this.customTagUser], + tag: this.customTagForm.name, + _userId: this.customTagUser.id, + _statusId: this.statusId + }) + this.createCustomTagDialogOpen = false + }, + closeCustomTagDialog() { + this.createCustomTagDialogOpen = false + }, disableMfa(nickname) { this.$store.dispatch('DisableMfa', nickname) }, @@ -295,6 +374,17 @@ export default {