FIX: Observers weren't working on admin email logs

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.

diff --git a/app/assets/javascripts/admin/addon/controllers/admin-email-logs.js b/app/assets/javascripts/admin/addon/controllers/admin-email-logs.js
index c0bb4f2..048ad49 100644
--- a/app/assets/javascripts/admin/addon/controllers/admin-email-logs.js
+++ b/app/assets/javascripts/admin/addon/controllers/admin-email-logs.js
@@ -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);
diff --git a/app/assets/javascripts/admin/addon/routes/admin-email-incomings.js b/app/assets/javascripts/admin/addon/routes/admin-email-incomings.js
index 09118ea..6321c8e 100644
--- a/app/assets/javascripts/admin/addon/routes/admin-email-incomings.js
+++ b/app/assets/javascripts/admin/addon/routes/admin-email-incomings.js
@@ -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);
   },
 });

GitHub sha: 195119b7

This commit appears in #10886 which was approved by ZogStriP. It was merged by eviltrout.