From 6450bc43317f090be32894d0b79a6aaa8229666b Mon Sep 17 00:00:00 2001
From: samdbeckham <sbeckham@gitlab.com>
Date: Fri, 8 Feb 2019 16:35:06 +0000
Subject: [PATCH] Rewords 'revert dismissal' on the GSD

Where GSD is the group security dashboard

Renames:
- the button text
- the tooltip text
- the test names
- the action and mutation names

It also updates the locale file for the newer wording.
---
 .../security_dashboard/components/app.vue     |  4 +--
 .../vulnerability_action_buttons.vue          | 12 ++++-----
 .../store/modules/vulnerabilities/actions.js  | 14 +++++-----
 .../security_reports/components/modal.vue     |  2 +-
 ...he-more-info-modal-for-vulnerabilities.yml |  5 ++++
 .../vulnerability_action_buttons_spec.js      |  4 +--
 .../store/vulnerabilities/actions_spec.js     | 26 +++++++++----------
 .../security_reports/components/modal_spec.js |  8 +++---
 locale/gitlab.pot                             |  6 ++---
 9 files changed, 42 insertions(+), 39 deletions(-)
 create mode 100644 ee/changelogs/unreleased/9270-relabel-dismiss-button-in-the-more-info-modal-for-vulnerabilities.yml

diff --git a/ee/app/assets/javascripts/security_dashboard/components/app.vue b/ee/app/assets/javascripts/security_dashboard/components/app.vue
index 4feb6e70c16..8228190abf4 100644
--- a/ee/app/assets/javascripts/security_dashboard/components/app.vue
+++ b/ee/app/assets/javascripts/security_dashboard/components/app.vue
@@ -76,7 +76,7 @@ export default {
       'fetchVulnerabilities',
       'fetchVulnerabilitiesCount',
       'fetchVulnerabilitiesHistory',
-      'revertDismissal',
+      'undoDismiss',
       'setVulnerabilitiesCountEndpoint',
       'setVulnerabilitiesEndpoint',
       'setVulnerabilitiesHistoryEndpoint',
@@ -104,7 +104,7 @@ export default {
       :can-create-feedback-permission="canCreateFeedbackPermission"
       @createNewIssue="createIssue({ vulnerability: modal.vulnerability })"
       @dismissIssue="dismissVulnerability({ vulnerability: modal.vulnerability })"
-      @revertDismissIssue="revertDismissal({ vulnerability: modal.vulnerability })"
+      @revertDismissIssue="undoDismiss({ vulnerability: modal.vulnerability })"
     />
   </div>
 </template>
diff --git a/ee/app/assets/javascripts/security_dashboard/components/vulnerability_action_buttons.vue b/ee/app/assets/javascripts/security_dashboard/components/vulnerability_action_buttons.vue
index 67d8da3854f..c70f710b7eb 100644
--- a/ee/app/assets/javascripts/security_dashboard/components/vulnerability_action_buttons.vue
+++ b/ee/app/assets/javascripts/security_dashboard/components/vulnerability_action_buttons.vue
@@ -42,7 +42,7 @@ export default {
       'openModal',
       'createIssue',
       'dismissVulnerability',
-      'revertDismissal',
+      'undoDismiss',
     ]),
     handleCreateIssue() {
       const { vulnerability } = this;
@@ -52,9 +52,9 @@ export default {
       const { vulnerability } = this;
       this.dismissVulnerability({ vulnerability, flashError: true });
     },
-    handleRevertDismissal() {
+    handleUndoDismiss() {
       const { vulnerability } = this;
-      this.revertDismissal({ vulnerability, flashError: true });
+      this.undoDismiss({ vulnerability, flashError: true });
     },
   },
 };
@@ -89,14 +89,14 @@ export default {
     <template v-if="canDismissVulnerability">
       <loading-button
         v-if="isDismissed"
-        key="revert-dismissal"
+        key="undo-dismiss"
         v-gl-tooltip
         :aria-label="s__('Security Reports|Undo dismiss')"
         :loading="isDismissingVulnerability"
         :title="s__('Security Reports|Undo dismiss')"
-        container-class="btn btn-inverted btn-warning btn-border-color js-revert-dismissal"
+        container-class="btn btn-inverted btn-warning btn-border-color js-undo-dismiss"
         type="button"
-        @click="handleRevertDismissal"
+        @click="handleUndoDismiss"
       >
         <icon name="repeat" />
       </loading-button>
diff --git a/ee/app/assets/javascripts/security_dashboard/store/modules/vulnerabilities/actions.js b/ee/app/assets/javascripts/security_dashboard/store/modules/vulnerabilities/actions.js
index 05d056063e6..ace37d6fc12 100644
--- a/ee/app/assets/javascripts/security_dashboard/store/modules/vulnerabilities/actions.js
+++ b/ee/app/assets/javascripts/security_dashboard/store/modules/vulnerabilities/actions.js
@@ -172,33 +172,33 @@ export const receiveDismissVulnerabilityError = ({ commit }, { flashError }) =>
   }
 };
 
