DEV: always trigger 'notification_created' event.

DEV: always trigger ‘notification_created’ event.

And make prettier happy.

diff --git a/app/assets/javascripts/discourse/widgets/membership-request-consolidated-notification-item.js.es6 b/app/assets/javascripts/discourse/widgets/membership-request-consolidated-notification-item.js.es6
index ea5f54d198..fafa3656f6 100644
--- a/app/assets/javascripts/discourse/widgets/membership-request-consolidated-notification-item.js.es6
+++ b/app/assets/javascripts/discourse/widgets/membership-request-consolidated-notification-item.js.es6
@@ -13,13 +13,10 @@ createWidgetFrom(
     },
 
     text(notificationName, data) {
-      return I18n.t(
-        "notifications.membership_request_consolidated",
-        {
-          group_name: data.group_name,
-          count: parseInt(data.count, 10)
-        }
-      );
+      return I18n.t("notifications.membership_request_consolidated", {
+        group_name: data.group_name,
+        count: parseInt(data.count, 10)
+      });
     }
   }
 );
diff --git a/app/models/notification.rb b/app/models/notification.rb
index a5c1e05389..4c0419f9e7 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -26,12 +26,8 @@ class Notification < ActiveRecord::Base
   after_commit :refresh_notification_count, on: [:create, :update, :destroy]
 
   after_commit(on: :create) do
-    consolidated = consolidate_membership_requests
-
-    unless consolidated
-      DiscourseEvent.trigger(:notification_created, self)
-      send_email
-    end
+    DiscourseEvent.trigger(:notification_created, self)
+    send_email unless consolidate_membership_requests
   end
 
   def self.ensure_consistency!

GitHub sha: 0fed4174

1 Like

Pass the consolidated result to trigger parms would be better for plugin?