Refactor notification settings
This commit is contained in:
parent
089d72d2e6
commit
9eea800026
8 changed files with 41 additions and 66 deletions
|
|
@ -237,19 +237,19 @@ defmodule Pleroma.NotificationTest do
|
|||
follower = insert(:user)
|
||||
|
||||
followed =
|
||||
insert(:user, notification_settings: %Pleroma.User.NotificationSetting{followers: false})
|
||||
insert(:user, notification_settings: %Pleroma.User.NotificationSetting{from_followers: false})
|
||||
|
||||
User.follow(follower, followed)
|
||||
{:ok, activity} = CommonAPI.post(follower, %{status: "hey @#{followed.nickname}"})
|
||||
refute Notification.create_notification(activity, followed)
|
||||
end
|
||||
|
||||
test "it disables notifications from non-followers" do
|
||||
test "it disables notifications from strangers" do
|
||||
follower = insert(:user)
|
||||
|
||||
followed =
|
||||
insert(:user,
|
||||
notification_settings: %Pleroma.User.NotificationSetting{non_followers: false}
|
||||
notification_settings: %Pleroma.User.NotificationSetting{from_strangers: false}
|
||||
)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(follower, %{status: "hey @#{followed.nickname}"})
|
||||
|
|
@ -258,7 +258,7 @@ defmodule Pleroma.NotificationTest do
|
|||
|
||||
test "it disables notifications from people the user follows" do
|
||||
follower =
|
||||
insert(:user, notification_settings: %Pleroma.User.NotificationSetting{follows: false})
|
||||
insert(:user, notification_settings: %Pleroma.User.NotificationSetting{from_following: false})
|
||||
|
||||
followed = insert(:user)
|
||||
User.follow(follower, followed)
|
||||
|
|
@ -267,15 +267,6 @@ defmodule Pleroma.NotificationTest do
|
|||
refute Notification.create_notification(activity, follower)
|
||||
end
|
||||
|
||||
test "it disables notifications from people the user does not follow" do
|
||||
follower =
|
||||
insert(:user, notification_settings: %Pleroma.User.NotificationSetting{non_follows: false})
|
||||
|
||||
followed = insert(:user)
|
||||
{:ok, activity} = CommonAPI.post(followed, %{status: "hey @#{follower.nickname}"})
|
||||
refute Notification.create_notification(activity, follower)
|
||||
end
|
||||
|
||||
test "it doesn't create a notification for user if he is the activity author" do
|
||||
activity = insert(:note_activity)
|
||||
author = User.get_cached_by_ap_id(activity.data["actor"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue