Class: UserUnfollowEventJob

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

Overview

A specific job to log a user unfollowing 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(unfollower_id, unfollowee_id) ⇒ UserUnfollowEventJob

Returns a new instance of UserUnfollowEventJob.



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

def initialize(unfollower_id, unfollowee_id)
  super(unfollower_id)
  @unfollowee_id = unfollowee_id
end

Instance Attribute Details

#unfollowee_idObject

Returns the value of attribute unfollowee_id.



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

def unfollowee_id
  @unfollowee_id
end

Instance Method Details

#actionObject



17
18
19
# File 'app/jobs/user_unfollow_event_job.rb', line 17

def action
  @action ||= "User #{link_to_profile unfollower_id} has unfollowed #{link_to_profile unfollowee_id}"
end

#runObject



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

def run
  super
  unfollowee = User.find_by_user_key(unfollowee_id)
  unfollowee.log_event(event)
end