mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 16:16:34 +00:00
Fix order of args for remove_mute/2
This commit is contained in:
parent
f602813d31
commit
d27ad36ce4
4 changed files with 9 additions and 8 deletions
|
@ -572,16 +572,17 @@ defmodule Pleroma.Web.CommonAPI do
|
|||
end
|
||||
end
|
||||
|
||||
@spec remove_mute(User.t(), Activity.t()) :: {:ok, Activity.t()} | {:error, any()}
|
||||
def remove_mute(%User{} = user, %Activity{} = activity) do
|
||||
@spec remove_mute(Activity.t(), User.t()) :: {:ok, Activity.t()} | {:error, any()}
|
||||
def remove_mute(%Activity{} = activity, %User{} = user) do
|
||||
ThreadMute.remove_mute(user.id, activity.data["context"])
|
||||
{:ok, activity}
|
||||
end
|
||||
|
||||
def remove_mute(user_id, activity_id) do
|
||||
@spec remove_mute(String.t(), String.t()) :: {:ok, Activity.t()} | {:error, any()}
|
||||
def remove_mute(activity_id, user_id) do
|
||||
with {:user, %User{} = user} <- {:user, User.get_by_id(user_id)},
|
||||
{:activity, %Activity{} = activity} <- {:activity, Activity.get_by_id(activity_id)} do
|
||||
remove_mute(user, activity)
|
||||
remove_mute(activity, user)
|
||||
else
|
||||
{what, result} = error ->
|
||||
Logger.warning(
|
||||
|
|
|
@ -467,7 +467,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
|
|||
_
|
||||
) do
|
||||
with %Activity{} = activity <- Activity.get_by_id(id),
|
||||
{:ok, activity} <- CommonAPI.remove_mute(user, activity) do
|
||||
{:ok, activity} <- CommonAPI.remove_mute(activity, user) do
|
||||
try_render(conn, "show.json", activity: activity, for: user, as: :activity)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ defmodule Pleroma.Workers.MuteExpireWorker do
|
|||
def perform(%Job{
|
||||
args: %{"op" => "unmute_conversation", "user_id" => user_id, "activity_id" => activity_id}
|
||||
}) do
|
||||
Pleroma.Web.CommonAPI.remove_mute(user_id, activity_id)
|
||||
Pleroma.Web.CommonAPI.remove_mute(activity_id, user_id)
|
||||
:ok
|
||||
end
|
||||
|
||||
|
|
|
@ -1219,13 +1219,13 @@ defmodule Pleroma.Web.CommonAPITest do
|
|||
|
||||
test "remove mute", %{user: user, activity: activity} do
|
||||
CommonAPI.add_mute(user, activity)
|
||||
{:ok, _} = CommonAPI.remove_mute(user, activity)
|
||||
{:ok, _} = CommonAPI.remove_mute(activity, user)
|
||||
refute CommonAPI.thread_muted?(user, activity)
|
||||
end
|
||||
|
||||
test "remove mute by ids", %{user: user, activity: activity} do
|
||||
CommonAPI.add_mute(user, activity)
|
||||
{:ok, _} = CommonAPI.remove_mute(user.id, activity.id)
|
||||
{:ok, _} = CommonAPI.remove_mute(activity.id, user.id)
|
||||
refute CommonAPI.thread_muted?(user, activity)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue