2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
module Emails
|
|
|
|
class CreateService < ::Emails::BaseService
|
2018-03-17 18:26:18 +05:30
|
|
|
def execute(extra_params = {})
|
2019-07-07 11:18:12 +05:30
|
|
|
skip_confirmation = params.delete(:skip_confirmation)
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
user.emails.create(params.merge(extra_params)).tap do |email|
|
|
|
|
email&.confirm if skip_confirmation && current_user.admin?
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
Emails::CreateService.prepend_if_ee('EE::Emails::CreateService')
|