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 @@
- {{#link-to 'adminEmail.index'}}{{i18n admin.email.settings}}{{/link-to}}
+ - {{#link-to 'adminEmail.all'}}{{i18n admin.email.all}}{{/link-to}}
- {{#link-to 'adminEmail.sent'}}{{i18n admin.email.sent}}{{/link-to}}
- {{#link-to 'adminEmail.skipped'}}{{i18n admin.email.skipped}}{{/link-to}}
- {{#link-to 'adminEmail.previewDigest'}}{{i18n admin.email.preview_digest}}{{/link-to}}
diff --git a/app/assets/javascripts/admin/templates/email_all.js.handlebars b/app/assets/javascripts/admin/templates/email_all.js.handlebars
new file mode 100644
index 00000000000..fc660093273
--- /dev/null
+++ b/app/assets/javascripts/admin/templates/email_all.js.handlebars
@@ -0,0 +1,39 @@
+
+
+
+ {{i18n admin.email.time}} |
+ {{i18n admin.email.user}} |
+ {{i18n admin.email.to_address}} |
+ {{i18n admin.email.email_type}} |
+ {{i18n admin.email.skipped_reason}} |
+
+
+
+
+ {{i18n admin.email.logs.filters.title}} |
+ {{textField value=filter.user placeholderKey="admin.email.logs.filters.user_placeholder"}} |
+ {{textField value=filter.address placeholderKey="admin.email.logs.filters.address_placeholder"}} |
+ {{textField value=filter.type placeholderKey="admin.email.logs.filters.type_placeholder"}} |
+ {{textField value=filter.skipped_reason placeholderKey="admin.email.logs.filters.skipped_reason_placeholder"}} |
+
+
+ {{#each model}}
+
+ {{unboundDate created_at}} |
+
+ {{#if user}}
+ {{#link-to 'adminUser' user}}{{avatar user imageSize="tiny"}}{{/link-to}}
+ {{#link-to 'adminUser' user}}{{user.username}}{{/link-to}}
+ {{else}}
+ —
+ {{/if}}
+ |
+ {{to_address}} |
+ {{email_type}} |
+ {{skipped_reason}} |
+
+ {{else}}
+ {{i18n admin.email.logs.none}} |
+ {{/each}}
+
+
diff --git a/app/assets/javascripts/admin/templates/email_sent.js.handlebars b/app/assets/javascripts/admin/templates/email_sent.js.handlebars
index 66b8f71a9e2..753a87f76b7 100644
--- a/app/assets/javascripts/admin/templates/email_sent.js.handlebars
+++ b/app/assets/javascripts/admin/templates/email_sent.js.handlebars
@@ -17,25 +17,23 @@
{{textField value=filter.reply_key placeholderKey="admin.email.logs.filters.reply_key_placeholder"}} |
- {{#if model}}
- {{#groupedEach model}}
-
- {{unboundDate created_at}} |
-
- {{#if user}}
- {{#link-to 'adminUser' user}}{{avatar user imageSize="tiny"}}{{/link-to}}
- {{#link-to 'adminUser' user}}{{user.username}}{{/link-to}}
- {{else}}
- —
- {{/if}}
- |
- {{to_address}} |
- {{email_type}} |
- {{reply_key}} |
-
- {{/groupedEach}}
+ {{#each model}}
+
+ {{unboundDate created_at}} |
+
+ {{#if user}}
+ {{#link-to 'adminUser' user}}{{avatar user imageSize="tiny"}}{{/link-to}}
+ {{#link-to 'adminUser' user}}{{user.username}}{{/link-to}}
+ {{else}}
+ —
+ {{/if}}
+ |
+ {{to_address}} |
+ {{email_type}} |
+ {{reply_key}} |
+
{{else}}
{{i18n admin.email.logs.none}} |
- {{/if}}
+ {{/each}}
diff --git a/app/assets/javascripts/admin/templates/email_skipped.js.handlebars b/app/assets/javascripts/admin/templates/email_skipped.js.handlebars
index daae2d8a585..fc660093273 100644
--- a/app/assets/javascripts/admin/templates/email_skipped.js.handlebars
+++ b/app/assets/javascripts/admin/templates/email_skipped.js.handlebars
@@ -5,7 +5,7 @@
{{i18n admin.email.user}} |
{{i18n admin.email.to_address}} |
{{i18n admin.email.email_type}} |
- {{i18n admin.email.skip_reason}} |
+ {{i18n admin.email.skipped_reason}} |
@@ -14,28 +14,26 @@
{{textField value=filter.user placeholderKey="admin.email.logs.filters.user_placeholder"}} |
{{textField value=filter.address placeholderKey="admin.email.logs.filters.address_placeholder"}} |
{{textField value=filter.type placeholderKey="admin.email.logs.filters.type_placeholder"}} |
- {{textField value=filter.skipReason placeholderKey="admin.email.logs.filters.skip_reason_placeholder"}} |
+ {{textField value=filter.skipped_reason placeholderKey="admin.email.logs.filters.skipped_reason_placeholder"}} |
- {{#if model}}
- {{#groupedEach model}}
-
- {{unboundDate created_at}} |
-
- {{#if user}}
- {{#link-to 'adminUser' user}}{{avatar user imageSize="tiny"}}{{/link-to}}
- {{#link-to 'adminUser' user}}{{user.username}}{{/link-to}}
- {{else}}
- —
- {{/if}}
- |
- {{to_address}} |
- {{email_type}} |
- {{skipped_reason}} |
-
- {{/groupedEach}}
+ {{#each model}}
+
+ {{unboundDate created_at}} |
+
+ {{#if user}}
+ {{#link-to 'adminUser' user}}{{avatar user imageSize="tiny"}}{{/link-to}}
+ {{#link-to 'adminUser' user}}{{user.username}}{{/link-to}}
+ {{else}}
+ —
+ {{/if}}
+ |
+ {{to_address}} |
+ {{email_type}} |
+ {{skipped_reason}} |
+
{{else}}
{{i18n admin.email.logs.none}} |
- {{/if}}
+ {{/each}}
diff --git a/app/controllers/admin/email_controller.rb b/app/controllers/admin/email_controller.rb
index 11d4bf9680f..40df9cb304a 100644
--- a/app/controllers/admin/email_controller.rb
+++ b/app/controllers/admin/email_controller.rb
@@ -13,6 +13,11 @@ class Admin::EmailController < Admin::AdminController
render nothing: true
end
+ def all
+ email_logs = filter_email_logs(EmailLog.all, params)
+ render_serialized(email_logs, EmailLogSerializer)
+ end
+
def sent
email_logs = filter_email_logs(EmailLog.sent, params)
render_serialized(email_logs, EmailLogSerializer)
@@ -37,7 +42,7 @@ class Admin::EmailController < Admin::AdminController
email_logs = email_logs.where("email_logs.to_address LIKE ?", "%#{params[:address]}%") if params[:address].present?
email_logs = email_logs.where("email_logs.email_type LIKE ?", "%#{params[:type]}%") if params[:type].present?
email_logs = email_logs.where("email_logs.reply_key LIKE ?", "%#{params[:reply_key]}%") if params[:reply_key].present?
- email_logs = email_logs.where("email_logs.skipped_reason LIKE ?", "%#{params[:reason]}%") if params[:reason].present?
+ email_logs = email_logs.where("email_logs.skipped_reason LIKE ?", "%#{params[:skipped_reason]}%") if params[:skipped_reason].present?
email_logs.to_a
end
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 9cd4c1cebd6..cb0ac26b981 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1382,6 +1382,7 @@ en:
email:
title: "Email"
settings: "Settings"
+ all: "All"
sent: "Sent"
skipped: "Skipped"
sent_at: "Sent At"
@@ -1401,7 +1402,7 @@ en:
text: "text"
last_seen_user: "Last Seen User:"
reply_key: "Reply Key"
- skip_reason: "Skip Reason"
+ skipped_reason: "Skip Reason"
logs:
none: "No logs found."
filters:
@@ -1410,7 +1411,7 @@ en:
address_placeholder: "em@il.com"
type_placeholder: "digest, signup..."
reply_key_placeholder: ""
- skip_reason_placeholder: "reason"
+ skipped_reason_placeholder: "reason"
logs:
title: "Logs"
diff --git a/config/routes.rb b/config/routes.rb
index b9967331412..36907a117dd 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -67,6 +67,7 @@ Discourse::Application.routes.draw do
resources :email do
collection do
post "test"
+ get "all"
get "sent"
get "skipped"
get "preview-digest" => "email#preview_digest"