Class: UserFollowEventJob
- Defined in:
- app/jobs/user_follow_event_job.rb
Instance Attribute Summary collapse
-
#followee_id ⇒ Object
Returns the value of attribute followee_id.
-
#follower_id ⇒ Object
Returns the value of attribute follower_id.
Attributes inherited from EventJob
#depositor_id, #generic_file_id
Instance Method Summary collapse
-
#initialize(follower_id, followee_id) ⇒ UserFollowEventJob
constructor
A new instance of UserFollowEventJob.
- #run ⇒ Object
Methods inherited from EventJob
Methods included from Sufia::SufiaHelperBehavior
#current_search_parameters, #display_user_name, #error_messages_for, #has_collection_search_parameters?, #iconify_auto_link, #link_back_to_dashboard, #link_to_dashboard_query, #link_to_facet, #link_to_facet_list, #link_to_field, #link_to_profile, #link_to_telephone, #linkify_chat_id, #number_of_deposits, #render_visibility_label, #render_visibility_link, #search_form_action, #show_transfer_request_title, #sufia_thumbnail_tag
Methods included from Sufia::BlacklightOverride
#render_bookmarks_control?, #render_constraints_query, #url_for_document
Constructor Details
#initialize(follower_id, followee_id) ⇒ UserFollowEventJob
Returns a new instance of UserFollowEventJob.
4 5 6 7 |
# File 'app/jobs/user_follow_event_job.rb', line 4 def initialize(follower_id, followee_id) self.follower_id = follower_id self.followee_id = followee_id end |
Instance Attribute Details
#followee_id ⇒ Object
Returns the value of attribute followee_id.
2 3 4 |
# File 'app/jobs/user_follow_event_job.rb', line 2 def followee_id @followee_id end |
#follower_id ⇒ Object
Returns the value of attribute follower_id.
2 3 4 |
# File 'app/jobs/user_follow_event_job.rb', line 2 def follower_id @follower_id end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/jobs/user_follow_event_job.rb', line 9 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 |