2017-06-28 15:12:37 +01:00
|
|
|
import RestModel from 'discourse/models/rest';
|
|
|
|
import Category from 'discourse/models/category';
|
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
|
|
|
|
export default RestModel.extend({
|
2017-06-28 18:04:21 +01:00
|
|
|
available_filters: [
|
2017-07-03 15:53:26 +01:00
|
|
|
{ id: 'watch', name: I18n.t('chat_integration.filter.watch'), icon: 'exclamation-circle' },
|
|
|
|
{ id: 'follow', name: I18n.t('chat_integration.filter.follow'), icon: 'circle'},
|
|
|
|
{ id: 'mute', name: I18n.t('chat_integration.filter.mute'), icon: 'times-circle' }
|
2017-06-28 18:04:21 +01:00
|
|
|
],
|
|
|
|
|
2017-06-28 15:12:37 +01:00
|
|
|
category_id: null,
|
2017-06-29 17:50:54 +01:00
|
|
|
tags: null,
|
2017-06-28 15:12:37 +01:00
|
|
|
provider: '',
|
|
|
|
channel: '',
|
|
|
|
filter: null,
|
|
|
|
|
|
|
|
@computed('category_id')
|
2017-06-29 17:50:54 +01:00
|
|
|
category(categoryId) {
|
|
|
|
if (categoryId){
|
|
|
|
return Category.findById(categoryId);
|
|
|
|
}else {
|
|
|
|
return false;
|
2017-06-28 15:12:37 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed('filter')
|
|
|
|
filterName(filter) {
|
2017-07-03 15:53:26 +01:00
|
|
|
return I18n.t(`chat_integration.filter.${filter}`);
|
2017-06-29 17:50:54 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
updateProperties() {
|
2017-06-29 20:19:40 +01:00
|
|
|
var prop_names = ['category_id','provider','channel', 'tags','filter'];
|
|
|
|
return this.getProperties(prop_names);
|
|
|
|
},
|
|
|
|
|
|
|
|
createProperties() {
|
|
|
|
return this.updateProperties();
|
2017-06-28 15:12:37 +01:00
|
|
|
}
|
2017-06-29 20:19:40 +01:00
|
|
|
|
2017-06-28 15:12:37 +01:00
|
|
|
});
|