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 = {})
|
2018-12-05 23:21:45 +05:30
|
|
|
skip_confirmation = @params.delete(:skip_confirmation)
|
|
|
|
|
|
|
|
email = @user.emails.create(@params.merge(extra_params))
|
|
|
|
|
|
|
|
email&.confirm if skip_confirmation && current_user.admin?
|
|
|
|
email
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|