Patch to support image descriptions in Pleroma FE

This commit is contained in:
Wim Vanderbauwhede 2019-01-04 15:22:02 +00:00
parent d9d62a110c
commit fe2dceb66d

View file

@ -1,8 +1,9 @@
# Pleroma: A lightweight social networking server # Pleroma: A lightweight social networking server
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.CommonAPI.Utils do defmodule Pleroma.Web.CommonAPI.Utils do
require Logger
alias Calendar.Strftime alias Calendar.Strftime
alias Comeonin.Pbkdf2 alias Comeonin.Pbkdf2
alias Pleroma.{Activity, Formatter, Object, Repo} alias Pleroma.{Activity, Formatter, Object, Repo}
@ -32,9 +33,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) do
Enum.map(ids || [], fn media_id -> Enum.map(ids || [], fn media_id -> do
Logger.warn(descs[media_id])
Repo.get(Object, media_id).data Repo.get(Object, media_id).data
end
end) end)
end end