2016-07-06 03:16:32 +08:00
|
|
|
import computed from 'ember-addons/ember-computed-decorators';
|
|
|
|
import { topicLevels } from 'discourse/lib/notification-levels';
|
2015-02-27 01:52:30 +08:00
|
|
|
|
2014-11-20 03:37:43 +08:00
|
|
|
// Support for changing the notification level of various topics
|
2016-07-06 03:16:32 +08:00
|
|
|
export default Ember.Controller.extend({
|
2016-10-21 01:26:41 +08:00
|
|
|
topicBulkActions: Ember.inject.controller(),
|
2014-02-15 06:38:55 +08:00
|
|
|
notificationLevelId: null,
|
|
|
|
|
2016-07-06 03:16:32 +08:00
|
|
|
@computed
|
|
|
|
notificationLevels() {
|
|
|
|
return topicLevels.map(level => {
|
|
|
|
return {
|
|
|
|
id: level.id.toString(),
|
|
|
|
name: I18n.t(`topic.notifications.${level.key}.title`),
|
|
|
|
description: I18n.t(`topic.notifications.${level.key}.description`)
|
|
|
|
};
|
2014-02-15 06:38:55 +08:00
|
|
|
});
|
2016-07-06 03:16:32 +08:00
|
|
|
},
|
2014-02-15 06:38:55 +08:00
|
|
|
|
|
|
|
disabled: Em.computed.empty("notificationLevelId"),
|
|
|
|
|
|
|
|
actions: {
|
2016-07-06 03:16:32 +08:00
|
|
|
changeNotificationLevel() {
|
2016-10-21 01:26:41 +08:00
|
|
|
this.get('topicBulkActions').performAndRefresh({
|
2014-02-15 06:38:55 +08:00
|
|
|
type: 'change_notification_level',
|
|
|
|
notification_level_id: this.get('notificationLevelId')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|