Changes after feedback from Sam

Changes after feedback from Sam

diff --git a/assets/javascripts/discourse/widgets/code-review-commit-approved-notification-item.js.es6 b/assets/javascripts/discourse/widgets/code-review-commit-approved-notification-item.js.es6
index 70233c8..edbc380 100644
--- a/assets/javascripts/discourse/widgets/code-review-commit-approved-notification-item.js.es6
+++ b/assets/javascripts/discourse/widgets/code-review-commit-approved-notification-item.js.es6
@@ -1,6 +1,8 @@
 import { createWidgetFrom } from "discourse/widgets/widget";
 import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
 import { replaceIcon } from "discourse-common/lib/icon-library";
+import { postUrl } from "discourse/lib/utilities";
+import { userPath } from "discourse/lib/url";
 
 replaceIcon("notification.code_review_commit_approved", "check");
 
@@ -13,15 +15,27 @@ createWidgetFrom(
     },
 
     text(notificationName, data) {
-      const num_approved_commits = data.num_approved_commits;
+      const numApprovedCommits = data.num_approved_commits;
 
-      if (num_approved_commits === 1) {
-        return I18n.t("notifications.code_review.commit_approved.one");
+      if (numApprovedCommits === 1) {
+        return I18n.t("notifications.code_review.commit_approved.one", {
+          topicTitle: this.attrs.fancy_title
+        });
       } else {
         return I18n.t("notifications.code_review.commit_approved.many", {
-          num_approved_commits
+          numApprovedCommits
         });
       }
+    },
+
+    url() {
+      const topicId = this.attrs.topic_id;
+
+      if (topicId) {
+        return postUrl(this.attrs.slug, topicId, 1);
+      } else {
+        return userPath(`${this.currentUser.username}/activity/approval-given`);
+      }
     }
   }
 );
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 4d1d993..02047b9 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -7,8 +7,8 @@ en:
     notifications:
       code_review:
         commit_approved:
-          one: "Your commit was approved"
-          many: "{{num_approved_commits}} of your commits were approved"
+          one: "\"{{topicTitle}}\" approved"
+          many: "{{numApprovedCommits}} commits were approved"
           title: "commit approved"
     code_review:
       approve:

GitHub sha: 1878f072

1 Like

This commit tries to make the notifications more useful and fixes a styling issue in the large notifications list.

  • For one approved commit, the notification now includes the title,
  • For multiple approved commits, the notification now links to the approved commits user page,