filter out archived correctly

This commit is contained in:
Sam 2016-01-28 00:14:26 +11:00
parent b75353c26f
commit 5ed21e8767
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ class PostAlerter
inbox_count: Topic.exec_sql(
"SELECT COUNT(*) FROM topics t
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
LEFT JOIN group_archived_messages a ON a.topic_id = t.id AND a.group_id = g.group_id
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
}