Add ActivityPub Object Event type support
Adds Event support in the same way Video objects are handled, with the name of the object as message header. Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
38ad407395
commit
d2f1c4f658
9 changed files with 59 additions and 4 deletions
|
|
@ -397,7 +397,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
%{"type" => "Create", "object" => %{"type" => objtype} = object} = data,
|
||||
options
|
||||
)
|
||||
when objtype in ["Article", "Note", "Video", "Page", "Question", "Answer"] do
|
||||
when objtype in ["Article", "Event", "Note", "Video", "Page", "Question", "Answer"] do
|
||||
actor = Containment.get_actor(data)
|
||||
|
||||
data =
|
||||
|
|
|
|||
|
|
@ -22,7 +22,16 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|
|||
require Logger
|
||||
require Pleroma.Constants
|
||||
|
||||
@supported_object_types ["Article", "Note", "Video", "Page", "Question", "Answer", "Audio"]
|
||||
@supported_object_types [
|
||||
"Article",
|
||||
"Note",
|
||||
"Event",
|
||||
"Video",
|
||||
"Page",
|
||||
"Question",
|
||||
"Answer",
|
||||
"Audio"
|
||||
]
|
||||
@strip_status_report_states ~w(closed resolved)
|
||||
@supported_report_states ~w(open closed resolved)
|
||||
@valid_visibilities ~w(public unlisted private direct)
|
||||
|
|
|
|||
|
|
@ -421,7 +421,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
end
|
||||
end
|
||||
|
||||
def render_content(%{data: %{"type" => "Video"}} = object) do
|
||||
def render_content(%{data: %{"type" => object_type}} = object)
|
||||
when object_type in ["Video", "Event"] do
|
||||
with name when not is_nil(name) and name != "" <- object.data["name"] do
|
||||
"<p><a href=\"#{object.data["id"]}\">#{name}</a></p>#{object.data["content"]}"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
|||
|
||||
defp is_status?(acct) do
|
||||
case Pleroma.Object.Fetcher.fetch_and_contain_remote_object_from_id(acct) do
|
||||
{:ok, %{"type" => type}} when type in ["Article", "Note", "Video", "Page", "Question"] ->
|
||||
{:ok, %{"type" => type}}
|
||||
when type in ["Article", "Event", "Note", "Video", "Page", "Question"] ->
|
||||
true
|
||||
|
||||
_ ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue