gitlab-org--gitlab-foss/app/services/emails/create_service.rb

16 lines
416 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Emails
2017-06-19 08:51:46 -04:00
class CreateService < ::Emails::BaseService
2017-10-01 11:07:26 -04:00
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
Emails::CreateService.prepend_if_ee('EE::Emails::CreateService')