Class: ContentDeleteEventJob

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

Overview

A specific job to log a file deletion 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, #queue_name, #run

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(deleted_file_id, depositor_id) ⇒ ContentDeleteEventJob

Returns a new instance of ContentDeleteEventJob.



7
8
9
10
# File 'app/jobs/content_delete_event_job.rb', line 7

def initialize(deleted_file_id, depositor_id)
  super(depositor_id)
  @deleted_file_id = deleted_file_id
end

Instance Attribute Details

#deleted_file_idObject (readonly)

The id of the file that has been deleted by the user

Returns:

  • (Object)

    the current value of deleted_file_id



4
5
6
# File 'app/jobs/content_delete_event_job.rb', line 4

def deleted_file_id
  @deleted_file_id
end

Instance Method Details

#actionObject



12
13
14
# File 'app/jobs/content_delete_event_job.rb', line 12

def action
  @action ||= "User #{link_to_profile depositor_id} has deleted file '#{deleted_file_id}'"
end

#log_user_eventObject

override to log the event to the users profile stream instead of the user’s stream



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

def log_user_event
  depositor.log_profile_event(event)
end