From 40e402c780aab96bec8904eec50968eb0d66dde5 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Sat, 7 Nov 2020 02:42:18 +0300 Subject: [PATCH] Move tag moderation to a separate column in users table --- .../users/components/ModerationDropdown.vue | 119 ---------------- src/views/users/index.vue | 133 ++++++++++++++++-- 2 files changed, 121 insertions(+), 131 deletions(-) diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue index 450c8391..0cd1fea0 100644 --- a/src/views/users/components/ModerationDropdown.vue +++ b/src/views/users/components/ModerationDropdown.vue @@ -83,49 +83,6 @@ @click.native="disableMfa(user.nickname)"> {{ $t('users.disableMfa') }} - - {{ $t('users.tags') }}: - - - - - {{ option.label }} - - - - - {{ option.label }} - - - - - {{ $t('users.enableTagPolicy') }} - @@ -163,78 +120,14 @@ export default { }) } }, - customTags() { - return this.$store.state.users.tags - .filter(tag => !Object.keys(this.mapTags).includes(tag)) - .map(tag => { - return { tag, label: tag.charAt(0).toUpperCase() + tag.slice(1) } - }) - }, - defaultTags() { - const tagsByType = this.user.local ? Object.keys(this.mapTags) : Object.keys(this.mapRemoteTags) - return tagsByType.filter(tag => this.$store.state.users.tags.includes(tag)) - .map(tag => { - if (this.user.local) { - return { tag, label: this.mapTags[tag] } - } else { - return { tag, label: this.mapRemoteTags[tag] } - } - }, {}) - }, isDesktop() { return this.$store.state.app.device === 'desktop' - }, - mapRemoteTags() { - 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' - } - }, - 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' - } - }, - selectedTags() { - return this.user.tags - }, - tagPolicyEnabled() { - return this.$store.state.users.mrfPolicies.includes('Pleroma.Web.ActivityPub.MRF.TagPolicy') } }, methods: { disableMfa(nickname) { this.$store.dispatch('DisableMfa', nickname) }, - enableTagPolicy() { - this.$confirm( - this.$t('users.confirmEnablingTagPolicy'), - { - confirmButtonText: 'Yes', - cancelButtonText: 'Cancel', - type: 'warning' - }).then(() => { - this.$message({ - type: 'success', - message: this.$t('users.enableTagPolicySuccessMessage') - }) - this.$store.dispatch('EnableTagPolicy') - }).catch(() => { - this.$message({ - type: 'info', - message: 'Canceled' - }) - }) - }, getPasswordResetToken(nickname) { this.$emit('open-reset-token-dialog') this.$store.dispatch('GetPasswordResetToken', nickname) @@ -299,11 +192,6 @@ export default { ? this.$store.dispatch('ActivateUsers', { users: [user], _userId: user.id }) : this.$store.dispatch('DeactivateUsers', { users: [user], _userId: user.id }) }, - toggleTag(tags, user) { - tags.length > user.tags.length - ? this.$store.dispatch('AddTag', { users: [user], tag: tags.filter(tag => !user.tags.includes(tag))[0] }) - : this.$store.dispatch('RemoveTag', { users: [user], tag: user.tags.filter(tag => !tags.includes(tag))[0] }) - }, toggleUserRight(user, right) { user.roles[right] ? this.$store.dispatch('DeleteRight', { users: [user], right, _userId: user.id, _statusId: this.statusId }) @@ -314,9 +202,6 @@ export default {