Commit a0205f81 authored by's avatar
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
email.destroy! if email.unused?
email.destroy! if email.unused? && !email.deleted?
return json result: 'success'
Supports Markdown
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