gitlab-org--gitlab-foss/app/services/emails/create_service.rb
Rémy Coutable eafe834c3d
Reduce remaining diff with EE in app/services
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-02-14 12:37:55 +01:00

13 lines
350 B
Ruby

# frozen_string_literal: true
module Emails
class CreateService < ::Emails::BaseService
def execute(extra_params = {})
skip_confirmation = params.delete(:skip_confirmation)
user.emails.create(params.merge(extra_params)).tap do |email|
email&.confirm if skip_confirmation && current_user.admin?
end
end
end
end