mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-24 00:50:29 +00:00
Patch to support image descriptions in Pleroma FE
This commit is contained in:
parent
fe2dceb66d
commit
4c95545d19
2 changed files with 7 additions and 8 deletions
|
@ -90,7 +90,7 @@ defmodule Pleroma.Web.CommonAPI do
|
||||||
limit = Pleroma.Config.get([:instance, :limit])
|
limit = Pleroma.Config.get([:instance, :limit])
|
||||||
|
|
||||||
with status <- String.trim(status),
|
with status <- String.trim(status),
|
||||||
attachments <- attachments_from_ids(data["media_ids"]),
|
attachments <- attachments_from_ids(data["media_ids"], data["descriptions"]),
|
||||||
mentions <- Formatter.parse_mentions(status),
|
mentions <- Formatter.parse_mentions(status),
|
||||||
inReplyTo <- get_replied_to_activity(data["in_reply_to_status_id"]),
|
inReplyTo <- get_replied_to_activity(data["in_reply_to_status_id"]),
|
||||||
{to, cc} <- to_for_user_and_mentions(user, mentions, inReplyTo, visibility),
|
{to, cc} <- to_for_user_and_mentions(user, mentions, inReplyTo, visibility),
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2019 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}
|
||||||
|
@ -33,11 +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, descs) do
|
def attachments_from_ids(ids, descs_str) do
|
||||||
Enum.map(ids || [], fn media_id -> do
|
{_, descs} = Jason.decode(descs_str)
|
||||||
Logger.warn(descs[media_id])
|
|
||||||
Repo.get(Object, media_id).data
|
Enum.map(ids || [], fn media_id ->
|
||||||
end
|
Map.put(Repo.get(Object, media_id).data, "name", descs[media_id])
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue