Sha256: 23c1c3fe32f71c5c435fc36997b6ba506ff1380fa805e952779382783592402d

Contents?: true

Size: 961 Bytes

Versions: 13

Compression:

Stored size: 961 Bytes

Contents

module Curate
  class ContentDepositEventJob
    include Rails.application.routes.url_helpers
    include ActionView::Helpers
    include ActionView::Helpers::DateHelper
    include Hydra::AccessControlsEnforcement
  
    def queue_name
      :event
    end
  
    attr_accessor :generic_file_id, :depositor_id
  
    def initialize(generic_file_id, depositor_id)
      self.generic_file_id = generic_file_id
      self.depositor_id = depositor_id
    end
  
    def run
      gf = GenericFile.find(generic_file_id)
      action = "User #{depositor_id} has deposited #{gf.title} (#{gf.noid})"
      timestamp = Time.now.to_i
      depositor = ::User.find_by_user_key(depositor_id)
  
      event = depositor.create_event(action, timestamp)
  
      depositor.log_profile_event(event)
  
      gf.log_event(event)
  
      depositor.followers.select { |user| user.can? :read, gf }.each do |follower|
        follower.log_event(event)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curate-0.6.6 lib/curate/jobs/content_deposit_event_job.rb
curate-0.6.5 lib/curate/jobs/content_deposit_event_job.rb
curate-0.6.4 lib/curate/jobs/content_deposit_event_job.rb
curate-0.6.3 lib/curate/jobs/content_deposit_event_job.rb
curate-0.6.1 lib/curate/jobs/content_deposit_event_job.rb
curate-0.6.0 lib/curate/jobs/content_deposit_event_job.rb
curate-0.5.6 lib/curate/jobs/content_deposit_event_job.rb
curate-0.5.5 lib/curate/jobs/content_deposit_event_job.rb
curate-0.5.4 lib/curate/jobs/content_deposit_event_job.rb
curate-0.5.2 lib/curate/jobs/content_deposit_event_job.rb
curate-0.5.1 lib/curate/jobs/content_deposit_event_job.rb
curate-0.5.0 lib/curate/jobs/content_deposit_event_job.rb
curate-0.4.2 lib/curate/jobs/content_deposit_event_job.rb