mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
New "user-preferences-tracking-topics" plugin outlet (#30821)
Adds the "user-preferences-tracking-topics" plugin outlet to allow the `discourse-assign` plugin to add a new "notification level when assigned" user preference. There's also a new `customAttrNames` tracked property that allows plugins to add new user option to be saved from this screen / plugin outlet. Also changed the text used for the "notification level when replying" to match the one that is used for the "notification level when assigned" in https://github.com/discourse/discourse-assign/pull/626. ## BEFORE <img width="375" alt="image" src="https://github.com/user-attachments/assets/178ba47e-f783-46d2-adae-28afec49b259" /> ## AFTER <img width="363" alt="Screenshot 2025-01-16 at 16 11 26" src="https://github.com/user-attachments/assets/215e9f86-62f7-48ea-b665-72cbf28abd21" /> DEV: remove unused topic-tracking component
This commit is contained in:
parent
892d02fda1
commit
5c6e96720b
@ -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>
|
|
@ -10,6 +10,7 @@ export default class extends Controller {
|
|||||||
@service currentUser;
|
@service currentUser;
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
@tracked saved = false;
|
@tracked saved = false;
|
||||||
|
@tracked customAttrNames = [];
|
||||||
|
|
||||||
likeNotificationFrequencies = [
|
likeNotificationFrequencies = [
|
||||||
{ name: i18n("user.like_notification_frequency.always"), value: 0 },
|
{ name: i18n("user.like_notification_frequency.always"), value: 0 },
|
||||||
@ -53,15 +54,15 @@ export default class extends Controller {
|
|||||||
|
|
||||||
notificationLevelsForReplying = [
|
notificationLevelsForReplying = [
|
||||||
{
|
{
|
||||||
name: i18n("topic.notifications.watching.title"),
|
name: i18n("user.notification_level_when_replying.watch_topic"),
|
||||||
value: NotificationLevels.WATCHING,
|
value: NotificationLevels.WATCHING,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: i18n("topic.notifications.tracking.title"),
|
name: i18n("user.notification_level_when_replying.track_topic"),
|
||||||
value: NotificationLevels.TRACKING,
|
value: NotificationLevels.TRACKING,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: i18n("topic.notifications.regular.title"),
|
name: i18n("user.notification_level_when_replying.do_nothing"),
|
||||||
value: NotificationLevels.REGULAR,
|
value: NotificationLevels.REGULAR,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -154,7 +155,8 @@ export default class extends Controller {
|
|||||||
|
|
||||||
@computed(
|
@computed(
|
||||||
"siteSettings.tagging_enabled",
|
"siteSettings.tagging_enabled",
|
||||||
"siteSettings.mute_all_categories_by_default"
|
"siteSettings.mute_all_categories_by_default",
|
||||||
|
"customAttrNames"
|
||||||
)
|
)
|
||||||
get saveAttrNames() {
|
get saveAttrNames() {
|
||||||
const attrs = [
|
const attrs = [
|
||||||
@ -180,6 +182,10 @@ export default class extends Controller {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.customAttrNames?.length > 0) {
|
||||||
|
attrs.push(...this.customAttrNames);
|
||||||
|
}
|
||||||
|
|
||||||
return attrs;
|
return attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,9 +195,7 @@ export default class extends Controller {
|
|||||||
|
|
||||||
return this.model
|
return this.model
|
||||||
.save(this.saveAttrNames)
|
.save(this.saveAttrNames)
|
||||||
.then(() => {
|
.then(() => (this.saved = true))
|
||||||
this.saved = true;
|
|
||||||
})
|
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
class="controls controls-dropdown"
|
class="controls controls-dropdown"
|
||||||
data-setting-name="user-notification-level-when-replying"
|
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
|
<ComboBox
|
||||||
@valueProperty="value"
|
@valueProperty="value"
|
||||||
@content={{this.notificationLevelsForReplying}}
|
@content={{this.notificationLevelsForReplying}}
|
||||||
@ -50,6 +50,11 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<PluginOutlet
|
||||||
|
@name="user-preferences-tracking-topics"
|
||||||
|
@outletArgs={{hash model=this.model customAttrNames=this.customAttrNames}}
|
||||||
|
/>
|
||||||
|
|
||||||
<PreferenceCheckbox
|
<PreferenceCheckbox
|
||||||
@labelKey="user.topics_unread_when_closed"
|
@labelKey="user.topics_unread_when_closed"
|
||||||
@checked={{this.model.user_option.topics_unread_when_closed}}
|
@checked={{this.model.user_option.topics_unread_when_closed}}
|
||||||
|
@ -1925,7 +1925,11 @@ en:
|
|||||||
after_5_minutes: "after 5 minutes"
|
after_5_minutes: "after 5 minutes"
|
||||||
after_10_minutes: "after 10 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"
|
topics_unread_when_closed: "Consider topics unread when they are closed"
|
||||||
|
|
||||||
invited:
|
invited:
|
||||||
|
Loading…
Reference in New Issue
Block a user