added User.NotificationSetting struct

This commit is contained in:
Maksim Pechnikov 2019-10-28 12:47:23 +03:00
commit a52da55eb9
10 changed files with 146 additions and 42 deletions

View file

@ -159,11 +159,31 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
user = Repo.get(User, user.id)
assert %{
"followers" => false,
"follows" => true,
"non_follows" => true,
"non_followers" => true
assert %Pleroma.User.NotificationSetting{
followers: false,
follows: true,
non_follows: true,
non_followers: true,
privacy_option: "name_and_message"
} == user.notification_settings
end
test "it update notificatin privacy option", %{conn: conn} do
user = insert(:user)
conn
|> assign(:user, user)
|> put("/api/pleroma/notification_settings", %{"privacy_option" => "name_only"})
|> json_response(:ok)
user = refresh_record(user)
assert %Pleroma.User.NotificationSetting{
followers: true,
follows: true,
non_follows: true,
non_followers: true,
privacy_option: "name_only"
} == user.notification_settings
end
end