Commit a0205f81 authored by o@immerda.ch's avatar o@immerda.ch
Browse files

prevent purging when deleting fwd of deleted iaddress

There is an edge-case, when removing the last forward of a deleted
mail_object. E.g. email_user with fwd, first delete email_user,
email_iaddress gets marked as deleted. Then delete fwd and the second
delete triggers a purge. Instead the iaddress must be marked deleted and
kept around to reserve the identifier.
parent 07e1ebf9
Pipeline #9128 passed with stage
in 2 minutes and 35 seconds
......@@ -117,7 +117,7 @@ class IApi < Sinatra::Base
if email = EmailIaddress.by_email(email)
if fwd = email.email_forwards.where(target: target).first
fwd.destroy!
email.destroy! if email.unused?
email.destroy! if email.unused? && !email.deleted?
return json result: 'success'
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment