mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 05:02:24 +08:00
b58867b6e9
Includes support for flags, reviewable users and queued posts, with REST API backwards compatibility. Co-Authored-By: romanrizzi <romanalejandro@gmail.com> Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
42 lines
930 B
JavaScript
42 lines
930 B
JavaScript
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
export default Ember.Mixin.create(ModalFunctionality, {
|
|
reason: null,
|
|
message: null,
|
|
postEdit: null,
|
|
postAction: null,
|
|
user: null,
|
|
postId: null,
|
|
successCallback: null,
|
|
|
|
resetModal() {
|
|
this.setProperties({
|
|
reason: null,
|
|
message: null,
|
|
loadingUser: true,
|
|
postId: null,
|
|
postEdit: null,
|
|
postAction: "delete",
|
|
before: null,
|
|
successCallback: null
|
|
});
|
|
},
|
|
|
|
penalize(cb) {
|
|
let before = this.get("before");
|
|
let promise = before ? before() : Ember.RSVP.resolve();
|
|
|
|
return promise
|
|
.then(() => cb())
|
|
.then(result => {
|
|
this.send("closeModal");
|
|
let callback = this.get("successCallback");
|
|
if (callback) {
|
|
callback(result);
|
|
}
|
|
})
|
|
.catch(popupAjaxError);
|
|
}
|
|
});
|