diff options
| author | Azul <azul@leap.se> | 2014-02-10 19:41:02 +0100 | 
|---|---|---|
| committer | Azul <azul@leap.se> | 2014-02-10 19:41:02 +0100 | 
| commit | e3577906891f9ab0edd987544e3432f354bc1721 (patch) | |
| tree | 86d1ff6f379d3912e5959ae9d4b28feba0668d5f | |
| parent | 2f00e2ec3c076e4910008904bc01e09df097944e (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.rb | 3 | 
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 | 
