Sha256: ec2e5a25ff60940d51a8771275615a3f337b33636856e4f06593b29c87489ebd
Contents?: true
Size: 750 Bytes
Versions: 3
Compression:
Stored size: 750 Bytes
Contents
module Federails class Activity < ApplicationRecord include Federails::HasUuid 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 return [] unless actor.local? case entity_type when 'Federails::Following' [(action == 'Accept' ? entity.actor : entity.target_actor)] else actor.followers end end private def post_to_inboxes NotifyInboxJob.perform_later(self) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
federails-0.4.0 | app/models/federails/activity.rb |
federails-0.3.0 | app/models/federails/activity.rb |
federails-0.2.0 | app/models/federails/activity.rb |