Sha256: 1d1935070666d76ff2617ec68a48ecef642d9942d7be967ca45554bba9f7beae

Contents?: true

Size: 876 Bytes

Versions: 22

Compression:

Stored size: 876 Bytes

Contents

# frozen_string_literal: true
# Log a fileset attachment to activity streams
class FileSetAttachedEventJob < ContentEventJob
  # Log the event to the fileset's and its container's streams
  def log_event(repo_object)
    repo_object.log_event(event)
    curation_concern.log_event(event)
  end

  def action
    "User #{link_to_profile depositor} has attached #{file_link} to #{work_link}"
  end

  private

  def file_link
    link_to file_title, polymorphic_path(repo_object)
  end

  def work_link
    link_to work_title, polymorphic_path(curation_concern)
  end

  def file_title
    repo_object.title.first
  end

  def work_title
    curation_concern.title.first
  end

  def curation_concern
    case repo_object
    when ActiveFedora::Base
      repo_object.in_works.first
    else
      Hyrax.query_service.find_parents(resource: repo_object).first
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/jobs/file_set_attached_event_job.rb
hyrax-5.0.0 app/jobs/file_set_attached_event_job.rb
hyrax-5.0.0.rc3 app/jobs/file_set_attached_event_job.rb
hyrax-5.0.0.rc2 app/jobs/file_set_attached_event_job.rb
hyrax-5.0.0.rc1 app/jobs/file_set_attached_event_job.rb
hyrax-3.6.0 app/jobs/file_set_attached_event_job.rb
hyrax-4.0.0 app/jobs/file_set_attached_event_job.rb
hyrax-4.0.0.rc3 app/jobs/file_set_attached_event_job.rb
hyrax-4.0.0.rc2 app/jobs/file_set_attached_event_job.rb
hyrax-4.0.0.rc1 app/jobs/file_set_attached_event_job.rb
hyrax-3.5.0 app/jobs/file_set_attached_event_job.rb
hyrax-4.0.0.beta2 app/jobs/file_set_attached_event_job.rb
hyrax-3.4.2 app/jobs/file_set_attached_event_job.rb
hyrax-4.0.0.beta1 app/jobs/file_set_attached_event_job.rb
hyrax-3.4.1 app/jobs/file_set_attached_event_job.rb
hyrax-3.4.0 app/jobs/file_set_attached_event_job.rb
hyrax-3.3.0 app/jobs/file_set_attached_event_job.rb
hyrax-3.2.0 app/jobs/file_set_attached_event_job.rb
hyrax-3.1.0 app/jobs/file_set_attached_event_job.rb
hyrax-3.0.2 app/jobs/file_set_attached_event_job.rb