Compare commits

..

No commits in common. "4fb2251221e9c023905a25c49fc9058b29952d13" and "fd0cb148b9d1a6a80f2fdc8d876801885e0f78ed" have entirely different histories.

6 changed files with 7 additions and 32 deletions

View file

@ -222,8 +222,7 @@
"text/plain", "text/plain",
"text/html", "text/html",
"text/markdown", "text/markdown",
"text/bbcode", "text/bbcode"
"text/x.misskeymarkdown"
], ],
staff_transparency: [], staff_transparency: [],
autofollowed_nicknames: [], autofollowed_nicknames: [],

View file

@ -165,7 +165,7 @@ def maybe_quote(name) when is_binary(name) do
def maybe_quote(name), do: name def maybe_quote(name), do: name
def emoji_url(%{"type" => "EmojiReact", "content" => _, "tag" => []}), do: nil def emoji_url(%{"type" => "EmojiReact", "content" => emoji, "tag" => []}), do: nil
def emoji_url(%{"type" => "EmojiReact", "content" => emoji, "tag" => tags}) do def emoji_url(%{"type" => "EmojiReact", "content" => emoji, "tag" => tags}) do
tag = tag =

View file

@ -29,7 +29,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
end end
field(:replies, {:array, ObjectValidators.ObjectID}, default: []) field(:replies, {:array, ObjectValidators.ObjectID}, default: [])
field(:source, :map)
end end
def cast_and_apply(data) do def cast_and_apply(data) do
@ -80,17 +79,6 @@ defp fix_replies(%{"replies" => %{"first" => first}} = data) do
defp fix_replies(data), do: data defp fix_replies(data), do: data
# https://github.com/misskey-dev/misskey/pull/8787
defp fix_misskey_content(%{"source" => %{"mediaType" => "text/x.misskeymarkdown"}} = object), do: object
defp fix_misskey_content(%{"_misskey_content" => content} = object) do
object
|> Map.put("source", %{"content" => content, "mediaType" => "text/x.misskeymarkdown" })
|> Map.delete("_misskey_content")
end
defp fix_misskey_content(data), do: data
defp fix(data) do defp fix(data) do
data data
|> CommonFixes.fix_actor() |> CommonFixes.fix_actor()
@ -98,7 +86,6 @@ defp fix(data) do
|> fix_url() |> fix_url()
|> fix_tag() |> fix_tag()
|> fix_replies() |> fix_replies()
|> fix_misskey_content()
|> Transmogrifier.fix_emoji() |> Transmogrifier.fix_emoji()
|> Transmogrifier.fix_content_map() |> Transmogrifier.fix_content_map()
end end

View file

@ -213,14 +213,13 @@ defp object(draft) do
end end
emoji = Map.merge(emoji, summary_emoji) emoji = Map.merge(emoji, summary_emoji)
{:ok, note_data, _meta} = Builder.note(draft) {:ok, note_data, _meta} = Builder.note(draft)
object = object =
note_data note_data
|> Map.put("emoji", emoji) |> Map.put("emoji", emoji)
|> Map.put("source", %{ |> Map.put("source", draft.status)
"content" => draft.status,
"mediaType" => draft.params[:content_type]
})
|> Map.put("generator", draft.params[:generator]) |> Map.put("generator", draft.params[:generator])
%__MODULE__{draft | object: object} %__MODULE__{draft | object: object}

View file

@ -291,15 +291,6 @@ def format_input(text, "text/markdown", options) do
|> Formatter.html_escape("text/html") |> Formatter.html_escape("text/html")
end end
def format_input(text, "text/x.misskeymarkdown", options) do
text
|> Formatter.html_escape("text/plain")
|> Formatter.linkify(options)
|> (fn {text, mentions, tags} ->
{String.replace(text, ~r/\r?\n/, "<br>"), mentions, tags}
end).()
end
def format_naive_asctime(date) do def format_naive_asctime(date) do
date |> DateTime.from_naive!("Etc/UTC") |> format_asctime date |> DateTime.from_naive!("Etc/UTC") |> format_asctime
end end

View file

@ -80,6 +80,7 @@ defp reblogged?(_activity, _user), do: false
def render("index.json", opts) do def render("index.json", opts) do
reading_user = opts[:for] reading_user = opts[:for]
# To do: check AdminAPIControllerTest on the reasons behind nil activities in the list # To do: check AdminAPIControllerTest on the reasons behind nil activities in the list
activities = Enum.filter(opts.activities, & &1) activities = Enum.filter(opts.activities, & &1)
@ -328,6 +329,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
) )
{pinned?, pinned_at} = pin_data(object, user) {pinned?, pinned_at} = pin_data(object, user)
%{ %{
id: to_string(activity.id), id: to_string(activity.id),
uri: object.data["id"], uri: object.data["id"],
@ -374,9 +376,6 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
emoji_reactions: emoji_reactions, emoji_reactions: emoji_reactions,
parent_visible: visible_for_user?(reply_to, opts[:for]), parent_visible: visible_for_user?(reply_to, opts[:for]),
pinned_at: pinned_at pinned_at: pinned_at
},
akkoma: %{
source: object.data["source"]
} }
} }
end end