Sha256: 3be066b572f6b620629761bdabc163835e6324d56ef57bc714d8375f6b4b3806

Contents?: true

Size: 735 Bytes

Versions: 37

Compression:

Stored size: 735 Bytes

Contents

class UserFollowEventJob < EventJob
  attr_accessor :follower_id, :followee_id

  def initialize(follower_id, followee_id)
    self.follower_id = follower_id
    self.followee_id = followee_id
  end

  def run
    # Create the event
    follower = User.find_by_user_key(follower_id)
    event = follower.create_event("User #{link_to_profile follower_id} is now following #{link_to_profile followee_id}", Time.now.to_i)
    # Log the event to the follower's stream
    follower.log_event(event)
    # Fan out the event to followee
    followee = User.find_by_user_key(followee_id)
    followee.log_event(event)
    # Fan out the event to all followers
    follower.followers.each do |user|
      user.log_event(event)
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
sufia-6.3.0 app/jobs/user_follow_event_job.rb
sufia-6.2.0 app/jobs/user_follow_event_job.rb
sufia-6.1.0 app/jobs/user_follow_event_job.rb
sufia-5.0.0 app/jobs/user_follow_event_job.rb
sufia-6.0.0 app/jobs/user_follow_event_job.rb
sufia-6.0.0.rc4 app/jobs/user_follow_event_job.rb
sufia-6.0.0.rc3 app/jobs/user_follow_event_job.rb
sufia-5.0.0.rc1 app/jobs/user_follow_event_job.rb
sufia-6.0.0.rc2 app/jobs/user_follow_event_job.rb
sufia-6.0.0.rc1 app/jobs/user_follow_event_job.rb
sufia-4.3.1 app/jobs/user_follow_event_job.rb
sufia-6.0.0.beta1 app/jobs/user_follow_event_job.rb
sufia-4.2.0 app/jobs/user_follow_event_job.rb
sufia-4.1.0 app/jobs/user_follow_event_job.rb
sufia-4.0.1 app/jobs/user_follow_event_job.rb
sufia-4.0.0 app/jobs/user_follow_event_job.rb
sufia-4.0.0.rc2 app/jobs/user_follow_event_job.rb
sufia-4.0.0.rc1 app/jobs/user_follow_event_job.rb
sufia-4.0.0.beta4 app/jobs/user_follow_event_job.rb
sufia-4.0.0.beta3 app/jobs/user_follow_event_job.rb