Class: ActivityPub::CommentDeserializer

Inherits:
ApplicationDeserializer show all
Defined in:
app/deserializers/activity_pub/comment_deserializer.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationDeserializer

deserializer_for, #update!

Constructor Details

#initialize(object) ⇒ CommentDeserializer

Returns a new instance of CommentDeserializer.



3
4
5
6
# File 'app/deserializers/activity_pub/comment_deserializer.rb', line 3

def initialize(object)
  super
  @sanitizer = Rails::HTML5::FullSanitizer.new
end

Class Method Details

.can_handle?(object) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'app/deserializers/activity_pub/comment_deserializer.rb', line 8

def self.can_handle?(object)
  return false unless object["type"] == "Note"
  return false if object["f3di:compatibilityNote"] == "true"
  return false if object["inReplyTo"].blank?
  true
end

Instance Method Details

#create! ⇒ Object



15
16
17
# File 'app/deserializers/activity_pub/comment_deserializer.rb', line 15

def create!
  Comment.create!(deserialize)
end