@@ -10,8 +10,6 @@ defmodule Mobilizon.Service.ActivityPub.Converters.Comment do
|
||||
alias Mobilizon.Events.Event
|
||||
alias Mobilizon.Service.ActivityPub.Converter
|
||||
alias Mobilizon.Service.ActivityPub
|
||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||
alias MobilizonWeb.Endpoint
|
||||
require Logger
|
||||
|
||||
@behaviour Converter
|
||||
|
||||
29
lib/service/activity_pub/converters/participant.ex
Normal file
29
lib/service/activity_pub/converters/participant.ex
Normal file
@@ -0,0 +1,29 @@
|
||||
defmodule Mobilizon.Service.ActivityPub.Converters.Participant do
|
||||
@moduledoc """
|
||||
Flag converter
|
||||
|
||||
This module allows to convert reports from ActivityStream format to our own internal one, and back.
|
||||
|
||||
Note: Reports are named Flag in AS.
|
||||
"""
|
||||
alias Mobilizon.Events.Participant, as: ParticipantModel
|
||||
|
||||
@doc """
|
||||
Convert an event struct to an ActivityStream representation
|
||||
"""
|
||||
@spec model_to_as(ParticipantModel.t()) :: map()
|
||||
def model_to_as(%ParticipantModel{} = participant) do
|
||||
%{
|
||||
"type" => "Join",
|
||||
"id" => participant.url,
|
||||
"actor" => participant.actor.url,
|
||||
"object" => participant.event.url
|
||||
}
|
||||
end
|
||||
|
||||
defimpl Mobilizon.Service.ActivityPub.Convertible, for: Mobilizon.Events.Participant do
|
||||
alias Mobilizon.Service.ActivityPub.Converters.Participant, as: ParticipantConverter
|
||||
|
||||
defdelegate model_to_as(event), to: ParticipantConverter
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user