diff --git a/app/assets/javascripts/admin/controllers/admin_email_logs_controllers.js b/app/assets/javascripts/admin/controllers/admin_email_logs_controllers.js new file mode 100644 index 00000000000..356b25549cc --- /dev/null +++ b/app/assets/javascripts/admin/controllers/admin_email_logs_controllers.js @@ -0,0 +1,40 @@ + /** + This controller supports email logs functionality. + + @class AdminEmailSentController + @extends Discourse.Controller + @namespace Discourse + @module Discourse +**/ +Discourse.AdminEmailSentController = Discourse.Controller.extend({ + + filterEmailLogs: Discourse.debounce(function() { + var self = this; + Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) { + self.set("model", logs); + }); + }, 250).observes("filter.user", "filter.address", "filter.type", "filter.reply_key"), + +}); + + /** + This controller supports email logs functionality. + + @class AdminEmailSkippedController + @extends Discourse.Controller + @namespace Discourse + @module Discourse +**/ +Discourse.AdminEmailSkippedController = Discourse.Controller.extend({ + + filterEmailLogs: Discourse.debounce(function() { + var self = this; + Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) { + self.set("model", logs); + }); + }, 250).observes("filter.user", "filter.address", "filter.type", "filter.skipped_reason"), + +}); + + +Discourse.AdminEmailAllController = Discourse.AdminEmailSkippedController.extend({}); diff --git a/app/assets/javascripts/admin/controllers/admin_email_logs_skipped_controller.js b/app/assets/javascripts/admin/controllers/admin_email_logs_skipped_controller.js deleted file mode 100644 index f6e235c4afe..00000000000 --- a/app/assets/javascripts/admin/controllers/admin_email_logs_skipped_controller.js +++ /dev/null @@ -1,20 +0,0 @@ - /** - This controller supports email logs functionality. - - @class AdminEmailSkippedController - @extends Discourse.Controller - @namespace Discourse - @module Discourse -**/ -Discourse.AdminEmailSkippedController = Discourse.Controller.extend({ - - filterEmailLogs: Discourse.debounce(function() { - var self = this; - this.set("loading", true); - Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) { - self.set("model", false); - self.set("model", logs); - }); - }, 250).observes("filter.user", "filter.address", "filter.type", "filter.reason"), - -}); diff --git a/app/assets/javascripts/admin/controllers/admin_email_sent_controller.js b/app/assets/javascripts/admin/controllers/admin_email_sent_controller.js deleted file mode 100644 index 52cc020b808..00000000000 --- a/app/assets/javascripts/admin/controllers/admin_email_sent_controller.js +++ /dev/null @@ -1,20 +0,0 @@ - /** - This controller supports email logs functionality. - - @class AdminEmailSentController - @extends Discourse.Controller - @namespace Discourse - @module Discourse -**/ -Discourse.AdminEmailSentController = Discourse.Controller.extend({ - - filterEmailLogs: Discourse.debounce(function() { - var self = this; - this.set("loading", true); - Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) { - self.set("loading", false); - self.set("model", logs); - }); - }, 250).observes("filter.user", "filter.address", "filter.type", "filter.reply_key"), - -}); diff --git a/app/assets/javascripts/admin/models/email_log.js b/app/assets/javascripts/admin/models/email_log.js index 4819683fac8..fe824866997 100644 --- a/app/assets/javascripts/admin/models/email_log.js +++ b/app/assets/javascripts/admin/models/email_log.js @@ -22,7 +22,7 @@ Discourse.EmailLog.reopenClass({ findAll: function(filter) { filter = filter || {}; - var status = filter.status || "sent"; + var status = filter.status || "all"; filter = _.omit(filter, "status"); return Discourse.ajax("/admin/email/" + status + ".json", { data: filter }).then(function(logs) { diff --git a/app/assets/javascripts/admin/routes/admin_email_logs_routes.js b/app/assets/javascripts/admin/routes/admin_email_logs_routes.js index 70c0e72f7e9..c7a705d233e 100644 --- a/app/assets/javascripts/admin/routes/admin_email_logs_routes.js +++ b/app/assets/javascripts/admin/routes/admin_email_logs_routes.js @@ -23,5 +23,6 @@ Discourse.AdminEmailLogsRoute = Discourse.Route.extend({ }); +Discourse.AdminEmailAllRoute = Discourse.AdminEmailLogsRoute.extend({ status: "all" }); Discourse.AdminEmailSentRoute = Discourse.AdminEmailLogsRoute.extend({ status: "sent" }); Discourse.AdminEmailSkippedRoute = Discourse.AdminEmailLogsRoute.extend({ status: "skipped" }); diff --git a/app/assets/javascripts/admin/routes/admin_routes.js b/app/assets/javascripts/admin/routes/admin_routes.js index 55d0269d31d..3b847a36dac 100644 --- a/app/assets/javascripts/admin/routes/admin_routes.js +++ b/app/assets/javascripts/admin/routes/admin_routes.js @@ -16,6 +16,7 @@ Discourse.Route.buildRoutes(function() { }); this.resource('adminEmail', { path: '/email'}, function() { + this.route('all'); this.route('sent'); this.route('skipped'); this.route('previewDigest', { path: '/preview-digest' }); diff --git a/app/assets/javascripts/admin/templates/email.js.handlebars b/app/assets/javascripts/admin/templates/email.js.handlebars index 62d66b99603..14ee7296f1a 100644 --- a/app/assets/javascripts/admin/templates/email.js.handlebars +++ b/app/assets/javascripts/admin/templates/email.js.handlebars @@ -2,6 +2,7 @@