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 Hyrax::CitationsBehaviors::TitleBehavior

Hyrax::CitationsBehaviors::TitleBehavior::EXPANDED_NOCAPS, Hyrax::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 Hyrax::HyraxHelperBehavior

#available_translations, #available_user_groups, #banner_image, #collection_thumbnail, #collection_title_by_id, #current_search_parameters, #human_readable_date, #iconify_auto_link, #index_field_link, #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_notifications, #rights_statement_links, #search_form_action, #show_transfer_request_title, #suppressed_to_status, #thumbnail_label_for, #user_display_name_and_key, #zotero_label, #zotero_profile_url

Methods included from Hyrax::WorkflowsHelper

#workflow_restriction?

Methods included from Hyrax::WorkFormHelper

#admin_set_options, #form_file_set_select_for, #form_progress_sections_for, #form_tab_label_for, #form_tabs_for

Methods included from Hyrax::PermissionLevelsHelper

#configured_owner_permission_levels, #configured_permission_levels, #configured_permission_options

Methods included from Hyrax::MembershipHelper

#member_of_collections_json, #work_members_json

Methods included from Hyrax::IiifHelper

#iiif_viewer_display, #iiif_viewer_display_partial, #universal_viewer_base_url, #universal_viewer_config_url

Methods included from Hyrax::DashboardHelperBehavior

#number_of_collections, #number_of_files, #number_of_works, #on_the_dashboard?

Methods included from Hyrax::ChartsHelper

#hash_to_chart

Methods included from Hyrax::CollectionsHelper

#append_collection_type_url, #available_child_collections, #available_parent_collections_data, #button_for_remove_from_collection, #button_for_remove_selected_from_collection, #collection_brandable?, #collection_discoverable?, #collection_member_sort_fields, #collection_metadata_label, #collection_metadata_value, #collection_permission_template_form_for, #collection_search_parameters?, #collection_sharable?, #collection_type_label, #collection_type_label_for, #has_collection_search_parameters?, #present_terms, #render_collection_links, #render_other_collection_links, #single_item_action_remove_form_fields

Methods included from Hyrax::LeaseHelper

#assets_under_lease, #assets_with_deactivated_leases, #assets_with_expired_leases, #lease_enforced?, #lease_history

Methods included from Hyrax::EmbargoHelper

#assets_under_embargo, #assets_with_deactivated_embargoes, #assets_with_expired_embargoes, #embargo_enforced?, #embargo_history

Methods included from Hyrax::AbilityHelper

#render_visibility_link, #visibility_badge, #visibility_options

Methods included from Hyrax::FileSetHelper

#display_media_download_link?, #media_display, #media_display_partial, #parent_path

Methods included from Hyrax::TitleHelper

#application_name, #construct_page_title, #curation_concern_page_title, #default_page_title, #title_presenter

Methods included from Hyrax::ContactFormHelper

#contact_form_issue_type_options

Methods included from Hyrax::CitationsBehavior

#export_as_apa_citation, #export_as_chicago_citation, #export_as_mla_citation, #export_as_openurl_ctx_kev

Methods included from Hyrax::CitationsBehaviors::TitleBehavior

#chicago_citation_title, #mla_citation_title, #process_title_parts, #setup_title_info

Methods included from Hyrax::CitationsBehaviors::CommonBehavior

#clean_end_punctuation, #persistent_url

Methods included from Hyrax::CitationsBehaviors::NameBehavior

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

Methods included from Hyrax::CitationsBehaviors::PublicationBehavior

#setup_pub_date, #setup_pub_info, #setup_pub_place, #setup_pub_publisher

Methods included from Hyrax::BlacklightOverride

#application_name

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



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

def reset
  @reset
end

Instance Method Details

#actionObject



20
21
22
# File 'app/jobs/content_depositor_change_event_job.rb', line 20

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


24
25
26
# File 'app/jobs/content_depositor_change_event_job.rb', line 24

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



39
40
41
42
43
# File 'app/jobs/content_depositor_change_event_job.rb', line 39

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



29
30
31
# File 'app/jobs/content_depositor_change_event_job.rb', line 29

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

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

Parameters:

  • work (ActiveFedora::Base, Hyrax::Work)

    the work to be transferred

  • 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



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

def perform(work, user, reset = false)
  Deprecation.warn("This class will be removed in the next major release. Use Hyrax::ChangeDepositorService.call instead.")
  @reset = reset
  super(work, user)
end

#proxy_depositorObject



45
46
47
# File 'app/jobs/content_depositor_change_event_job.rb', line 45

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

#workObject



34
35
36
# File 'app/jobs/content_depositor_change_event_job.rb', line 34

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