Files
manyfold/app/models/comment.rb
T
2025-01-28 14:55:06 +00:00

24 lines
609 B
Ruby

require "federails/data_transformer/note"
class Comment < ApplicationRecord
include PublicIDable
belongs_to :commenter, polymorphic: true, optional: true
belongs_to :commentable, polymorphic: true
include Federails::DataEntity
acts_as_federails_data handles: "Note", actor_entity_method: :commenter, url_param: :public_id, should_federate_method: :federate?
def to_activitypub_object
ActivityPub::CommentSerializer.new(self).serialize
end
def federate?
ActivityPub::CommentSerializer.new(self).federate?
end
def public?
commenter.public? && commentable.public?
end
end