1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/controllers/admin-wizards.js.es6
angusmcleod 81bb7e56c2 WIP
2021-11-17 20:26:44 +08:00

26 Zeilen
733 B
JavaScript

import Controller, { inject as controller } from "@ember/controller";
import { isPresent } from "@ember/utils";
import { A } from "@ember/array";
export default Controller.extend({
adminWizardsNotices: controller(),
unsubscribe() {
this.messageBus.unsubscribe("/custom-wizard/notices");
},
subscribe() {
this.unsubscribe();
this.messageBus.subscribe("/custom-wizard/notices", (data) => {
if (isPresent(data.active_notice_count)) {
this.set("activeNoticeCount", data.active_notice_count);
this.adminWizardsNotices.setProperties({
notices: A(),
page: 0,
canLoadMore: true
});
this.adminWizardsNotices.loadMoreNotices();
}
});
}
});