From 58ba64b87a684d593603304f3afad7b5a131b4fa Mon Sep 17 00:00:00 2001
From: Angelina Filippova <linakirsanova@gmail.com>
Date: Fri, 28 Aug 2020 02:01:58 +0300
Subject: [PATCH] Add confirmation message for enabling MRF policies from
 moderation dropdown

---
 src/lang/en.js                                    |  3 ++-
 src/views/users/components/ModerationDropdown.vue | 15 ++++++++++++++-
 src/views/users/components/MultipleUsersMenu.vue  | 15 ++++++++++++++-
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/lang/en.js b/src/lang/en.js
index 2d21abe1..41b81cf8 100644
--- a/src/lang/en.js
+++ b/src/lang/en.js
@@ -274,7 +274,8 @@ export default {
     registrationReason: 'Registration Reason',
     service: 'Service',
     person: 'Person',
-    enableTagPolicy: 'Enable MRF TagPolicy to manage user tags'
+    enableTagPolicy: 'Enable MRF TagPolicy to manage user tags',
+    confirmEnablingTagPolicy: 'Are you sure you want to add TagPolicy to the list of enabled MRF policies?'
   },
   statuses: {
     statuses: 'Statuses',
diff --git a/src/views/users/components/ModerationDropdown.vue b/src/views/users/components/ModerationDropdown.vue
index 9df5e703..28156fc8 100644
--- a/src/views/users/components/ModerationDropdown.vue
+++ b/src/views/users/components/ModerationDropdown.vue
@@ -182,7 +182,20 @@ export default {
       this.$store.dispatch('DisableMfa', nickname)
     },
     enableTagPolicy() {
-      this.$store.dispatch('EnableTagPolicy')
+      this.$confirm(
+        this.$t('users.confirmEnablingTagPolicy'),
+        {
+          confirmButtonText: 'Yes',
+          cancelButtonText: 'Cancel',
+          type: 'warning'
+        }).then(() => {
+        this.$store.dispatch('EnableTagPolicy')
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: 'Canceled'
+        })
+      })
     },
     getPasswordResetToken(nickname) {
       this.$emit('open-reset-token-dialog')
diff --git a/src/views/users/components/MultipleUsersMenu.vue b/src/views/users/components/MultipleUsersMenu.vue
index 276faa67..eb9f4826 100644
--- a/src/views/users/components/MultipleUsersMenu.vue
+++ b/src/views/users/components/MultipleUsersMenu.vue
@@ -258,7 +258,20 @@ export default {
       }
     },
     enableTagPolicy() {
-      this.$store.dispatch('EnableTagPolicy')
+      this.$confirm(
+        this.$t('users.confirmEnablingTagPolicy'),
+        {
+          confirmButtonText: 'Yes',
+          cancelButtonText: 'Cancel',
+          type: 'warning'
+        }).then(() => {
+        this.$store.dispatch('EnableTagPolicy')
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: 'Canceled'
+        })
+      })
     },
     isLocalUser(user) {
       return user.nickname && user.local
-- 
GitLab