From 334a2f216f0c365d97bd3d390ca89f195aea9323 Mon Sep 17 00:00:00 2001 From: Blake Erickson Date: Thu, 11 Apr 2024 15:54:28 -0600 Subject: [PATCH] FEATURE: User Notifications Links Page (#26609) --- .../app/lib/notification-types/linked-consolidated.js | 5 +++-- .../javascripts/discourse/app/models/user-action.js | 1 + .../javascripts/discourse/app/routes/app-route-map.js | 1 + .../discourse/app/routes/user-notifications-links.js | 11 +++++++++++ .../discourse/app/templates/user/notifications.hbs | 9 +++++++++ .../notification-types/linked-consolidated-test.js | 2 +- app/models/user_action.rb | 3 +++ app/services/user_action_manager.rb | 2 ++ config/locales/client.en.yml | 1 + 9 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/routes/user-notifications-links.js diff --git a/app/assets/javascripts/discourse/app/lib/notification-types/linked-consolidated.js b/app/assets/javascripts/discourse/app/lib/notification-types/linked-consolidated.js index bfe4a896108..9ea8fcf43ce 100644 --- a/app/assets/javascripts/discourse/app/lib/notification-types/linked-consolidated.js +++ b/app/assets/javascripts/discourse/app/lib/notification-types/linked-consolidated.js @@ -4,8 +4,9 @@ import I18n from "discourse-i18n"; export default class extends NotificationTypeBase { get linkHref() { - // Linking here for now until we have a proper new page for "linked" in the profile - return userPath(`${this.currentUser.username}/notifications`); + return userPath( + `${this.currentUser.username}/notifications/links?acting_username=${this.notification.data.username}` + ); } get description() { diff --git a/app/assets/javascripts/discourse/app/models/user-action.js b/app/assets/javascripts/discourse/app/models/user-action.js index aa194418313..4891b3bc812 100644 --- a/app/assets/javascripts/discourse/app/models/user-action.js +++ b/app/assets/javascripts/discourse/app/models/user-action.js @@ -19,6 +19,7 @@ const UserActionTypes = { edits: 11, messages_sent: 12, messages_received: 13, + links: 17, }; const InvertedActionTypes = {}; diff --git a/app/assets/javascripts/discourse/app/routes/app-route-map.js b/app/assets/javascripts/discourse/app/routes/app-route-map.js index 727026cade5..226aed8d478 100644 --- a/app/assets/javascripts/discourse/app/routes/app-route-map.js +++ b/app/assets/javascripts/discourse/app/routes/app-route-map.js @@ -140,6 +140,7 @@ export default function () { this.route("likesReceived", { path: "likes-received" }); this.route("mentions"); this.route("edits"); + this.route("links"); } ); diff --git a/app/assets/javascripts/discourse/app/routes/user-notifications-links.js b/app/assets/javascripts/discourse/app/routes/user-notifications-links.js new file mode 100644 index 00000000000..16940719640 --- /dev/null +++ b/app/assets/javascripts/discourse/app/routes/user-notifications-links.js @@ -0,0 +1,11 @@ +import UserAction from "discourse/models/user-action"; +import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; +import I18n from "discourse-i18n"; + +export default UserActivityStreamRoute.extend({ + userActionType: UserAction.TYPES["links"], + + titleToken() { + return I18n.t("user_action_groups.17"); + }, +}); diff --git a/app/assets/javascripts/discourse/app/templates/user/notifications.hbs b/app/assets/javascripts/discourse/app/templates/user/notifications.hbs index 0ecd1a5a7d0..6df0e7e85a6 100644 --- a/app/assets/javascripts/discourse/app/templates/user/notifications.hbs +++ b/app/assets/javascripts/discourse/app/templates/user/notifications.hbs @@ -53,6 +53,15 @@ {{i18n "user_action_groups.11"}} + + {{d-icon "link"}} + {{i18n "user_action_groups.17"}} + +