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

18 lines
372 B
Ruby
Raw Normal View History

module Emails
2017-06-19 08:51:46 -04:00
class DestroyService < ::Emails::BaseService
2017-06-22 05:27:37 -04:00
def execute
Email.find_by_email!(@email).destroy && update_secondary_emails!
2017-06-22 02:55:07 -04:00
end
private
def update_secondary_emails!
2017-06-23 10:44:34 -04:00
result = ::Users::UpdateService.new(@user).execute do |user|
2017-06-22 02:55:07 -04:00
user.update_secondary_emails!
end
result[:status] == 'success'
end
end
end