aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api/controllers
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-11-15 21:38:54 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-11-15 21:38:54 +0300
commitc31ddce51ea18f052c1c3ad30a221b77c7a94e71 (patch)
tree12a4d97437762e252bd4b2ad36268cbd89d99ccf /lib/pleroma/web/mastodon_api/controllers
parent5cf2c7422b006d477498af8d7618a0d6f7659290 (diff)
downloadpleroma-c31ddce51ea18f052c1c3ad30a221b77c7a94e71.tar.gz
[#1335] Reorganized `users.mutes` as relation to UserMute entity.
Diffstat (limited to 'lib/pleroma/web/mastodon_api/controllers')
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/account_controller.ex8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
index 7c94a35d9..e37d3bb07 100644
--- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
@@ -323,7 +323,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
def mute(%{assigns: %{user: muter, account: muted}} = conn, params) do
notifications? = params |> Map.get("notifications", true) |> truthy_param?()
- with {:ok, muter} <- User.mute(muter, muted, notifications?) do
+ with {:ok, _user_mute} <- User.mute(muter, muted, notifications?) do
+ # TODO: remove `muter` refresh once `muted_notifications` field is deprecated
+ muter = User.get_cached_by_id(muter.id)
render(conn, "relationship.json", user: muter, target: muted)
else
{:error, message} -> json_response(conn, :forbidden, %{error: message})
@@ -332,7 +334,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
@doc "POST /api/v1/accounts/:id/unmute"
def unmute(%{assigns: %{user: muter, account: muted}} = conn, _params) do
- with {:ok, muter} <- User.unmute(muter, muted) do
+ with {:ok, _user_mute} <- User.unmute(muter, muted) do
+ # TODO: remove `muter` refresh once `muted_notifications` field is deprecated
+ muter = User.get_cached_by_id(muter.id)
render(conn, "relationship.json", user: muter, target: muted)
else
{:error, message} -> json_response(conn, :forbidden, %{error: message})