2018-07-16 16:31:01 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-16 13:06:14 +00:00
|
|
|
module Emails
|
2017-06-19 12:51:46 +00:00
|
|
|
class CreateService < ::Emails::BaseService
|
2017-10-01 15:07:26 +00:00
|
|
|
def execute(extra_params = {})
|
2018-09-09 21:04:11 +00:00
|
|
|
skip_confirmation = @params.delete(:skip_confirmation)
|
|
|
|
|
|
|
|
email = @user.emails.create(@params.merge(extra_params))
|
|
|
|
|
|
|
|
email&.confirm if skip_confirmation && current_user.admin?
|
|
|
|
email
|
2017-06-16 13:06:14 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|