From 258d5fa69550ba5c2ff9ed7e06ad18be077675b7 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 26 Jun 2021 11:29:58 +0000 Subject: [PATCH 1/2] Issue 10433: Only notify when there had been changes --- src/Model/Item.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 5f1aaf396..26834c3a8 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -159,6 +159,10 @@ class Item $fields['vid'] = Verb::getID($fields['verb']); } + if (empty($fields['edited'])) { + $previous = Post::selectFirst(['edited'], $condition); + } + $rows = Post::update($fields, $condition); if (is_bool($rows)) { return $rows; @@ -203,8 +207,8 @@ class Item } // We only need to notfiy others when it is an original entry from us. - // Only call the notifier when the item has some content relevant change. - if ($item['origin'] && in_array('edited', array_keys($fields))) { + // Only call the notifier when the item had been edited and records had been changed. + if ($item['origin'] && !empty($fields['edited']) && ($previous['edited'] != $fields['edited'])) { $notify_items[] = $item['id']; } } From de2898988bd99aad8c74d077920d432bc536c2fe Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 26 Jun 2021 11:31:37 +0000 Subject: [PATCH 2/2] Inverted condition --- src/Model/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 26834c3a8..871ff9ad8 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -159,7 +159,7 @@ class Item $fields['vid'] = Verb::getID($fields['verb']); } - if (empty($fields['edited'])) { + if (!empty($fields['edited'])) { $previous = Post::selectFirst(['edited'], $condition); }