mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:23:13 +08:00
DEV: remove do-not-disturb widget (#26156)
It seems like this is a legacy widget which was used here f899652422/app/assets/javascripts/discourse/app/widgets/quick-access-panel.js (L106)
but usage got removed in https://github.com/discourse/discourse/pull/21308/files#diff-9f7a1e3cde1ef93d38ba40ebf295749fb217eee81b95e95c34f98721274cdca9 and the widget didn't get removed.
This commit is contained in:
parent
1f71db426e
commit
ce3f592275
|
@ -1,54 +0,0 @@
|
|||
import { h } from "virtual-dom";
|
||||
import DoNotDisturbModal from "discourse/components/modal/do-not-disturb";
|
||||
import { dateNode } from "discourse/helpers/node";
|
||||
import DoNotDisturb from "discourse/lib/do-not-disturb";
|
||||
import { createWidget } from "discourse/widgets/widget";
|
||||
import { iconNode } from "discourse-common/lib/icon-library";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default createWidget("do-not-disturb", {
|
||||
tagName: "li.do-not-disturb",
|
||||
services: ["modal"],
|
||||
|
||||
saving: false,
|
||||
|
||||
html() {
|
||||
const isOn = this.currentUser.isInDoNotDisturb();
|
||||
return [this._menuButton(isOn)];
|
||||
},
|
||||
|
||||
click() {
|
||||
if (this.saving) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.saving = true;
|
||||
if (this.currentUser.do_not_disturb_until) {
|
||||
return this.currentUser.leaveDoNotDisturb().then(() => {
|
||||
this.saving = false;
|
||||
});
|
||||
} else {
|
||||
this.saving = false;
|
||||
return this.modal.show(DoNotDisturbModal);
|
||||
}
|
||||
},
|
||||
|
||||
_menuButton(isOn) {
|
||||
const icon = iconNode(isOn ? "toggle-on" : "toggle-off");
|
||||
return h("button.btn-flat.do-not-disturb-inner-container", [
|
||||
icon,
|
||||
this._label(),
|
||||
]);
|
||||
},
|
||||
|
||||
_label() {
|
||||
const content = [h("span", I18n.t("pause_notifications.label"))];
|
||||
|
||||
const until = this.currentUser.do_not_disturb_until;
|
||||
if (!DoNotDisturb.isEternal(until)) {
|
||||
content.push(dateNode(until));
|
||||
}
|
||||
|
||||
return h("span.do-not-disturb-label", content);
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue
Block a user