diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rb index 7fc06a546..aad37984b 100644 --- a/app/services/post_alerter.rb +++ b/app/services/post_alerter.rb @@ -152,9 +152,9 @@ class PostAlerter group_name: g.name.downcase, inbox_count: Topic.exec_sql( "SELECT COUNT(*) FROM topics t - JOIN topic_allowed_groups g ON g.id = :group_id AND g.topic_id = t.id + JOIN topic_allowed_groups g ON g.group_id = :group_id AND g.topic_id = t.id LEFT JOIN group_archived_messages a ON a.topic_id = t.id AND a.group_id = g.id - WHERE a.id IS NULL AND t.deleted_at is NULL AND t.archetype = 'private_message'", + WHERE a.id IS NULL AND t.deleted_at is NULL AND t.archetype = 'private_message'", group_id: g.id).values[0][0].to_i } end diff --git a/spec/controllers/admin/groups_controller_spec.rb b/spec/controllers/admin/groups_controller_spec.rb index 9b9f2072a..028945d22 100644 --- a/spec/controllers/admin/groups_controller_spec.rb +++ b/spec/controllers/admin/groups_controller_spec.rb @@ -32,7 +32,7 @@ describe Admin::GroupsController do "primary_group"=>false, "grant_trust_level"=>nil, "incoming_email"=>nil, - "notification_level"=>3, + "notification_level"=>2, "has_messages"=>false }]) end