A platform for community discussion. Free, open, simple.
New "user-preferences-tracking-topics" plugin outlet (#30821)
Régis Hanol5c6e96720bb4
diff --git a/app/assets/javascripts/discourse/app/components/user-preferences/topic-tracking.hbs b/app/assets/javascripts/discourse/app/components/user-preferences/topic-tracking.hbsdeleted file mode 100644index 7fcc1ae5a52..00000000000--- a/app/assets/javascripts/discourse/app/components/user-preferences/topic-tracking.hbs+++ /dev/null@@ -1,36 +0,0 @@-<div class="user-preferences_tracking-topics-controls">- <div class="controls controls-dropdown">- <label>{{i18n "user.new_topic_duration.label"}}</label>- <ComboBox- @valueProperty="value"- @content={{@considerNewTopicOptions}}- @value={{@model.user_option.new_topic_duration_minutes}}- @onChange={{fn (mut @model.user_option.new_topic_duration_minutes)}}- class="duration"- />- </div>-- <div class="controls controls-dropdown">- <label>{{i18n "user.auto_track_topics"}}</label>- <ComboBox- @valueProperty="value"- @content={{@autoTrackDurations}}- @value={{@model.user_option.auto_track_topics_after_msecs}}- @onChange={{action- (mut @model.user_option.auto_track_topics_after_msecs)- }}- />- </div>-- <div class="controls controls-dropdown">- <label>{{i18n "user.notification_level_when_replying"}}</label>- <ComboBox- @valueProperty="value"- @content={{@notificationLevelsForReplying}}- @value={{@model.user_option.notification_level_when_replying}}- @onChange={{action- (mut @model.user_option.notification_level_when_replying)- }}- />- </div>-</div>\ No newline at end of filediff --git a/app/assets/javascripts/discourse/app/controllers/preferences/tracking.js b/app/assets/javascripts/discourse/app/controllers/preferences/tracking.jsindex acc176f58e2..1e89a02517e 100644--- a/app/assets/javascripts/discourse/app/controllers/preferences/tracking.js+++ b/app/assets/javascripts/discourse/app/controllers/preferences/tracking.js@@ -10,6 +10,7 @@ export default class extends Controller {@service currentUser;@service siteSettings;@tracked saved = false;+ @tracked customAttrNames = [];likeNotificationFrequencies = [{ name: i18n("user.like_notification_frequency.always"), value: 0 },@@ -53,15 +54,15 @@ export default class extends Controller {notificationLevelsForReplying = [{- name: i18n("topic.notifications.watching.title"),+ name: i18n("user.notification_level_when_replying.watch_topic"),value: NotificationLevels.WATCHING,},{- name: i18n("topic.notifications.tracking.title"),+ name: i18n("user.notification_level_when_replying.track_topic"),value: NotificationLevels.TRACKING,},{- name: i18n("topic.notifications.regular.title"),+ name: i18n("user.notification_level_when_replying.do_nothing"),value: NotificationLevels.REGULAR,},];@@ -154,7 +155,8 @@ export default class extends Controller {@computed("siteSettings.tagging_enabled",- "siteSettings.mute_all_categories_by_default"+ "siteSettings.mute_all_categories_by_default",+ "customAttrNames")get saveAttrNames() {const attrs = [@@ -180,6 +182,10 @@ export default class extends Controller {);}+ if (this.customAttrNames?.length > 0) {+ attrs.push(...this.customAttrNames);+ }+return attrs;}@@ -189,9 +195,7 @@ export default class extends Controller {return this.model.save(this.saveAttrNames)- .then(() => {- this.saved = true;- })+ .then(() => (this.saved = true)).catch(popupAjaxError);}}diff --git a/app/assets/javascripts/discourse/app/templates/preferences/tracking.hbs b/app/assets/javascripts/discourse/app/templates/preferences/tracking.hbsindex 49700bff811..05281b1ea62 100644--- a/app/assets/javascripts/discourse/app/templates/preferences/tracking.hbs+++ b/app/assets/javascripts/discourse/app/templates/preferences/tracking.hbs@@ -39,7 +39,7 @@class="controls controls-dropdown"data-setting-name="user-notification-level-when-replying">- <label>{{i18n "user.notification_level_when_replying"}}</label>+ <label>{{i18n "user.notification_level_when_replying.label"}}</label><ComboBox@valueProperty="value"@content={{this.notificationLevelsForReplying}}@@ -50,6 +50,11 @@/></div>+ <PluginOutlet+ @name="user-preferences-tracking-topics"+ @outletArgs={{hash model=this.model customAttrNames=this.customAttrNames}}+ />+<PreferenceCheckbox@labelKey="user.topics_unread_when_closed"@checked={{this.model.user_option.topics_unread_when_closed}}diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 9858e8e9f22..e689431f115 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -1925,7 +1925,11 @@ en:after_5_minutes: "after 5 minutes"after_10_minutes: "after 10 minutes"- notification_level_when_replying: "When I post in a topic, set that topic to"+ notification_level_when_replying:+ label: "When posting"+ watch_topic: "Watch topic"+ track_topic: "Track topic"+ do_nothing: "Do nothing"topics_unread_when_closed: "Consider topics unread when they are closed"invited: