summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-02-10 19:41:02 +0100
committerAzul <azul@leap.se>2014-02-10 19:41:02 +0100
commite3577906891f9ab0edd987544e3432f354bc1721 (patch)
tree86d1ff6f379d3912e5959ae9d4b28feba0668d5f
parent2f00e2ec3c076e4910008904bc01e09df097944e (diff)
fix unread_by? to check user_ids_to_show, remove TODO
uniq! is probably not any faster than just checking include?
-rw-r--r--users/app/models/message.rb3
1 files changed, 1 insertions, 2 deletions
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