aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api
diff options
context:
space:
mode:
authormarcin mikołajczak <git@mkljczk.pl>2022-01-10 21:35:55 +0100
committermarcin mikołajczak <git@mkljczk.pl>2022-01-12 18:15:10 +0100
commit0f90fd58052aa372aaad63d769cd724046c9f61f (patch)
tree9ead892e5f740df707e9f6172845de74e4792c35 /lib/pleroma/web/mastodon_api
parent4f249b23977d7426c6249875b538c7a6c1b239ff (diff)
downloadpleroma-0f90fd58052aa372aaad63d769cd724046c9f61f.tar.gz
WIP account endorsements
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Diffstat (limited to 'lib/pleroma/web/mastodon_api')
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/account_controller.ex10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
index 1e9ce2927..0c0548828 100644
--- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
@@ -84,7 +84,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
plug(OAuthScopesPlug, %{scopes: ["follow", "write:mutes"]} when action in [:mute, :unmute])
@relationship_actions [:follow, :unfollow]
- @needs_account ~W(followers following lists follow unfollow mute unmute block unblock endorse unendorse endorse unendorse)a
+ @needs_account ~W(
+ followers following lists follow unfollow mute unmute block unblock note endorse unendorse
+ )a
plug(
RateLimiter,
@@ -450,16 +452,16 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
end
end
- @doc "POST /api/v1/accounts/:id/mute"
+ @doc "POST /api/v1/accounts/:id/pin"
def endorse(%{assigns: %{user: endorser, account: endorsed}} = conn, _params) do
with {:ok, _user_relationships} <- User.endorse(endorser, endorsed) do
render(conn, "relationship.json", user: endorser, target: endorsed)
else
- {:error, message} -> json_response(conn, :forbidden, %{error: message})
+ {:error, message} -> json_response(conn, :bad_request, %{error: message})
end
end
- @doc "POST /api/v1/accounts/:id/unmute"
+ @doc "POST /api/v1/accounts/:id/unpin"
def unendorse(%{assigns: %{user: endorser, account: endorsed}} = conn, _params) do
with {:ok, _user_relationships} <- User.unendorse(endorser, endorsed) do
render(conn, "relationship.json", user: endorser, target: endorsed)