1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2024 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.PleromaAPI.BookmarkFolderView do
8 alias Pleroma.BookmarkFolder
10 alias Pleroma.Web.Endpoint
12 def render("show.json", %{folder: %BookmarkFolder{} = folder}) do
14 id: folder.id |> to_string(),
17 emoji_url: get_emoji_url(folder.emoji)
21 def render("index.json", %{folders: folders} = opts) do
22 render_many(folders, __MODULE__, "show.json", Map.delete(opts, :folders))
25 defp get_emoji_url(nil) do
29 defp get_emoji_url(emoji) do
30 if Emoji.unicode?(emoji) do
33 emoji = Emoji.get(emoji)
36 Endpoint.url() |> URI.merge(emoji.file) |> to_string()