DEV: Delete unused rerender-on-do-not-disturb-change mixin (#29373)

This was used in the old header/user-menu implementation. It can now be removed
This commit is contained in:
David Taylor 2024-10-23 17:16:08 +01:00 committed by GitHub
parent 87359cf7aa
commit b7f76d99e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,37 +0,0 @@
import Mixin from "@ember/object/mixin";
import { cancel } from "@ember/runloop";
import { isTesting } from "discourse-common/config/environment";
import discourseLater from "discourse-common/lib/later";
export default Mixin.create({
_listenToDoNotDisturbLoop: null,
listenForDoNotDisturbChanges() {
if (this.currentUser && !this.currentUser.isInDoNotDisturb()) {
this.queueRerender();
} else {
cancel(this._listenToDoNotDisturbLoop);
this._listenToDoNotDisturbLoop = discourseLater(
this,
() => {
this.listenForDoNotDisturbChanges();
},
10000
);
}
},
didInsertElement() {
this._super(...arguments);
this.appEvents.on("do-not-disturb:changed", () => this.queueRerender());
if (!isTesting()) {
this.listenForDoNotDisturbChanges();
}
},
willDestroyElement() {
this._super(...arguments);
cancel(this._listenToDoNotDisturbLoop);
},
});