Skip to content

Commit

Permalink
Merge pull request #3498 from manyfold3d/rename-to-serializers
Browse files Browse the repository at this point in the history
Rename ActivityPub presenters to serializers
  • Loading branch information
Floppy authored Jan 28, 2025
2 parents 0a66ed9 + 49056f2 commit 8afa625
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class Comment < ApplicationRecord
acts_as_federails_data handles: "Note", actor_entity_method: :commenter, url_param: :public_id, should_federate_method: :federate?

def to_activitypub_object
ActivityPub::CommentPresenter.new(self).present!
ActivityPub::CommentSerializer.new(self).serialize
end

def federate?
ActivityPub::CommentPresenter.new(self).federate?
ActivityPub::CommentSerializer.new(self).federate?
end

def public?
Expand Down
2 changes: 1 addition & 1 deletion app/models/creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ def self.create_from_activitypub_object(actor)
end

def to_activitypub_object
ActivityPub::CreatorPresenter.new(self).present!
ActivityPub::CreatorSerializer.new(self).serialize
end
end
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module ActivityPub
class BasePresenter
class BaseSerializer
PUBLIC_COLLECTION = "https://www.w3.org/ns/activitystreams#Public"

def initialize(object)
@object = object
end

def present!
def serialize
raise NotImplementedError
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ActivityPub
class CommentPresenter < BasePresenter
def present!
class CommentSerializer < BaseSerializer
def serialize
Federails::DataTransformer::Note.to_federation(
@object,
content: to_html,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ActivityPub
class CreatorPresenter < BasePresenter
def present!
class CreatorSerializer < BaseSerializer
def serialize
{
"@context": {
f3di: "http://purl.org/f3di/ns#",
Expand Down

0 comments on commit 8afa625

Please sign in to comment.