added privacy option to push notifications

This commit is contained in:
Maksim Pechnikov 2019-10-29 21:33:17 +03:00
commit 04a8ffbe84
6 changed files with 76 additions and 40 deletions

View file

@ -12,29 +12,10 @@ defmodule Pleroma.User.NotificationSettingTest do
changeset =
NotificationSetting.changeset(
%NotificationSetting{},
%{"privacy_option" => "name_only"}
%{"privacy_option" => true}
)
assert %Ecto.Changeset{valid?: true} = changeset
end
test "returns invalid changeset when privacy option is incorrect" do
changeset =
NotificationSetting.changeset(
%NotificationSetting{},
%{"privacy_option" => "full_content"}
)
assert %Ecto.Changeset{valid?: false} = changeset
assert [
privacy_option:
{"is invalid",
[
validation: :inclusion,
enum: ["name_and_message", "name_only", "no_name_or_message"]
]}
] = changeset.errors
end
end
end