projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Patch to support image descriptions in Pleroma FE
[akkoma]
/
lib
/
pleroma
/
web
/
common_api
/
utils.ex
diff --git
a/lib/pleroma/web/common_api/utils.ex
b/lib/pleroma/web/common_api/utils.ex
index d25fef6bce05a5b2091897cbb754e54ce47fe523..5fe21fb99c367d5f01ccbb3d51bf42b030c375a7 100644
(file)
--- a/
lib/pleroma/web/common_api/utils.ex
+++ b/
lib/pleroma/web/common_api/utils.ex
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Web.CommonAPI.Utils do
alias Calendar.Strftime
alias Comeonin.Pbkdf2
defmodule Pleroma.Web.CommonAPI.Utils do
alias Calendar.Strftime
alias Comeonin.Pbkdf2
@@
-28,9
+32,11
@@
defmodule Pleroma.Web.CommonAPI.Utils do
def get_replied_to_activity(_), do: nil
def get_replied_to_activity(_), do: nil
- def attachments_from_ids(ids) do
+ def attachments_from_ids(ids, descs_str) do
+ {_, descs} = Jason.decode(descs_str)
+
Enum.map(ids || [], fn media_id ->
Enum.map(ids || [], fn media_id ->
- Repo.get(Object, media_id).data
+ Map.put(Repo.get(Object, media_id).data, "name", descs[media_id])
end)
end
end)
end
@@
-69,12
+75,7
@@
defmodule Pleroma.Web.CommonAPI.Utils do
mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end)
if inReplyTo do
mentioned_users = Enum.map(mentions, fn {_, %{ap_id: ap_id}} -> ap_id end)
if inReplyTo do
- to =
- [inReplyTo.data["actor"] | mentioned_users]
- |> Enum.uniq()
- |> Enum.reject(&is_nil/1)
-
- {to, []}
+ {Enum.uniq([inReplyTo.data["actor"] | mentioned_users]), []}
else
{mentioned_users, []}
end
else
{mentioned_users, []}
end