base/app/models/actor.rb in social_stream-0.25.1 vs base/app/models/actor.rb in social_stream-0.25.2

- old
+ new

@@ -80,10 +80,14 @@ :dependent => :destroy has_many :sent_actions, :class_name => "ActivityAction", :dependent => :destroy + has_many :followings, + :through => :sent_actions, + :source => :activity_object, + :conditions => { 'activity_actions.follow' => true } scope :alphabetic, order('actors.name') scope :letter, lambda { |param| if param.present? @@ -291,9 +295,24 @@ def self_contact contact_to!(self) end alias_method :ego_contact, :self_contact + + # The {ActivityObject ActivityObjects} followed by this {Actor} + # that are {Actor Actors} + def following_actor_objects + followings. + where('activity_objects.object_type' => "Actor") + end + + # An array with the ids of {Actor Actors} followed by this {Actor} + def following_actor_ids + following_actor_objects. + includes(:actor). + map(&:actor). + map(&:id) + end # The {Channel} of this {Actor} to self (totally close!) def self_channel Channel.find_or_create_by_author_id_and_user_author_id_and_owner_id id, id, id end