diff options
author | lain <lain@soykaf.club> | 2019-12-05 17:16:23 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-12-05 17:16:23 +0000 |
commit | 67d8df04a440ec9b2949bdddd3a3d8dd70c9b140 (patch) | |
tree | 4fc937160ad56b81bd11b17e4a97a7a6255bd6e6 /lib/pleroma/web/common_api/common_api.ex | |
parent | d0bd4348b34075e1d9ed6905255c85c452e0b4ca (diff) | |
parent | d3bce89edddf72e2eb78e7c84a93c5bd4b6c8ff8 (diff) | |
download | pleroma-67d8df04a440ec9b2949bdddd3a3d8dd70c9b140.tar.gz |
Merge branch '1335-user-api-id-fields-relations' into 'develop'
[#1335] User: refactoring of AP ID fields into relations
Closes #1335
See merge request pleroma/pleroma!1963
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index fe6e26a90..2f3bcfc3c 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Web.CommonAPI do alias Pleroma.Object alias Pleroma.ThreadMute alias Pleroma.User + alias Pleroma.UserRelationship alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.ActivityPub.Visibility @@ -32,7 +33,7 @@ defmodule Pleroma.Web.CommonAPI do def unfollow(follower, unfollowed) do with {:ok, follower, _follow_activity} <- User.unfollow(follower, unfollowed), {:ok, _activity} <- ActivityPub.unfollow(follower, unfollowed), - {:ok, _unfollowed} <- User.unsubscribe(follower, unfollowed) do + {:ok, _subscription} <- User.unsubscribe(follower, unfollowed) do {:ok, follower} end end @@ -420,15 +421,11 @@ defmodule Pleroma.Web.CommonAPI do defp set_visibility(activity, _), do: {:ok, activity} - def hide_reblogs(user, %{ap_id: ap_id} = _muted) do - if ap_id not in user.muted_reblogs do - User.add_reblog_mute(user, ap_id) - end + def hide_reblogs(%User{} = user, %User{} = target) do + UserRelationship.create_reblog_mute(user, target) end - def show_reblogs(user, %{ap_id: ap_id} = _muted) do - if ap_id in user.muted_reblogs do - User.remove_reblog_mute(user, ap_id) - end + def show_reblogs(%User{} = user, %User{} = target) do + UserRelationship.delete_reblog_mute(user, target) end end |