A platform for community discussion. Free, open, simple.
PERF: Minor but we can just pass a hash to `where`.
Guo Xiang Tan754458e6a277
diff --git a/app/models/notification.rb b/app/models/notification.rbindex c476f778b38..8e213851bc7 100644--- a/app/models/notification.rb+++ b/app/models/notification.rb@@ -59,18 +59,22 @@ class Notification < ActiveRecord::Basedef self.mark_posts_read(user, topic_id, post_numbers)Notification- .where(user_id: user.id)- .where(topic_id: topic_id)- .where(post_number: post_numbers)- .where(read: false)+ .where(+ user_id: user.id,+ topic_id: topic_id,+ post_number: post_numbers,+ read: false+ ).update_all(read: true)enddef self.read(user, notification_ids)Notification- .where(id: notification_ids)- .where(user_id: user.id)- .where(read: false)+ .where(+ id: notification_ids,+ user_id: user.id,+ read: false+ ).update_all(read: true)end