X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fcommon_api%2Futils.ex;h=5fe21fb99c367d5f01ccbb3d51bf42b030c375a7;hb=4c95545d194e8a807e9e3514ed75347d78ec0856;hp=142283684b4d176448edd7605c8bae7eb7b79b0f;hpb=ca2e9ce9cc98f046ea2be0a9051cdf06d253d7f6;p=akkoma diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 142283684..5fe21fb99 100644 --- 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 +# SPDX-License-Identifier: AGPL-3.0-only + 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 attachments_from_ids(ids) do + def attachments_from_ids(ids, descs_str) do + {_, descs} = Jason.decode(descs_str) + 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