diff options
| author | Mark Felder <feld@FreeBSD.org> | 2020-05-28 10:16:09 -0500 | 
|---|---|---|
| committer | Mark Felder <feld@FreeBSD.org> | 2020-05-28 10:16:09 -0500 | 
| commit | 9eea80002673eb1359a2d4369c65a89c42c2f707 (patch) | |
| tree | 9be8d8041606909c9374e8fb323cf089d918f282 /test | |
| parent | 089d72d2e6bb1f3c3674162c5c9a7c4988241358 (diff) | |
| download | pleroma-9eea80002673eb1359a2d4369c65a89c42c2f707.tar.gz pleroma-9eea80002673eb1359a2d4369c65a89c42c2f707.zip | |
Refactor notification settings
Diffstat (limited to 'test')
| -rw-r--r-- | test/notification_test.exs | 17 | ||||
| -rw-r--r-- | test/web/mastodon_api/views/account_view_test.exs | 7 | ||||
| -rw-r--r-- | test/web/twitter_api/util_controller_test.exs | 16 | 
3 files changed, 14 insertions, 26 deletions
| diff --git a/test/notification_test.exs b/test/notification_test.exs index 37c255fee..fd59aceb5 100644 --- a/test/notification_test.exs +++ b/test/notification_test.exs @@ -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"]) diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index 487ec26c2..2e01689ff 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -94,10 +94,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do      user = insert(:user)      notification_settings = %{ -      followers: true, -      follows: true, -      non_followers: true, -      non_follows: true, +      from_followers: true, +      from_following: true, +      from_strangers: true,        privacy_option: false      } diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs index ad919d341..1133107f4 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", %{ -        "followers" => false, +        "from_followers" => false,          "bar" => 1        })        |> json_response(:ok) @@ -199,10 +199,9 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do        user = refresh_record(user)        assert %Pleroma.User.NotificationSetting{ -               followers: false, -               follows: true, -               non_follows: true, -               non_followers: true, +               from_followers: false, +               from_following: true, +               from_strangers: true,                 privacy_option: false               } == user.notification_settings      end @@ -215,10 +214,9 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do        user = refresh_record(user)        assert %Pleroma.User.NotificationSetting{ -               followers: true, -               follows: true, -               non_follows: true, -               non_followers: true, +               from_followers: true, +               from_following: true, +               from_strangers: true,                 privacy_option: true               } == user.notification_settings      end | 
