Sha256: f198efdbd7441e93656b750479165512b0256cb70a51b79b6b33e8b1ee994a31

Contents?: true

Size: 818 Bytes

Versions: 8

Compression:

Stored size: 818 Bytes

Contents

# A generic job for sending events about repository objects to a user and their followers.
#
# @attr [String] repo_object the object event is specified for
#
class ContentEventJob < EventJob
  attr_reader :repo_object
  def perform(repo_object, depositor)
    @repo_object = repo_object
    super(depositor)
    log_event(repo_object)
  end

  # Log the event to the object's stream
  def log_event(repo_object)
    repo_object.log_event(event)
  end

  # override to check file permissions before logging to followers
  def log_to_followers(depositor)
    depositor.followers.select { |user| user.can?(:read, repo_object) }.each do |follower|
      follower.log_event(event)
    end
  end

  # log the event to the users profile stream
  def log_user_event(depositor)
    depositor.log_profile_event(event)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-7.1.0 app/jobs/content_event_job.rb
sufia-7.0.0 app/jobs/content_event_job.rb
sufia-7.0.0.rc2 app/jobs/content_event_job.rb
sufia-7.0.0.rc1 app/jobs/content_event_job.rb
sufia-7.0.0.beta4 app/jobs/content_event_job.rb
sufia-7.0.0.beta3 app/jobs/content_event_job.rb
sufia-7.0.0.beta2 app/jobs/content_event_job.rb
sufia-7.0.0.beta1 app/jobs/content_event_job.rb