From e3577906891f9ab0edd987544e3432f354bc1721 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 10 Feb 2014 19:41:02 +0100 Subject: fix unread_by? to check user_ids_to_show, remove TODO uniq! is probably not any faster than just checking include? --- users/app/models/message.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'users/app/models') diff --git a/users/app/models/message.rb b/users/app/models/message.rb index 7c05e06..424f094 100644 --- a/users/app/models/message.rb +++ b/users/app/models/message.rb @@ -17,7 +17,6 @@ class Message < CouchRest::Model::Base user_ids_to_show.delete(user.id) # is it necessary to keep track of what users have already seen it? user_ids_have_shown << user.id unless read_by?(user) - # TODO: is it quicker to call uniq! after adding rather than check if it is already included? end def read_by?(user) @@ -25,6 +24,6 @@ class Message < CouchRest::Model::Base end def unread_by?(user) - user_ids_to_shown.include?(user.id) + user_ids_to_show.include?(user.id) end end -- cgit v1.2.3