Merge branch 'from/develop/tusooa/add-remove-emails' into 'develop'

Allow users to remove their emails if instance does not need email to register

See merge request pleroma/pleroma!3522
This commit is contained in:
Haelwenn 2021-10-06 05:44:44 +00:00
commit 92a8ff59aa
5 changed files with 95 additions and 6 deletions

View file

@ -2246,7 +2246,7 @@ defmodule Pleroma.User do
def change_email(user, email) do
user
|> cast(%{email: email}, [:email])
|> validate_required([:email])
|> maybe_validate_required_email(false)
|> unique_constraint(:email)
|> validate_format(:email, @email_regex)
|> update_and_set_cache()

View file

@ -121,7 +121,10 @@ defmodule Pleroma.Web.ApiSpec.TwitterUtilOperation do
type: :object,
required: [:email, :password],
properties: %{
email: %Schema{type: :string, description: "New email"},
email: %Schema{
type: :string,
description: "New email. Set to blank to remove the user's email."
},
password: %Schema{type: :string, description: "Current password"}
}
}