diff --git a/app/models/status_message.rb b/app/models/status_message.rb index 69c10c477..c9aa22515 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -35,9 +35,9 @@ class StatusMessage < Post #scopes scope :where_person_is_mentioned, lambda{|person| joins(:mentions).where(:mentions => {:person_id => person.id})} - def self.tag_stream(user, tag_array, max_time, order) + def self.tag_stream(user, tag_ids, max_time, order) owned_or_visible_by_user(user). - joins(:tags).where(:tags => {:name => tag_array}) + joins(:tags).where(:tags => {:id => tag_ids}) end def text(opts = {}) diff --git a/lib/stream/followed_tag.rb b/lib/stream/followed_tag.rb index ab983f24a..b2c473152 100644 --- a/lib/stream/followed_tag.rb +++ b/lib/stream/followed_tag.rb @@ -15,7 +15,7 @@ class Stream::FollowedTag < Stream::Base # @return [ActiveRecord::Association] AR association of posts def posts return [] if tag_string.empty? - @posts ||= StatusMessage.tag_stream(user, tag_array, max_time, order) + @posts ||= StatusMessage.tag_stream(user, tag_ids, max_time, order) end def contacts_title @@ -28,8 +28,8 @@ class Stream::FollowedTag < Stream::Base @tag_string ||= tags.join(', '){|tag| tag.name}.to_s end - def tag_array - tags.map{|x| x.name} + def tag_ids + tags.map{|x| x.id} end def tags diff --git a/lib/stream/multi.rb b/lib/stream/multi.rb index 9a3fc1814..b6a5692aa 100644 --- a/lib/stream/multi.rb +++ b/lib/stream/multi.rb @@ -94,7 +94,7 @@ class Stream::Multi < Stream::Base end def followed_tags_post_ids - @followed_tags_ids ||= ids(StatusMessage.tag_stream(user, tag_array, max_time, order)) + @followed_tags_ids ||= ids(StatusMessage.tag_stream(user, tag_ids, max_time, order)) end def mentioned_post_ids @@ -110,8 +110,8 @@ class Stream::Multi < Stream::Base @community_spotlight_person_ids ||= Person.community_spotlight.select('id').map{|x| x.id} end - def tag_array - user.followed_tags.select('name').map{|x| x.name} + def tag_ids + user.followed_tags.map{|x| x.id} end def ids(enumerable)