Sha256: 901b112d735866c09e2271ec92a9196e87f08cdb6a22167f4f21831f54c9a3d3

Contents?: true

Size: 820 Bytes

Versions: 36

Compression:

Stored size: 820 Bytes

Contents

class UserUnfollowEventJob < EventJob
  attr_accessor :unfollower_id, :unfollowee_id

  def initialize(unfollower_id, unfollowee_id)
    self.unfollower_id = unfollower_id
    self.unfollowee_id = unfollowee_id
  end
  def run
    action = "User #{link_to_profile unfollower_id} has unfollowed #{link_to_profile unfollowee_id}"
    timestamp = Time.now.to_i
    unfollower = User.find_by_user_key(unfollower_id)
    # Create the event
    event = unfollower.create_event(action, timestamp)
    # Log the event to the unfollower's stream
    unfollower.log_event(event)
    # Fan out the event to unfollowee
    unfollowee = User.find_by_user_key(unfollowee_id)
    unfollowee.log_event(event)
    # Fan out the event to all followers
    unfollower.followers.each do |user|
      user.log_event(event)
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

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