Sha256: 8e7a597b15fbe73b3b8efd49755336fd53ae93bc2c069c9635ff52c4891fc195
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module Federails class Activity < ApplicationRecord belongs_to :entity, polymorphic: true belongs_to :actor scope :feed_for, lambda { |actor| actor_ids = [] Following.accepted.where(actor: actor).find_each do |following| actor_ids << following.target_actor_id end where(actor_id: actor_ids) } after_create_commit :post_to_inboxes def recipients # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity return [] unless actor.local? actors = [] case action when 'Create' actors.push(entity.target_actor) if entity_type == 'Federails::Following' # FIXME: Move this to dummy, somehow actors.push(*actor.followers) if entity_type == 'Note' when 'Accept' actors.push(entity.actor) if entity_type == 'Federails::Following' when 'Undo' actors.push(entity.target_actor) if entity_type == 'Federails::Following' end actors end private def post_to_inboxes NotifyInboxJob.perform_later(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
federails-0.1.0 | app/models/federails/activity.rb |