aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2020-06-26 11:24:28 -0500
committerMark Felder <feld@FreeBSD.org>2020-06-26 11:24:28 -0500
commitfd5e797379155e5a85deb88dc79f8fbca483948e (patch)
treebf7790ebc43a79cdb87815b0de271126fb9fe606 /test
parentb950fb01db51f14a9fd3a827b90573418a5b95da (diff)
downloadpleroma-fd5e797379155e5a85deb88dc79f8fbca483948e.tar.gz
Simplify notification filtering settings further
Diffstat (limited to 'test')
-rw-r--r--test/notification_test.exs28
-rw-r--r--test/web/mastodon_api/views/account_view_test.exs4
-rw-r--r--test/web/twitter_api/util_controller_test.exs10
3 files changed, 5 insertions, 37 deletions
diff --git a/test/notification_test.exs b/test/notification_test.exs
index d7df9c36c..d8cb9360a 100644
--- a/test/notification_test.exs
+++ b/test/notification_test.exs
@@ -236,44 +236,18 @@ defmodule Pleroma.NotificationTest do
assert Notification.create_notification(activity, muter)
end
- test "it disables notifications from followers" do
- follower = insert(:user)
-
- followed =
- 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 strangers" do
follower = insert(:user)
followed =
insert(:user,
- notification_settings: %Pleroma.User.NotificationSetting{from_strangers: false}
+ notification_settings: %Pleroma.User.NotificationSetting{block_from_strangers: true}
)
{:ok, activity} = CommonAPI.post(follower, %{status: "hey @#{followed.nickname}"})
refute Notification.create_notification(activity, followed)
end
- test "it disables notifications from people the user follows" do
- follower =
- insert(:user,
- notification_settings: %Pleroma.User.NotificationSetting{from_following: false}
- )
-
- followed = insert(:user)
- User.follow(follower, followed)
- follower = Repo.get(User, follower.id)
- {: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"])
diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs
index 572830194..b6d820b3f 100644
--- a/test/web/mastodon_api/views/account_view_test.exs
+++ b/test/web/mastodon_api/views/account_view_test.exs
@@ -96,9 +96,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
user = insert(:user)
notification_settings = %{
- from_followers: true,
- from_following: true,
- from_strangers: true,
+ block_from_strangers: false,
privacy_option: false
}
diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs
index 1133107f4..da3f6fa61 100644
--- a/test/web/twitter_api/util_controller_test.exs
+++ b/test/web/twitter_api/util_controller_test.exs
@@ -191,7 +191,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
test "it updates notification settings", %{user: user, conn: conn} do
conn
|> put("/api/pleroma/notification_settings", %{
- "from_followers" => false,
+ "block_from_strangers" => true,
"bar" => 1
})
|> json_response(:ok)
@@ -199,9 +199,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
user = refresh_record(user)
assert %Pleroma.User.NotificationSetting{
- from_followers: false,
- from_following: true,
- from_strangers: true,
+ block_from_strangers: true,
privacy_option: false
} == user.notification_settings
end
@@ -214,9 +212,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
user = refresh_record(user)
assert %Pleroma.User.NotificationSetting{
- from_followers: true,
- from_following: true,
- from_strangers: true,
+ block_from_strangers: false,
privacy_option: true
} == user.notification_settings
end