From 10abd7b0aebb1773043a4556a862ff71c2d61803 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 29 May 2018 18:31:48 +0200 Subject: [PATCH] Delete account meta data when field is made empty. --- app/Services/Internal/Support/AccountServiceTrait.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index e4a48fced5..a32fb802f9 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -346,6 +346,9 @@ trait AccountServiceTrait Log::debug(sprintf('Updated meta-field "%s":"%s" for #%d ("%s") ', $field, $data[$field], $account->id, $account->name)); } } + if (null !== $entry && isset($data[$field]) && \strlen((string)$data[$field]) === 0) { + $entry->delete(); + } } }