-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
30 deletions.
There are no files selected for viewing
76 changes: 46 additions & 30 deletions
76
...iscourse/connectors/user-preferences-tracking-topics/notification-level-when-assigned.gjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,54 @@ | ||
import Component from "@glimmer/component"; | ||
import ComboBox from "select-kit/components/combo-box"; | ||
import { i18n } from "discourse-i18n"; | ||
import { service } from "@ember/service"; | ||
import { i18n } from "discourse-i18n"; | ||
import ComboBox from "select-kit/components/combo-box"; | ||
|
||
export default class NotificationLevelWhenAssigned extends Component { | ||
@service siteSettings; | ||
@service siteSettings; | ||
|
||
constructor(owner, args) { | ||
super(...arguments); | ||
if (this.siteSettings.assign_enabled) { | ||
args.outletArgs.customAttrNames.push("notification_level_when_assigned"); | ||
} | ||
constructor(owner, args) { | ||
super(...arguments); | ||
if (this.siteSettings.assign_enabled) { | ||
args.outletArgs.customAttrNames.push("notification_level_when_assigned"); | ||
} | ||
} | ||
|
||
get notificationLevelsWhenAssigned() { | ||
// The order matches the "notification level when replying" user preference | ||
return [ | ||
{ name: i18n("user.notification_level_when_assigned.watch_topic"), value: "watch_topic" }, | ||
{ name: i18n("user.notification_level_when_assigned.track_topic"), value: "track_topic" }, | ||
{ name: i18n("user.notification_level_when_assigned.do_nothing"), value: "do_nothing" }, | ||
]; | ||
} | ||
get notificationLevelsWhenAssigned() { | ||
// The order matches the "notification level when replying" user preference | ||
return [ | ||
{ | ||
name: i18n("user.notification_level_when_assigned.watch_topic"), | ||
value: "watch_topic", | ||
}, | ||
{ | ||
name: i18n("user.notification_level_when_assigned.track_topic"), | ||
value: "track_topic", | ||
}, | ||
{ | ||
name: i18n("user.notification_level_when_assigned.do_nothing"), | ||
value: "do_nothing", | ||
}, | ||
]; | ||
} | ||
|
||
<template> | ||
{{#if this.siteSettings.assign_enabled}} | ||
<div class="controls controls-dropdown" data-setting-name="user-notification-level-when-assigned"> | ||
<label>{{i18n "user.notification_level_when_assigned.label"}}</label> | ||
<ComboBox | ||
@content={{this.notificationLevelsWhenAssigned}} | ||
@value={{this.args.outletArgs.model.user_option.notification_level_when_assigned}} | ||
@valueProperty="value" | ||
@onChange={{action (mut this.args.outletArgs.model.user_option.notification_level_when_assigned)}} | ||
/> | ||
</div> | ||
{{/if}} | ||
</template> | ||
} | ||
<template> | ||
{{#if this.siteSettings.assign_enabled}} | ||
<div | ||
class="controls controls-dropdown" | ||
data-setting-name="user-notification-level-when-assigned" | ||
> | ||
<label>{{i18n "user.notification_level_when_assigned.label"}}</label> | ||
<ComboBox | ||
@content={{this.notificationLevelsWhenAssigned}} | ||
@value={{this.args.outletArgs.model.user_option.notification_level_when_assigned}} | ||
Check failure on line 43 in assets/javascripts/discourse/connectors/user-preferences-tracking-topics/notification-level-when-assigned.gjs
|
||
@valueProperty="value" | ||
@onChange={{action | ||
(mut | ||
this.args.outletArgs.model.user_option.notification_level_when_assigned | ||
Check failure on line 47 in assets/javascripts/discourse/connectors/user-preferences-tracking-topics/notification-level-when-assigned.gjs
|
||
) | ||
}} | ||
/> | ||
</div> | ||
{{/if}} | ||
</template> | ||
} |