diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2017-12-25 02:13:24 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2017-12-25 22:54:10 +0300 |
commit | e0eb76eb2a94c1e389b6fe5bfc68f0e7bf4a92ed (patch) | |
tree | 0d2f65c38b7bb91ea2b2417798e5c8d239794a5f /lib | |
parent | 70c659192fca93340a07d3c7e2a7dade492ad4d6 (diff) |
Remove aspect_ids parameter from publisher
closes #7683
Diffstat (limited to 'lib')
-rw-r--r-- | lib/stream/aspect.rb | 15 | ||||
-rw-r--r-- | lib/stream/base.rb | 4 |
2 files changed, 7 insertions, 12 deletions
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<Integer>] Aspect ids - def aspect_ids - @aspect_ids ||= aspects.map { |a| a.id } - end - # @return [ActiveRecord::Association<Post>] 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) |