Class: Comment
Constant Summary
ApplicationRecord::SAFE_NAME_LENGTH
Class Method Summary
collapse
Instance Method Summary
collapse
#to_param
find_param
Class Method Details
.from_activitypub_object(note) ⇒ Object
36
37
38
39
40
|
# File 'app/models/comment.rb', line 36
def self.from_activitypub_object(note)
ActivityPub::.new(note).send :deserialize
rescue ActiveRecord::RecordNotFound
{}
end
|
.handle_federated_object?(note) ⇒ Boolean
32
33
34
|
# File 'app/models/comment.rb', line 32
def self.handle_federated_object?(note)
ActivityPub::.can_handle?(note)
end
|
Instance Method Details
#federate? ⇒ Boolean
20
21
22
|
# File 'app/models/comment.rb', line 20
def federate?
ActivityPub::.new(self).federate?
end
|
#federated_delete ⇒ Object
42
43
44
|
# File 'app/models/comment.rb', line 42
def federated_delete
destroy
end
|
#name ⇒ Object
28
29
30
|
# File 'app/models/comment.rb', line 28
def name
"#{created_at} @ #{commentable.name}"
end
|
#on_new_quote_request(quote_authorization) ⇒ Object
46
47
48
49
|
# File 'app/models/comment.rb', line 46
def on_new_quote_request(quote_authorization)
system ? quote_authorization.accept! : quote_authorization.reject!
end
|
#public? ⇒ Boolean
24
25
26
|
# File 'app/models/comment.rb', line 24
def public?
(!&.local? || &.public?) && &.public?
end
|
#to_activitypub_object ⇒ Object
16
17
18
|
# File 'app/models/comment.rb', line 16
def to_activitypub_object
ActivityPub::.new(self).serialize
end
|