Merge branch 'birthday_fix' into 'develop'

Allow to unset birthday

See merge request pleroma/pleroma!3702
This commit is contained in:
tusooa 2022-07-21 21:27:16 +00:00
commit c589b8445f
2 changed files with 34 additions and 4 deletions

View File

@ -545,11 +545,19 @@ defp create_request do
description: "Invite token required when the registrations aren't public"
},
birthday: %Schema{
type: :string,
nullable: true,
description: "User's birthday",
anyOf: [
%Schema{
type: :string,
format: :date
},
%Schema{
type: :string,
maxLength: 0
}
]
},
language: %Schema{
type: :string,
nullable: true,
@ -733,11 +741,19 @@ defp update_credentials_request do
},
actor_type: ActorType,
birthday: %Schema{
type: :string,
nullable: true,
description: "User's birthday",
anyOf: [
%Schema{
type: :string,
format: :date
},
%Schema{
type: :string,
maxLength: 0
}
]
},
show_birthday: %Schema{
allOf: [BooleanLike],
nullable: true,

View File

@ -390,6 +390,20 @@ test "updates the user's show_birthday status", %{conn: conn} do
assert user_data["source"]["pleroma"]["show_birthday"] == true
end
test "unsets birth date", %{conn: conn} do
patch(conn, "/api/v1/accounts/update_credentials", %{
"birthday" => "2001-02-12"
})
res =
patch(conn, "/api/v1/accounts/update_credentials", %{
"birthday" => ""
})
assert user_data = json_response_and_validate_schema(res, 200)
assert user_data["pleroma"]["birthday"] == nil
end
test "emojis in fields labels", %{conn: conn} do
fields = [
%{"name" => ":firefox:", "value" => "is best 2hu"},