From 2418f0798500e5ac8b743632aa374cc5a30d880f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 24 Dec 2016 08:48:50 +0100 Subject: [PATCH] Nicely handle contact deletion on contact edit (#5522) --- CHANGELOG | 1 + program/steps/addressbook/save.inc | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 24aab297b5c..05f59e0904e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Nicely handle contact deletion on contact edit (#5522) - vcard_attachments: Add possibility to attach contact vCard to composed message (#4997) - Preserve message internal/received date on import in mbox format (#5559) - Zipdownload: Fix date format in mbox "From line" diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc index 90704110dd3..49759ff6927 100644 --- a/program/steps/addressbook/save.inc +++ b/program/steps/addressbook/save.inc @@ -158,7 +158,7 @@ if (!empty($cid)) { } // LDAP DN change - if (is_string($result) && strlen($result)>1) { + if (is_string($result) && strlen($result) > 1) { $newcid = $result; // change cid in POST for 'show' action $_POST['_cid'] = $newcid; @@ -167,6 +167,13 @@ if (!empty($cid)) { // refresh contact data for list update and 'show' action $CONTACT_RECORD = $CONTACTS->get_record($newcid ?: $cid, true); + // Plugins can decide to remove the contact on edit, e.g. automatic_addressbook + // Best we can do is to refresh the list (#5522) + if (empty($CONTACT_RECORD)) { + $OUTPUT->command('parent.command', 'list'); + $OUTPUT->send('iframe'); + } + // Update contacts list $a_js_cols = array(); $record = $CONTACT_RECORD;