Skip to content

Commit

Permalink
correctly trigger delete confirmation emails. #138
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Nov 15, 2018
1 parent c3d77e1 commit 3cdef3d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/clients_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def destroy
logger.warn message
render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status
elsif @client.update_attributes(is_active: nil, deleted_at: Time.zone.now)
@client.remove_users(id: "client_id", jwt: current_user.jwt) unless Rails.env.test?
@client.send_delete_email unless Rails.env.test?
head :no_content
else
logger.warn @client.errors.inspect
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def destroy
logger.warn message
render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status
elsif @provider.update_attributes(is_active: nil, deleted_at: Time.zone.now)
@provider.remove_users(id: "provider_id", jwt: current_user.jwt) unless Rails.env.test?
@provider.send_delete_email unless Rails.env.test?
head :no_content
else
logger.warn @provider.errors.inspect
Expand Down
1 change: 0 additions & 1 deletion app/models/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class Client < ActiveRecord::Base
before_save { self.updated = Time.zone.now.utc.iso8601 }

after_create :send_welcome_email, unless: Proc.new { Rails.env.test? }
before_destroy :send_delete_email, unless: Proc.new { Rails.env.test? }

attr_accessor :target_id

Expand Down
1 change: 0 additions & 1 deletion app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class Provider < ActiveRecord::Base
before_save { self.updated = Time.zone.now.utc.iso8601 }

after_create :send_welcome_email, unless: Proc.new { Rails.env.test? }
before_destroy :send_delete_email, unless: Proc.new { Rails.env.test? }

accepts_nested_attributes_for :prefixes

Expand Down

0 comments on commit 3cdef3d

Please sign in to comment.