Repository: mozilla/pontoon

Issue:
Tooltip on rejected string authors says "Not reviewed yet"
Instead, it should say "Approved by {user}", same as it does for approved strings.


Discussion:
The same is the case for "Imported" strings that are approved.

Resolving patch:
diff --git a/pontoon/base/views.py b/pontoon/base/views.py
--- a/pontoon/base/views.py
+++ b/pontoon/base/views.py
@@ -427,7 +427,7 @@ def get_translation_history(request):
                 "date": t.date.strftime("%b %d, %Y %H:%M"),
                 "date_iso": t.date.isoformat(),
                 "approved_user": User.display_name_or_blank(t.approved_user),
-                "unapproved_user": User.display_name_or_blank(t.unapproved_user),
+                "rejected_user": User.display_name_or_blank(t.rejected_user),
                 "comments": [c.serialize() for c in t.comments.order_by("timestamp")],
                 "machinery_sources": t.machinery_sources_values,
             }


Test patch:
diff --git a/translate/src/modules/history/components/HistoryTranslation.test.js b/translate/src/modules/history/components/HistoryTranslation.test.js
--- a/translate/src/modules/history/components/HistoryTranslation.test.js
+++ b/translate/src/modules/history/components/HistoryTranslation.test.js
@@ -29,7 +29,7 @@ describe('<HistoryTranslationComponent>', () => {
     rejected: false,
     string: 'The storm approaches. We speak no more.',
     uid: 0,
-    unapprovedUser: '',
+    rejectedUser: '',
     user: '',
     username: 'michel',
     comments: [],
@@ -121,8 +121,8 @@ describe('<HistoryTranslationComponent>', () => {
     });
   });
 
-  describe('getApprovalTitle', () => {
-    it('returns the correct approver title when approved', () => {
+  describe('getReviewTitle', () => {
+    it('returns the correct review title when approved and approved user is available', () => {
       const translation = {
         ...DEFAULT_TRANSLATION,
         ...{ approved: true, approvedUser: 'Cespenar' },
@@ -138,10 +138,42 @@ describe('<HistoryTranslationComponent>', () => {
       expect(wrapper.find('[title="Approved by Cespenar"]')).toHaveLength(2);
     });
 
-    it('returns the correct approver title when unapproved', () => {
+    it('returns the correct review title when approved and approved user is not available', () => {
       const translation = {
         ...DEFAULT_TRANSLATION,
-        ...{ unapprovedUser: 'Bhaal' },
+        ...{ approved: true },
+      };
+      const wrapper = shallow(
+        <HistoryTranslationBase
+          translation={translation}
+          entity={DEFAULT_ENTITY}
+          user={DEFAULT_USER}
+        />,
+      );
+
+      expect(wrapper.find('[title="Approved"]')).toHaveLength(3);
+    });
+
+    it('returns the correct review title when rejected and rejected user is available', () => {
+      const translation = {
+        ...DEFAULT_TRANSLATION,
+        ...{ rejected: true, rejectedUser: 'Bhaal' },
+      };
+      const wrapper = shallow(
+        <HistoryTranslationBase
+          translation={translation}
+          entity={DEFAULT_ENTITY}
+          user={DEFAULT_USER}
+        />,
+      );
+
+      expect(wrapper.find('[title="Rejected by Bhaal"]')).toHaveLength(2);
+    });
+
+    it('returns the correct review title when rejected and rejected user is not available', () => {
+      const translation = {
+        ...DEFAULT_TRANSLATION,
+        ...{ rejected: true },
       };
       const wrapper = shallow(
         <HistoryTranslationBase
@@ -151,10 +183,10 @@ describe('<HistoryTranslationComponent>', () => {
         />,
       );
 
-      expect(wrapper.find('[title="Unapproved by Bhaal"]')).toHaveLength(2);
+      expect(wrapper.find('[title="Rejected"]')).toHaveLength(2);
     });
 
-    it('returns the correct approver title when neither approved or unapproved', () => {
+    it('returns the correct approver title when neither approved or rejected', () => {
       const wrapper = shallow(
         <HistoryTranslationBase
           translation={DEFAULT_TRANSLATION}