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
Tarek Khalil d8ff94ecaa
FEATURE: Ignoring users from the preferences page in a cleaner way (#7289)
* FEATURE: Ignoring users from the preferences page in a cleaner way
2019-04-25 09:26:49 +01:00

30 lines
810 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.get("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.get("model")
});
modal.setProperties({
onUserIgnored: username => {
this.get("items").addObject(username);
}
});
}
}
});