2018-06-15 11:03:24 -04:00
|
|
|
import showModal from "discourse/lib/show-modal";
|
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
2017-09-08 16:27:07 -04:00
|
|
|
|
|
|
|
export default Ember.Component.extend({
|
2017-09-14 14:10:39 -04:00
|
|
|
adminTools: Ember.inject.service(),
|
2017-09-14 12:44:49 -04:00
|
|
|
expanded: false,
|
2018-06-15 11:03:24 -04:00
|
|
|
tagName: "div",
|
2017-09-11 14:01:59 -04:00
|
|
|
classNameBindings: [
|
2018-06-15 11:03:24 -04:00
|
|
|
":flagged-post",
|
|
|
|
"flaggedPost.hidden:hidden-post",
|
|
|
|
"flaggedPost.deleted"
|
2017-09-11 14:01:59 -04:00
|
|
|
],
|
2017-09-08 16:27:07 -04:00
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
canAct: Ember.computed.alias("actableFilter"),
|
2018-01-12 16:08:40 -05:00
|
|
|
|
2018-06-15 11:03:24 -04:00
|
|
|
@computed("filter")
|
2018-01-12 16:08:40 -05:00
|
|
|
actableFilter(filter) {
|
2018-06-15 11:03:24 -04:00
|
|
|
return filter === "active";
|
2017-09-14 14:10:39 -04:00
|
|
|
},
|
|
|
|
|
2017-09-08 16:27:07 -04:00
|
|
|
removeAfter(promise) {
|
2018-01-30 16:31:29 -05:00
|
|
|
return promise.then(() => this.attrs.removePost());
|
2017-09-08 16:27:07 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
_spawnModal(name, model, modalClass) {
|
|
|
|
let controller = showModal(name, { model, admin: true, modalClass });
|
2018-06-15 11:03:24 -04:00
|
|
|
controller.removeAfter = p => this.removeAfter(p);
|
2017-09-08 16:27:07 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
2017-11-10 15:55:48 -05:00
|
|
|
removeAfter(promise) {
|
2018-01-30 16:31:29 -05:00
|
|
|
return this.removeAfter(promise);
|
2017-11-09 15:33:36 -05:00
|
|
|
},
|
|
|
|
|
2017-09-08 16:27:07 -04:00
|
|
|
disagree() {
|
2018-06-15 11:03:24 -04:00
|
|
|
this.removeAfter(this.get("flaggedPost").disagreeFlags());
|
2017-09-08 16:27:07 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
defer() {
|
2018-06-15 11:03:24 -04:00
|
|
|
this.removeAfter(this.get("flaggedPost").deferFlags());
|
2017-09-14 12:44:49 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
expand() {
|
2018-06-15 11:03:24 -04:00
|
|
|
this.get("flaggedPost")
|
|
|
|
.expandHidden()
|
|
|
|
.then(() => {
|
|
|
|
this.set("expanded", true);
|
|
|
|
});
|
2017-09-14 14:10:39 -04:00
|
|
|
},
|
|
|
|
|
2017-12-08 15:48:13 -05:00
|
|
|
showModerationHistory() {
|
2018-06-15 11:03:24 -04:00
|
|
|
this.get("adminTools").showModerationHistory({
|
|
|
|
filter: "post",
|
|
|
|
post_id: this.get("flaggedPost.id")
|
2017-12-08 15:48:13 -05:00
|
|
|
});
|
2017-09-08 16:27:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|