mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
FIX: Observers weren't working on admin email logs
We were trying to observe a non-ember object which is undefined behavior and was leaking to odd bugs. This replaces the `filter` object with an Ember Object and things seem to work.
This commit is contained in:
parent
3862036422
commit
195119b77c
|
@ -1,9 +1,14 @@
|
|||
import Controller from "@ember/controller";
|
||||
import EmailLog from "admin/models/email-log";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
export default Controller.extend({
|
||||
loading: false,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set("filter", EmberObject.create());
|
||||
},
|
||||
loadLogs(sourceModel, loadMore) {
|
||||
if ((loadMore && this.loading) || this.get("model.allLoaded")) {
|
||||
return;
|
||||
|
@ -13,8 +18,14 @@ export default Controller.extend({
|
|||
|
||||
sourceModel = sourceModel || EmailLog;
|
||||
|
||||
let args = {};
|
||||
Object.keys(this.filter).forEach((k) => {
|
||||
if (this.filter[k]) {
|
||||
args[k] = this.filter[k];
|
||||
}
|
||||
});
|
||||
return sourceModel
|
||||
.findAll(this.filter, loadMore ? this.get("model.length") : null)
|
||||
.findAll(args, loadMore ? this.get("model.length") : null)
|
||||
.then((logs) => {
|
||||
if (this.model && loadMore && logs.length < 50) {
|
||||
this.model.set("allLoaded", true);
|
||||
|
|
|
@ -8,6 +8,6 @@ export default DiscourseRoute.extend({
|
|||
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
controller.set("filter", { status: this.status });
|
||||
controller.set("filter.status", this.status);
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user