Class: Federails::Following
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Federails::Following
- Includes:
- HasUuid
- Defined in:
- app/models/federails/following.rb
Overview
Stores following data between actors
Class Method Summary collapse
Instance Method Summary collapse
Methods included from HasUuid
Class Method Details
.new_from_account(account, actor:) ⇒ Object
39 40 41 42 |
# File 'app/models/federails/following.rb', line 39 def new_from_account(account, actor:) target_actor = Actor.find_or_create_by_account account new actor: actor, target_actor: target_actor end |
Instance Method Details
#accept! ⇒ Object
29 30 31 32 |
# File 'app/models/federails/following.rb', line 29 def accept! update! status: :accepted Activity.create! actor: target_actor, action: 'Accept', entity: self end |
#federated_url ⇒ Object
25 26 27 |
# File 'app/models/federails/following.rb', line 25 def federated_url attributes['federated_url'].presence || Federails::Engine.routes.url_helpers.server_actor_following_url(actor_id: actor.to_param, id: to_param) end |
#follow_activity ⇒ Object
34 35 36 |
# File 'app/models/federails/following.rb', line 34 def follow_activity Activity.find_by actor: actor, action: 'Follow', entity: target_actor end |