ced2a932d7
This gives admins the ability to send a `skip_confirmation` flag in the `POST /users/:id/email` API endpoint to skip the verification step and assume the given e-mail address is verified. Closes #50876
14 lines
347 B
Ruby
14 lines
347 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Emails
|
|
class CreateService < ::Emails::BaseService
|
|
def execute(extra_params = {})
|
|
skip_confirmation = @params.delete(:skip_confirmation)
|
|
|
|
email = @user.emails.create(@params.merge(extra_params))
|
|
|
|
email&.confirm if skip_confirmation && current_user.admin?
|
|
email
|
|
end
|
|
end
|
|
end
|