Class: ContentDepositorChangeEventJob

Inherits:
ContentEventJob show all
Includes:
ActionDispatch::Routing::PolymorphicRoutes
Defined in:
app/jobs/content_depositor_change_event_job.rb

Overview

Log work depositor change to activity streams

Constant Summary

Constants included from Sufia::CitationsBehaviors::TitleBehavior

Sufia::CitationsBehaviors::TitleBehavior::EXPANDED_NOCAPS, Sufia::CitationsBehaviors::TitleBehavior::TITLE_NOCAPS

Instance Attribute Summary collapse

Attributes inherited from ContentEventJob

#repo_object

Attributes inherited from EventJob

#depositor

Instance Method Summary collapse

Methods inherited from ContentEventJob

#log_event

Methods inherited from EventJob

#event

Methods included from Sufia::SufiaHelperBehavior

#application_name, #banner_image, #browser_supports_directory_upload?, #collection_thumbnail, #current_search_parameters, #error_messages_for, #has_collection_search_parameters?, #human_readable_date, #iconify_auto_link, #index_field_link, #institution_name, #institution_name_full, #license_links, #link_to_each_facet_field, #link_to_facet, #link_to_facet_list, #link_to_field, #link_to_profile, #link_to_telephone, #orcid_label, #render_visibility_link, #rights_statement_links, #search_form_action, #show_transfer_request_title, #user_display_name_and_key, #zotero_label, #zotero_profile_url

Methods included from Sufia::CitationsBehavior

#export_as_apa_citation, #export_as_chicago_citation, #export_as_mla_citation, #export_as_openurl_ctx_kev

Methods included from Sufia::CitationsBehaviors::TitleBehavior

#chicago_citation_title, #mla_citation_title, #process_title_parts, #setup_title_info

Methods included from Sufia::CitationsBehaviors::CommonBehavior

#clean_end_punctuation, #persistent_url

Methods included from Sufia::CitationsBehaviors::NameBehavior

#abbreviate_name, #all_authors, #author_list, #given_name_first, #surname_first

Methods included from Sufia::CitationsBehaviors::PublicationBehavior

#setup_pub_date, #setup_pub_info, #setup_pub_place, #setup_pub_publisher

Methods included from Sufia::BlacklightOverride

#fields_to_exclude_from_constraint_element

Instance Attribute Details

#resetBoolean

(false) should the access controls be reset. This means revoking edit access from the depositor

Returns:

  • (Boolean)

    the current value of reset



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

def reset
  @reset
end

Instance Method Details

#actionObject



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

def action
  "User #{link_to_profile work.proxy_depositor} has transferred #{link_to_work work.title.first} to user #{link_to_profile depositor}"
end


22
23
24
# File 'app/jobs/content_depositor_change_event_job.rb', line 22

def link_to_work(text)
  link_to text, polymorphic_path(work)
end

#log_user_event(depositor) ⇒ Object

overriding default to log the event to the depositor instead of their profile



37
38
39
40
41
# File 'app/jobs/content_depositor_change_event_job.rb', line 37

def log_user_event(depositor)
  # log the event to the proxy depositor's profile
  proxy_depositor.log_profile_event(event)
  depositor.log_event(event)
end

#log_work_event(work) ⇒ Object Also known as: log_file_set_event

Log the event to the work’s stream



27
28
29
# File 'app/jobs/content_depositor_change_event_job.rb', line 27

def log_work_event(work)
  work.log_event(event)
end

#perform(work, user, reset = false) ⇒ Object

Parameters:

  • work (ActiveFedora::Base)

    the work to be transfered

  • user (User)

    the user the work is being transfered to.

  • reset (TrueClass, FalseClass) (defaults to: false)

    (false) if true, reset the access controls. This revokes edit access from the depositor



13
14
15
16
# File 'app/jobs/content_depositor_change_event_job.rb', line 13

def perform(work, user, reset = false)
  @reset = reset
  super(work, user)
end

#proxy_depositorObject



43
44
45
# File 'app/jobs/content_depositor_change_event_job.rb', line 43

def proxy_depositor
  @proxy_depositor ||= ::User.find_by_user_key(work.proxy_depositor)
end

#workObject



32
33
34
# File 'app/jobs/content_depositor_change_event_job.rb', line 32

def work
  @work ||= Sufia::ChangeContentDepositorService.call(repo_object, depositor, reset)
end