mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:03:43 +08:00
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:
parent
87359cf7aa
commit
b7f76d99e8
|
@ -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);
|
|
||||||
},
|
|
||||||
});
|
|
Loading…
Reference in New Issue
Block a user