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:
Joffrey JAFFEUX 2024-03-13 11:37:25 +01:00 committed by GitHub
parent 1f71db426e
commit ce3f592275
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
},
});