Permalink
Browse files

Walls improved to filter by by object_type

  • Loading branch information...
1 parent c251b93 commit abbcfa637b3619b00762407c114f5a5fd2ad9855 @VictorSB VictorSB committed Jun 20, 2011
Showing with 8 additions and 4 deletions.
  1. +5 −1 app/models/activity.rb
  2. +1 −1 app/models/actor.rb
  3. +2 −2 lib/social_stream-base.rb
View
@@ -30,12 +30,16 @@ class Activity < ActiveRecord::Base
has_many :activity_objects,
:through => :activity_object_activities
- scope :wall, lambda { |type, ties|
+ scope :wall, lambda { |type, ties, options|
q = select("DISTINCT activities.*").
roots.
joins(:tie_activities).
where('tie_activities.tie_id' => ties).
order("created_at desc")
+
+ if options[:object_type].present?
+ q = q.joins(:activity_objects).where('activity_objects.object_type' => options[:object_type])
+ end
# Profile wall is composed by original TieActivities. Not original are copies for followers
if type == :profile
View
@@ -397,7 +397,7 @@ def wall(type, options = {})
ts = ts.related_by(Relation.normalize(options[:relation], :sender => self))
end
- Activity.wall type, ts.all
+ Activity.wall type, ts.all, options
end
def logo
@@ -62,8 +62,8 @@ module TestHelpers
@@objects = [ :post, :comment ]
mattr_accessor :activity_forms
- #@@activity_forms = [:attachment]
- @@activity_forms = []
+ @@activity_forms = [:attachment]
+ #@@activity_forms = []
class << self
def setup

0 comments on commit abbcfa6

Please sign in to comment.