Skip to content

Commit

Permalink
Walls improved to filter by by object_type
Browse files Browse the repository at this point in the history
  • Loading branch information
VSBDev committed Jun 20, 2011
1 parent c251b93 commit abbcfa6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion app/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/actor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/social_stream-base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit abbcfa6

Please sign in to comment.