-export const revertDismissal = ({ dispatch }, { vulnerability, flashError }) => {
+export const undoDismiss = ({ dispatch }, { vulnerability, flashError }) => {
   const { vulnerability_feedback_dismissal_path, dismissal_feedback } = vulnerability;
   // eslint-disable-next-line camelcase
   const url = `${vulnerability_feedback_dismissal_path}/${dismissal_feedback.id}`;
 
-  dispatch('requestRevertDismissal');
+  dispatch('requestUndoDismiss');
 
   axios
     .delete(url)
     .then(() => {
       const { id } = vulnerability;
-      dispatch('receiveRevertDismissalSuccess', { id });
+      dispatch('receiveUndoDismissSuccess', { id });
     })
     .catch(() => {
-      dispatch('receiveRevertDismissalError', { flashError });
+      dispatch('receiveUndoDismissError', { flashError });
     });
 };
 
-export const requestRevertDismissal = ({ commit }) => {
+export const requestUndoDismiss = ({ commit }) => {
   commit(types.REQUEST_REVERT_DISMISSAL);
 };
 
-export const receiveRevertDismissalSuccess = ({ commit }, payload) => {
+export const receiveUndoDismissSuccess = ({ commit }, payload) => {
   commit(types.RECEIVE_REVERT_DISMISSAL_SUCCESS, payload);
 };
 
-export const receiveRevertDismissalError = ({ commit }, { flashError }) => {
+export const receiveUndoDismissError = ({ commit }, { flashError }) => {
   commit(types.RECEIVE_REVERT_DISMISSAL_ERROR);
   if (flashError) {
     createFlash(
diff --git a/ee/app/assets/javascripts/vue_shared/security_reports/components/modal.vue b/ee/app/assets/javascripts/vue_shared/security_reports/components/modal.vue
index 489da6aed3b..11aa3d728ea 100644
--- a/ee/app/assets/javascripts/vue_shared/security_reports/components/modal.vue
+++ b/ee/app/assets/javascripts/vue_shared/security_reports/components/modal.vue
@@ -40,7 +40,7 @@ export default {
   computed: {
     revertTitle() {
       return this.modal.vulnerability.isDismissed
-        ? s__('ciReport|Revert dismissal')
+        ? s__('ciReport|Undo dismiss')
         : s__('ciReport|Dismiss vulnerability');
     },
     hasDismissedBy() {
diff --git a/ee/changelogs/unreleased/9270-relabel-dismiss-button-in-the-more-info-modal-for-vulnerabilities.yml b/ee/changelogs/unreleased/9270-relabel-dismiss-button-in-the-more-info-modal-for-vulnerabilities.yml
new file mode 100644
index 00000000000..f9af920420b
--- /dev/null
+++ b/ee/changelogs/unreleased/9270-relabel-dismiss-button-in-the-more-info-modal-for-vulnerabilities.yml
@@ -0,0 +1,5 @@
+---
+title: Renames 'revert dismissal' to 'undo dismiss' on the Group security dashboard
+merge_request: 9500
+author:
+type: other
diff --git a/ee/spec/javascripts/security_dashboard/components/vulnerability_action_buttons_spec.js b/ee/spec/javascripts/security_dashboard/components/vulnerability_action_buttons_spec.js
index ee361f9b944..dd9319a557f 100644
--- a/ee/spec/javascripts/security_dashboard/components/vulnerability_action_buttons_spec.js
+++ b/ee/spec/javascripts/security_dashboard/components/vulnerability_action_buttons_spec.js
@@ -146,8 +146,8 @@ describe('Security Dashboard Action Buttons', () => {
       expect(vm.$el.querySelector('.js-dismiss-vulnerability')).toBeNull();
     });
 
-    it('should render the revert dismissal button', () => {
-      expect(vm.$el.querySelector('.js-revert-dismissal')).not.toBeNull();
+    it('should render the undo dismiss button', () => {
+      expect(vm.$el.querySelector('.js-undo-dismiss')).not.toBeNull();
     });
   });
 });
diff --git a/ee/spec/javascripts/security_dashboard/store/vulnerabilities/actions_spec.js b/ee/spec/javascripts/security_dashboard/store/vulnerabilities/actions_spec.js
index 3a15eb4871f..1f60403e08e 100644
--- a/ee/spec/javascripts/security_dashboard/store/vulnerabilities/actions_spec.js
+++ b/ee/spec/javascripts/security_dashboard/store/vulnerabilities/actions_spec.js
@@ -572,7 +572,7 @@ describe('vulnerability dismissal', () => {
 });
 
 describe('revert vulnerability dismissal', () => {
-  describe('revertDismissal', () => {
+  describe('undoDismiss', () => {
     const vulnerability = mockDataVulnerabilities[2];
     const url = `${vulnerability.vulnerability_feedback_dismissal_path}/${
       vulnerability.dismissal_feedback.id
@@ -594,13 +594,13 @@ describe('revert vulnerability dismissal', () => {
 
       it('should dispatch the request and success actions', done => {
         testAction(
-          actions.revertDismissal,
+          actions.undoDismiss,
           { vulnerability },
           {},
           [],
           [
-            { type: 'requestRevertDismissal' },
-            { type: 'receiveRevertDismissalSuccess', payload: { id: vulnerability.id } },
+            { type: 'requestUndoDismiss' },
+            { type: 'receiveUndoDismissSuccess', payload: { id: vulnerability.id } },
           ],
           done,
         );
@@ -616,13 +616,13 @@ describe('revert vulnerability dismissal', () => {
         const flashError = false;
 
         testAction(
-          actions.revertDismissal,
+          actions.undoDismiss,
           { vulnerability, flashError },
           {},
           [],
           [
-            { type: 'requestRevertDismissal' },
-            { type: 'receiveRevertDismissalError', payload: { flashError: false } },
+            { type: 'requestUndoDismiss' },
+            { type: 'receiveUndoDismissError', payload: { flashError: false } },
           ],
           done,
         );
@@ -630,13 +630,13 @@ describe('revert vulnerability dismissal', () => {
     });
   });
 
-  describe('receiveRevertDismissalSuccess', () => {
+  describe('receiveUndoDismissSuccess', () => {
     it('should commit the success mutation', done => {
       const state = initialState;
       const data = mockDataVulnerabilities[0];
 
       testAction(
-        actions.receiveRevertDismissalSuccess,
+        actions.receiveUndoDismissSuccess,
         { data },
         state,
         [
@@ -651,12 +651,12 @@ describe('revert vulnerability dismissal', () => {
     });
   });
 
-  describe('receiveRevertDismissalError', () => {
+  describe('receiveUndoDismissError', () => {
     it('should commit the error mutation', done => {
       const state = initialState;
 
       testAction(
-        actions.receiveRevertDismissalError,
+        actions.receiveUndoDismissError,
         {},
         state,
         [{ type: types.RECEIVE_REVERT_DISMISSAL_ERROR }],
@@ -666,12 +666,12 @@ describe('revert vulnerability dismissal', () => {
     });
   });
 
-  describe('requestRevertDismissal', () => {
+  describe('requestUndoDismiss', () => {
     it('should commit the request mutation', done => {
       const state = initialState;
 
       testAction(
-        actions.requestRevertDismissal,
+        actions.requestUndoDismiss,
         {},
         state,
         [{ type: types.REQUEST_REVERT_DISMISSAL }],
diff --git a/ee/spec/javascripts/vue_shared/security_reports/components/modal_spec.js b/ee/spec/javascripts/vue_shared/security_reports/components/modal_spec.js
index f7f7e4587d2..68819aa4669 100644
--- a/ee/spec/javascripts/vue_shared/security_reports/components/modal_spec.js
+++ b/ee/spec/javascripts/vue_shared/security_reports/components/modal_spec.js
@@ -33,13 +33,11 @@ describe('Security Reports modal', () => {
         expect(vm.$el.textContent.trim()).toContain('#123');
       });
 
-      it('renders button to revert dismissal', () => {
-        expect(vm.$el.querySelector('.js-dismiss-btn').textContent.trim()).toEqual(
-          'Revert dismissal',
-        );
+      it('renders button to undo dismiss', () => {
+        expect(vm.$el.querySelector('.js-dismiss-btn').textContent.trim()).toEqual('Undo dismiss');
       });
 
-      it('emits revertDismissIssue when revert dismissal button is clicked', () => {
+      it('emits revertDismissIssue when undo dismiss button is clicked', () => {
         spyOn(vm, '$emit');
 
         const button = vm.$el.querySelector('.js-dismiss-btn');
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 081b882fd47..3c6295d8f55 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -11189,9 +11189,6 @@ msgstr ""
 msgid "ciReport|Performance metrics"
 msgstr ""
 
-msgid "ciReport|Revert dismissal"
-msgstr ""
-
 msgid "ciReport|SAST"
 msgstr ""
 
@@ -11231,6 +11228,9 @@ msgstr ""
 msgid "ciReport|There was an error reverting the dismissal. Please try again."
 msgstr ""
 
+msgid "ciReport|Undo dismiss"
+msgstr ""
+
 msgid "ciReport|Upgrade %{name} from %{version} to %{fixed}."
 msgstr ""
 
-- 
2.30.9