aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/common_api.ex
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2020-09-11 14:13:38 -0500
committerAlex Gleason <alex@alexgleason.me>2020-09-11 14:13:38 -0500
commit9733c9d06563a92e4c58ac906c5f98b617b9e731 (patch)
treeabbf03ddb917c1c203cb79eab64647d3af541fff /lib/pleroma/web/common_api/common_api.ex
parentdfb831ca39db3098d6d585448a6ff8e938e51e8c (diff)
parent9fb88c814ddadd9138ef29550a856938491a1ca4 (diff)
downloadpleroma-9733c9d06563a92e4c58ac906c5f98b617b9e731.tar.gz
Merge remote-tracking branch 'upstream/develop' into chat-moderation
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r--lib/pleroma/web/common_api/common_api.ex8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index d6e9d3d67..a8c83bc8f 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -4,7 +4,6 @@
defmodule Pleroma.Web.CommonAPI do
alias Pleroma.Activity
- alias Pleroma.ActivityExpiration
alias Pleroma.Conversation.Participation
alias Pleroma.Formatter
alias Pleroma.Object
@@ -381,9 +380,9 @@ defmodule Pleroma.Web.CommonAPI do
def check_expiry_date({:ok, nil} = res), do: res
def check_expiry_date({:ok, in_seconds}) do
- expiry = NaiveDateTime.utc_now() |> NaiveDateTime.add(in_seconds)
+ expiry = DateTime.add(DateTime.utc_now(), in_seconds)
- if ActivityExpiration.expires_late_enough?(expiry) do
+ if Pleroma.Workers.PurgeExpiredActivity.expires_late_enough?(expiry) do
{:ok, expiry}
else
{:error, "Expiry date is too soon"}
@@ -452,7 +451,8 @@ defmodule Pleroma.Web.CommonAPI do
end
def add_mute(user, activity) do
- with {:ok, _} <- ThreadMute.add_mute(user.id, activity.data["context"]) do
+ with {:ok, _} <- ThreadMute.add_mute(user.id, activity.data["context"]),
+ _ <- Pleroma.Notification.mark_context_as_read(user, activity.data["context"]) do
{:ok, activity}
else
{:error, _} -> {:error, dgettext("errors", "conversation is already muted")}