From e0eb76eb2a94c1e389b6fe5bfc68f0e7bf4a92ed Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Mon, 25 Dec 2017 00:13:24 +0100 Subject: Remove aspect_ids parameter from publisher closes #7683 --- lib/stream/aspect.rb | 15 +++++++-------- lib/stream/base.rb | 4 ---- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/stream/aspect.rb b/lib/stream/aspect.rb index 6800310b0..af6972775 100644 --- a/lib/stream/aspect.rb +++ b/lib/stream/aspect.rb @@ -30,13 +30,6 @@ class Stream::Aspect < Stream::Base end.call end - # Maps ids into an array from #aspects - # - # @return [Array] Aspect ids - def aspect_ids - @aspect_ids ||= aspects.map { |a| a.id } - end - # @return [ActiveRecord::Association] AR association of posts def posts # NOTE(this should be something like Post.all_for_stream(@user, aspect_ids, {}) that calls visible_shareables @@ -84,7 +77,7 @@ class Stream::Aspect < Stream::Base # # @return [Boolean] def for_all_aspects? - @all_aspects ||= aspect_ids.length == user.aspects.size + @all_aspects ||= aspects.size == user.aspects.size end # This is perfomance optimization, as everyone in your aspect stream you have @@ -95,4 +88,10 @@ class Stream::Aspect < Stream::Base def can_comment?(post) true end + + private + + def aspect_ids + @aspect_ids ||= aspects.map(&:id) + end end diff --git a/lib/stream/base.rb b/lib/stream/base.rb index 9e45666e3..30ac2f92c 100644 --- a/lib/stream/base.rb +++ b/lib/stream/base.rb @@ -67,10 +67,6 @@ class Stream::Base aspects.first end - def aspect_ids - aspects.map {|x| x.try(:id) } - end - def max_time=(time_string) @max_time = Time.at(time_string.to_i) unless time_string.blank? @max_time ||= (Time.now + 1) -- cgit v1.2.3