From 69664d215372b2ee3715ba613776f38dabc4d6bd Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Fri, 12 Aug 2022 15:15:43 +0300 Subject: [PATCH] DEV: Make group message summary notification Link to the group inbox (#17884) This fix is for the experimental user menu. --- .../notification-items/group-message-summary.js | 7 +++++++ .../group-message-summary-test.js | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/app/assets/javascripts/discourse/app/lib/notification-items/group-message-summary.js b/app/assets/javascripts/discourse/app/lib/notification-items/group-message-summary.js index 2c02a414fc7..01c91e0897a 100644 --- a/app/assets/javascripts/discourse/app/lib/notification-items/group-message-summary.js +++ b/app/assets/javascripts/discourse/app/lib/notification-items/group-message-summary.js @@ -1,4 +1,5 @@ import NotificationItemBase from "discourse/lib/notification-items/base"; +import { userPath } from "discourse/lib/url"; import I18n from "I18n"; export default class extends NotificationItemBase { @@ -12,4 +13,10 @@ export default class extends NotificationItemBase { get label() { return null; } + + get linkHref() { + return userPath( + `${this.notification.data.username}/messages/group/${this.notification.data.group_name}` + ); + } } diff --git a/app/assets/javascripts/discourse/tests/unit/lib/notification-items/group-message-summary-test.js b/app/assets/javascripts/discourse/tests/unit/lib/notification-items/group-message-summary-test.js index 64c1053d044..8e662fe0cd4 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/notification-items/group-message-summary-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/notification-items/group-message-summary-test.js @@ -47,5 +47,19 @@ discourseModule( "displays the right content" ); }); + + test("linkHref", function (assert) { + const notification = getNotification(); + const director = createRenderDirector( + notification, + "group_message_summary", + this.siteSettings + ); + assert.strictEqual( + director.linkHref, + "/u/drummers.boss/messages/group/drummers", + "links to the group inbox in the user profile" + ); + }); } );