alias Pleroma.{Repo, Object, Formatter, Activity}
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.Endpoint
+ alias Pleroma.Web.MediaProxy
alias Pleroma.User
alias Calendar.Strftime
alias Comeonin.Pbkdf2
end
end
+ def get_replied_to_activity(""), do: nil
+
def get_replied_to_activity(id) when not is_nil(id) do
Repo.get(Activity, id)
end
def add_attachments(text, attachments) do
attachment_text =
Enum.map(attachments, fn
- %{"url" => [%{"href" => href} | _]} ->
- name = URI.decode(Path.basename(href))
+ %{"url" => [%{"href" => href} | _]} = attachment ->
+ name = attachment["name"] || URI.decode(Path.basename(href))
+ href = MediaProxy.url(href)
"<a href=\"#{href}\" class='attachment'>#{shortname(name)}</a>"
_ ->
|> String.replace(~r/\r?\n/, "")
|> (&{[], &1}).()
|> Formatter.add_user_links(mentions)
+ |> Formatter.add_hashtag_links(tags)
|> Formatter.finalize()
end