Add OTP to updating.md
[akkoma] / test / notification_test.exs
index 9fe34d18fb6067a626f9ef104ed7b7097450e6b5..f5f23bb5a1ad9bb9a655c5d49c4e4b3ac13d2d70 100644 (file)
@@ -93,12 +93,12 @@ defmodule Pleroma.NotificationTest do
       activity = insert(:note_activity)
       author = User.get_cached_by_ap_id(activity.data["actor"])
       user = insert(:user)
-      {:ok, user} = User.block(user, author)
+      {:ok, _user_relationship} = User.block(user, author)
 
       assert Notification.create_notification(activity, user)
     end
 
-    test "it creates a notificatin for the user if the user mutes the activity author" do
+    test "it creates a notification for the user if the user mutes the activity author" do
       muter = insert(:user)
       muted = insert(:user)
       {:ok, _} = User.mute(muter, muted)
@@ -112,7 +112,7 @@ defmodule Pleroma.NotificationTest do
       muter = insert(:user)
       muted = insert(:user)
 
-      {:ok, muter} = User.mute(muter, muted, false)
+      {:ok, _user_relationships} = User.mute(muter, muted, false)
 
       {:ok, activity} = CommonAPI.post(muted, %{"status" => "Hi @#{muter.nickname}"})
 
@@ -136,7 +136,10 @@ defmodule Pleroma.NotificationTest do
 
     test "it disables notifications from followers" do
       follower = insert(:user)
-      followed = insert(:user, notification_settings: %{"followers" => false})
+
+      followed =
+        insert(:user, notification_settings: %Pleroma.User.NotificationSetting{followers: false})
+
       User.follow(follower, followed)
       {:ok, activity} = CommonAPI.post(follower, %{"status" => "hey @#{followed.nickname}"})
       refute Notification.create_notification(activity, followed)
@@ -144,13 +147,20 @@ defmodule Pleroma.NotificationTest do
 
     test "it disables notifications from non-followers" do
       follower = insert(:user)
-      followed = insert(:user, notification_settings: %{"non_followers" => false})
+
+      followed =
+        insert(:user,
+          notification_settings: %Pleroma.User.NotificationSetting{non_followers: false}
+        )
+
       {: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: %{"follows" => false})
+      follower =
+        insert(:user, notification_settings: %Pleroma.User.NotificationSetting{follows: false})
+
       followed = insert(:user)
       User.follow(follower, followed)
       follower = Repo.get(User, follower.id)
@@ -159,7 +169,9 @@ defmodule Pleroma.NotificationTest do
     end
 
     test "it disables notifications from people the user does not follow" do
-      follower = insert(:user, notification_settings: %{"non_follows" => false})
+      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)
@@ -669,7 +681,7 @@ defmodule Pleroma.NotificationTest do
     test "it returns notifications for muted user without notifications" do
       user = insert(:user)
       muted = insert(:user)
-      {:ok, user} = User.mute(user, muted, false)
+      {:ok, _user_relationships} = User.mute(user, muted, false)
 
       {:ok, _activity} = CommonAPI.post(muted, %{"status" => "hey @#{user.nickname}"})
 
@@ -679,7 +691,7 @@ defmodule Pleroma.NotificationTest do
     test "it doesn't return notifications for muted user with notifications" do
       user = insert(:user)
       muted = insert(:user)
-      {:ok, user} = User.mute(user, muted)
+      {:ok, _user_relationships} = User.mute(user, muted)
 
       {:ok, _activity} = CommonAPI.post(muted, %{"status" => "hey @#{user.nickname}"})
 
@@ -689,7 +701,7 @@ defmodule Pleroma.NotificationTest do
     test "it doesn't return notifications for blocked user" do
       user = insert(:user)
       blocked = insert(:user)
-      {:ok, user} = User.block(user, blocked)
+      {:ok, _user_relationship} = User.block(user, blocked)
 
       {:ok, _activity} = CommonAPI.post(blocked, %{"status" => "hey @#{user.nickname}"})
 
@@ -719,7 +731,7 @@ defmodule Pleroma.NotificationTest do
     test "it returns notifications from a muted user when with_muted is set" do
       user = insert(:user)
       muted = insert(:user)
-      {:ok, user} = User.mute(user, muted)
+      {:ok, _user_relationships} = User.mute(user, muted)
 
       {:ok, _activity} = CommonAPI.post(muted, %{"status" => "hey @#{user.nickname}"})
 
@@ -729,7 +741,7 @@ defmodule Pleroma.NotificationTest do
     test "it doesn't return notifications from a blocked user when with_muted is set" do
       user = insert(:user)
       blocked = insert(:user)
-      {:ok, user} = User.block(user, blocked)
+      {:ok, _user_relationship} = User.block(user, blocked)
 
       {:ok, _activity} = CommonAPI.post(blocked, %{"status" => "hey @#{user.nickname}"})