debian-mirror-gitlab/app/services/emails/create_service.rb
2021-06-08 01:23:25 +05:30

15 lines
415 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
Emails::CreateService.prepend_mod_with('Emails::CreateService')