discourse/app/assets/javascripts/admin/controllers/admin-flags-list.js.es6

42 lines
1.0 KiB
Plaintext
Raw Normal View History

import FlaggedPost from 'admin/models/flagged-post';
export default Ember.Controller.extend({
query: null,
2014-08-04 16:48:04 -04:00
adminOldFlagsView: Em.computed.equal("query", "old"),
adminActiveFlagsView: Em.computed.equal("query", "active"),
2013-09-16 14:08:55 -04:00
actions: {
2015-02-18 14:21:36 -05:00
disagreeFlags(flaggedPost) {
flaggedPost.disagreeFlags().then(() => {
this.get('model').removeObject(flaggedPost);
}, function () {
2013-09-16 14:08:55 -04:00
bootbox.alert(I18n.t("admin.flags.error"));
});
},
2015-02-18 14:21:36 -05:00
deferFlags(flaggedPost) {
flaggedPost.deferFlags().then(() => {
this.get('model').removeObject(flaggedPost);
}, function () {
2013-09-16 14:08:55 -04:00
bootbox.alert(I18n.t("admin.flags.error"));
});
},
2015-02-18 14:21:36 -05:00
doneTopicFlags(item) {
2014-08-04 16:48:04 -04:00
this.send("disagreeFlags", item);
2014-02-05 17:54:16 -05:00
},
loadMore() {
const flags = this.get('model');
return FlaggedPost.findAll(this.get('query'), flags.length+1).then(data => {
if (data.length===0) {
flags.set("allLoaded",true);
}
flags.addObjects(data);
});
}
}
});