Skip to content

Commit

Permalink
DEV: Update topic-notifications-button mod (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Oct 21, 2024
1 parent 6472f45 commit 0d1045e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
< 3.4.0.beta3-dev: 6472f4593e1a4abbb457288db012ddb10f0b16f5
< 3.4.0.beta1-dev: fe725251c1b248c349c38c96432e892c668822c6
< 3.3.0.beta2-dev: b796ae3fcc89b48cf777de5ee3a4c21aada9271e
< 3.3.0.beta1-dev: 56b0de3896361b6a87523537c8f5b450d2fe0807
Expand Down
32 changes: 15 additions & 17 deletions assets/javascripts/discourse/initializers/extend-for-assigns.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,25 +407,23 @@ function initialize(api) {
},
});

api.modifyClass("component:topic-notifications-button", {
pluginId: PLUGIN_ID,
api.modifyClass(
"component:topic-notifications-button",
(Superclass) =>
class extends Superclass {
get reasonText() {
if (
this.currentUser.never_auto_track_topics &&
this.args.topic.get("assigned_to_user.username") ===
this.currentUser.username
) {
return I18n.t("notification_reason.user");
}

@discourseComputed(
"topic",
"topic.details.{notification_level,notifications_reason_id}"
)
notificationReasonText(topic) {
if (
this.currentUser.never_auto_track_topics &&
topic.assigned_to_user &&
topic.assigned_to_user.username === this.currentUser.username
) {
return I18n.t("notification_reason.user");
return super.reasonText(...arguments);
}
}

return this._super(...arguments);
},
});
);

api.addPostSmallActionIcon("assigned", "user-plus");
api.addPostSmallActionIcon("assigned_to_post", "user-plus");
Expand Down

0 comments on commit 0d1045e

Please sign in to comment.