assert nil == Notification.create_notification(activity, followed)
end
+ test "it disables notifications from non-followers" do
+ follower = insert(:user)
+ followed = insert(:user, info: %{notification_settings: %{"non_followers" => false}})
+ {:ok, activity} = CommonAPI.post(follower, %{"status" => "hey @#{followed.nickname}"})
+ assert nil == Notification.create_notification(activity, followed)
+ end
+
test "it disables notifications from people the user follows" do
follower = insert(:user, info: %{notification_settings: %{"follows" => false}})
followed = insert(:user)
assert nil == Notification.create_notification(activity, follower)
end
+ test "it disables notifications from people the user does not follow" do
+ follower = insert(:user, info: %{notification_settings: %{"non_follows" => false}})
+ followed = insert(:user)
+ {:ok, activity} = CommonAPI.post(followed, %{"status" => "hey @#{follower.nickname}"})
+ assert nil == 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"])