This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/ignored-user-list.js.es6
2019-05-27 10:15:39 +02:00

30 lines
789 B
JavaScript

import { popupAjaxError } from "discourse/lib/ajax-error";
import showModal from "discourse/lib/show-modal";
import User from "discourse/models/user";
export default Ember.Component.extend({
item: null,
actions: {
removeIgnoredUser(item) {
this.set("saved", false);
this.items.removeObject(item);
User.findByUsername(item).then(user => {
user
.updateNotificationLevel("normal")
.catch(popupAjaxError)
.finally(() => this.set("saved", true));
});
},
newIgnoredUser() {
const modal = showModal("ignore-duration-with-username", {
model: this.model
});
modal.setProperties({
onUserIgnored: username => {
this.items.addObject(username);
}
});
}
}
});