mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 17:45:13 +08:00
d9a02d1336
This reverts commit20780a1eee
. * SECURITY: re-adds accidentally reverted commit: 03d26cd6: ensure embed_url contains valid http(s) uri * when the merge commite62a85cf
was reverted, git chose the2660c2e2
parent to land on instead of the03d26cd6
parent (which contains security fixes)
72 lines
1.9 KiB
JavaScript
72 lines
1.9 KiB
JavaScript
import I18n from "I18n";
|
|
import DropdownSelectBox from "select-kit/components/dropdown-select-box";
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
import showModal from "discourse/lib/show-modal";
|
|
import { computed } from "@ember/object";
|
|
|
|
export default DropdownSelectBox.extend({
|
|
classNames: ["user-notifications", "user-notifications-dropdown"],
|
|
|
|
selectKitOptions: {
|
|
headerIcon: "userNotificationicon"
|
|
},
|
|
|
|
userNotificationicon: computed("mainCollection.[]", "value", function() {
|
|
return (
|
|
this.mainCollection &&
|
|
this.mainCollection.find(row => row.id === this.value).icon
|
|
);
|
|
}),
|
|
|
|
content: computed(function() {
|
|
const content = [];
|
|
|
|
content.push({
|
|
icon: "user",
|
|
id: "changeToNormal",
|
|
description: I18n.t("user.user_notifications.normal_option_title"),
|
|
name: I18n.t("user.user_notifications.normal_option")
|
|
});
|
|
|
|
content.push({
|
|
icon: "times-circle",
|
|
id: "changeToMuted",
|
|
description: I18n.t("user.user_notifications.mute_option_title"),
|
|
name: I18n.t("user.user_notifications.mute_option")
|
|
});
|
|
|
|
if (this.get("user.can_ignore_user")) {
|
|
content.push({
|
|
icon: "far-eye-slash",
|
|
id: "changeToIgnored",
|
|
description: I18n.t("user.user_notifications.ignore_option_title"),
|
|
name: I18n.t("user.user_notifications.ignore_option")
|
|
});
|
|
}
|
|
|
|
return content;
|
|
}),
|
|
|
|
changeToNormal() {
|
|
this.updateNotificationLevel("normal").catch(popupAjaxError);
|
|
},
|
|
changeToMuted() {
|
|
this.updateNotificationLevel("mute").catch(popupAjaxError);
|
|
},
|
|
changeToIgnored() {
|
|
showModal("ignore-duration", {
|
|
model: this.user
|
|
});
|
|
},
|
|
|
|
actions: {
|
|
onChange(level) {
|
|
this[level]();
|
|
|
|
// hack but model.ignored/muted is not
|
|
// getting updated after updateNotificationLevel
|
|
this.set("value", level);
|
|
}
|
|
}
|
|
});
|