Class: Collection
Constant Summary
Constants included
from Talkative
Talkative::TIMEOUT
FederailsCommon::FEDIVERSE_USERNAMES
ApplicationRecord::SAFE_NAME_LENGTH
Instance Method Summary
collapse
Methods included from Indexable
#ai_indexable?, #indexable?, #inherited_ai_indexable?, #inherited_indexable?, #public_and_indexable?
#to_param
#just_became_public?, #matching_permission_preset, #owners, #private?, #public?, #set_default_permission_preset, #set_owner, #set_permissions_from_preset, #will_be_public?
Methods included from Talkative
#owning_actor
Methods included from Followable
#followed_by?, #followers
#federails_actor, #local?, #remote?
find_param
Instance Method Details
#after_create ⇒ Object
76
77
78
|
# File 'app/models/collection.rb', line 76
def after_create
Activity::CollectionPublishedJob.set(wait: 5.seconds).perform_later(id) if public?
end
|
#after_update ⇒ Object
80
81
82
|
# File 'app/models/collection.rb', line 80
def after_update
Activity::CollectionPublishedJob.set(wait: 5.seconds).perform_later(id) if just_became_public?
end
|
#fasp_uri ⇒ Object
53
54
55
|
# File 'app/models/collection.rb', line 53
def fasp_uri
federails_actor&.federated_url
end
|
#name_with_domain ⇒ Object
57
58
59
|
# File 'app/models/collection.rb', line 57
def name_with_domain
remote? ? name + " (#{federails_actor.server})" : name
end
|
#publish_creator ⇒ Object
95
96
97
|
# File 'app/models/collection.rb', line 95
def publish_creator
creator&.update!(caber_relations_attributes: [{permission: "view", subject: nil}]) unless creator&.public?
end
|
#to_activitypub_object ⇒ Object
#validate_publishable ⇒ Object
84
85
86
87
88
89
90
91
92
93
|
# File 'app/models/collection.rb', line 84
def validate_publishable
if caber_relations.find { it.subject.nil? }
errors.add :creator, :private if creator && !creator.public?
errors.add :collection, :private if collection && !collection.public?
end
end
|