From 481376dd6f9ccbc54e4e302f8e08ba3f84646882 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 29 Aug 2019 08:41:55 +0200 Subject: [PATCH] Avoid not performing unarchiving --- src/Model/Contact.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index b0e8ec613..dfabf260d 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -903,6 +903,13 @@ class Contact extends BaseObject */ public static function unmarkForArchival(array $contact) { + // Always unarchive the relay contact entry + if (!empty($contact['batch'])) { + $fields = ['term-date' => DBA::NULL_DATETIME, 'archive' => false]; + $condition = ['batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY]; + DBA::update('contact', $fields, $condition); + } + $condition = ['`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], DBA::NULL_DATETIME]; $exists = DBA::exists('contact', $condition); @@ -926,11 +933,6 @@ class Contact extends BaseObject DBA::update('contact', $fields, ['id' => $contact['id']]); DBA::update('contact', $fields, ['nurl' => Strings::normaliseLink($contact['url']), 'self' => false]); GContact::updateFromPublicContactURL($contact['url']); - - if (!empty($contact['batch'])) { - $condition = ['batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY]; - DBA::update('contact', $fields, $condition); - } } /**