diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-30 19:32:43 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-09-30 19:32:43 +0700 |
commit | 0c6009dd2e475d3487123390885c46bf3fc5dea8 (patch) | |
tree | 5a026bff7ddaa1c3afb014536db4e800aee8f94a /lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex | |
parent | 905bb11747fb87f2ad960175e1fc73aa0e3657a0 (diff) | |
download | pleroma-0c6009dd2e475d3487123390885c46bf3fc5dea8.tar.gz |
Extract mascot actions from `MastodonAPIController` to MascotController
Diffstat (limited to 'lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex')
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex index 30a2bf0e0..1484a0174 100644 --- a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex @@ -200,28 +200,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do end end - def set_mascot(%{assigns: %{user: user}} = conn, %{"file" => file}) do - with {:ok, object} <- ActivityPub.upload(file, actor: User.ap_id(user)), - %{} = attachment_data <- Map.put(object.data, "id", object.id), - # Reject if not an image - %{type: "image"} = rendered <- - StatusView.render("attachment.json", %{attachment: attachment_data}) do - # Sure! - # Save to the user's info - {:ok, _user} = User.update_info(user, &User.Info.mascot_update(&1, rendered)) - - json(conn, rendered) - else - %{type: _} -> render_error(conn, :unsupported_media_type, "mascots can only be images") - end - end - - def get_mascot(%{assigns: %{user: user}} = conn, _params) do - mascot = User.get_mascot(user) - - json(conn, mascot) - end - def follows(%{assigns: %{user: follower}} = conn, %{"uri" => uri}) do with {_, %User{} = followed} <- {:followed, User.get_cached_by_nickname(uri)}, {_, true} <- {:followed, follower.id != followed.id}, |