Merge branch 'feature/add-background-image-to-mastoapi' into 'develop'
AccountView: Add user background. See merge request pleroma/pleroma!1280
This commit is contained in:
commit
62ffc00a5d
7 changed files with 332 additions and 274 deletions
|
|
@ -136,6 +136,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
_ -> :error
|
||||
end
|
||||
end)
|
||||
|> add_if_present(params, "pleroma_background_image", :background, fn value ->
|
||||
with %Plug.Upload{} <- value,
|
||||
{:ok, object} <- ActivityPub.upload(value, type: :background) do
|
||||
{:ok, object.data}
|
||||
else
|
||||
_ -> :error
|
||||
end
|
||||
end)
|
||||
|> Map.put(:emoji, user_info_emojis)
|
||||
|
||||
info_cng = User.Info.profile_update(user.info, info_params)
|
||||
|
|
|
|||
|
|
@ -125,7 +125,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
hide_follows: user.info.hide_follows,
|
||||
hide_favorites: user.info.hide_favorites,
|
||||
relationship: relationship,
|
||||
skip_thread_containment: user.info.skip_thread_containment
|
||||
skip_thread_containment: user.info.skip_thread_containment,
|
||||
background_image: image_url(user.info.background) |> MediaProxy.url()
|
||||
}
|
||||
}
|
||||
|> maybe_put_role(user, opts[:for])
|
||||
|
|
@ -182,4 +183,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
end
|
||||
|
||||
defp maybe_put_notification_settings(data, _, _), do: data
|
||||
|
||||
defp image_url(%{"url" => [%{"href" => href} | _]}), do: href
|
||||
defp image_url(_), do: nil
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue