summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-08-31 11:02:54 +0200
committerlain <lain@soykaf.club>2020-08-31 11:02:54 +0200
commitd91c4feebeb199f7c584f0a4292ce6f9cc331798 (patch)
treeef3108174a119bd4c24436263b575a4a1525629d
parentf0fefc4f5c3aa4fa62f2edee72ee864a16e7176d (diff)
Notification: Small refactor.
-rw-r--r--lib/pleroma/notification.ex4
-rw-r--r--lib/pleroma/web/common_api/common_api.ex2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index b952e81fa..8868a910e 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -649,8 +649,8 @@ defmodule Pleroma.Notification do
|> Repo.one()
end
- @spec mark_as_read(User.t(), Activity.t()) :: {integer(), nil | [term()]}
- def mark_as_read(%User{id: id}, %Activity{data: %{"context" => context}}) do
+ @spec mark_context_as_read(User.t(), String.t()) :: {integer(), nil | [term()]}
+ def mark_context_as_read(%User{id: id}, context) do
from(
n in Notification,
join: a in assoc(n, :activity),
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index 43e9e39a8..4ab533658 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -453,7 +453,7 @@ defmodule Pleroma.Web.CommonAPI do
def add_mute(user, activity) do
with {:ok, _} <- ThreadMute.add_mute(user.id, activity.data["context"]),
- _ <- Pleroma.Notification.mark_as_read(user, activity) do
+ _ <- Pleroma.Notification.mark_context_as_read(user, activity.data["context"]) do
{:ok, activity}
else
{:error, _} -> {:error, dgettext("errors", "conversation is already muted")}