Class: UserFollowEventJob

Inherits:
EventJob show all
Defined in:
app/jobs/user_follow_event_job.rb

Overview

A specific job to log a user following another user to a user’s activity stream

Instance Attribute Summary collapse

Attributes inherited from EventJob

#depositor_id

Instance Method Summary collapse

Methods inherited from EventJob

#depositor, #event, #log_to_followers, #log_user_event, #queue_name

Methods included from Sufia::SufiaHelperBehavior

#current_search_parameters, #display_user_name, #error_messages_for, #has_collection_search_parameters?, #iconify_auto_link, #iconify_link, #is_url?, #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, #orcid_label, #render_visibility_label, #render_visibility_link, #search_form_action, #show_transfer_request_title, #sufia_thumbnail_tag, #user_display_name_and_key, #zotero_label, #zotero_profile_url

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.



6
7
8
9
# File 'app/jobs/user_follow_event_job.rb', line 6

def initialize(follower_id, followee_id)
  super(follower_id)
  @followee_id = followee_id
end

Instance Attribute Details

#followee_idObject

Returns the value of attribute followee_id.



3
4
5
# File 'app/jobs/user_follow_event_job.rb', line 3

def followee_id
  @followee_id
end

Instance Method Details

#actionObject



18
19
20
# File 'app/jobs/user_follow_event_job.rb', line 18

def action
  @action ||= "User #{link_to_profile follower_id} is now following #{link_to_profile followee_id}"
end

#runObject



11
12
13
14
15
16
# File 'app/jobs/user_follow_event_job.rb', line 11

def run
  super
  # Fan out the event to followee
  followee = User.find_by_user_key(followee_id)
  followee.log_event(event)
end