mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 05:43:38 +08:00
bf91532260
- Remove ArrayController - Remove {{view}} from templates - Replace many cases of needs: [‘controller’] with inject - Enable Ember Legacy Views
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import FlaggedPost from 'admin/models/flagged-post';
|
|
|
|
export default Ember.Controller.extend({
|
|
query: null,
|
|
|
|
adminOldFlagsView: Em.computed.equal("query", "old"),
|
|
adminActiveFlagsView: Em.computed.equal("query", "active"),
|
|
|
|
actions: {
|
|
disagreeFlags(flaggedPost) {
|
|
flaggedPost.disagreeFlags().then(() => {
|
|
this.get('model').removeObject(flaggedPost);
|
|
}, function () {
|
|
bootbox.alert(I18n.t("admin.flags.error"));
|
|
});
|
|
},
|
|
|
|
deferFlags(flaggedPost) {
|
|
flaggedPost.deferFlags().then(() => {
|
|
this.get('model').removeObject(flaggedPost);
|
|
}, function () {
|
|
bootbox.alert(I18n.t("admin.flags.error"));
|
|
});
|
|
},
|
|
|
|
doneTopicFlags(item) {
|
|
this.send("disagreeFlags", item);
|
|
},
|
|
|
|
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);
|
|
});
|
|
}
|
|
}
|
|
|
|
});
|