From 0fe978ea768d05a049631a3a32311b53dbddf6d0 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 16 Feb 2021 08:00:23 +0000 Subject: [PATCH] Avoid a possible foreign key constraint --- include/enotify.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/enotify.php b/include/enotify.php index 8936cadbe..e56b563e3 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -521,11 +521,10 @@ function notification($params) $message_id = "<" . $parent['guid'] . "@" . gethostname() . ">"; // Is this the first email notification for this parent item and user? - if (!DBA::exists('notify-threads', ['master-parent-item' => $params['parent'], 'receiver-uid' => $params['uid']])) { + if (!DBA::exists('notify-threads', ['master-parent-uri-id' => $parent_uri_id, 'receiver-uid' => $params['uid']])) { Logger::log("notify_id:" . intval($notify_id) . ", parent: " . intval($params['parent']) . "uid: " . intval($params['uid']), Logger::DEBUG); - $fields = ['notify-id' => $notify_id, 'master-parent-item' => $params['parent'], - 'master-parent-uri-id' => $parent_uri_id, + $fields = ['notify-id' => $notify_id, 'master-parent-uri-id' => $parent_uri_id, 'receiver-uid' => $params['uid'], 'parent-item' => 0]; DBA::insert('notify-threads', $fields);