forked from AkkomaGang/akkoma
Refactor as per Rin's suggestions, add endpoint tests
This commit is contained in:
parent
cc21fc5f53
commit
c01ef574c1
9 changed files with 136 additions and 105 deletions
|
|
@ -6,7 +6,7 @@ defmodule Pleroma.Notification do
|
|||
use Ecto.Schema
|
||||
alias Pleroma.{User, Activity, Notification, Repo}
|
||||
alias Pleroma.Web.CommonAPI.Utils
|
||||
alias Pleroma.Web.ThreadMute
|
||||
alias Pleroma.Web.CommonAPI
|
||||
import Ecto.Query
|
||||
|
||||
schema "notifications" do
|
||||
|
|
@ -113,7 +113,7 @@ defmodule Pleroma.Notification do
|
|||
# TODO move to sql, too.
|
||||
def create_notification(%Activity{} = activity, %User{} = user) do
|
||||
unless User.blocks?(user, %{ap_id: activity.data["actor"]}) or
|
||||
ThreadMute.muted?(user, activity) or user.ap_id == activity.data["actor"] or
|
||||
CommonAPI.thread_muted?(user, activity) or user.ap_id == activity.data["actor"] or
|
||||
(activity.data["type"] == "Follow" and
|
||||
Enum.any?(Notification.for_user(user), fn notif ->
|
||||
notif.activity.data["type"] == "Follow" and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue