From 10ffd3a3746cb9a5eb7abcf6461d53b1b769b931 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Tue, 28 Apr 2020 20:32:39 +0000
Subject: [PATCH] Iissue 8560: Wrong value for parent in mail notification

---
 mod/message.php    | 8 +-------
 src/Model/Mail.php | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/mod/message.php b/mod/message.php
index c62a15eb2..c024cbe14 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -352,13 +352,7 @@ function message_content(App $a)
 			$messages = DBA::toArray($messages_stmt);
 
 			DBA::update('mail', ['seen' => 1], ['parent-uri' => $message['parent-uri'], 'uid' => local_user()]);
-
-			if ($message['convid']) {
-				// Clear Diaspora private message notifications
-				DBA::update('notify', ['seen' => 1], ['type' => Type::MAIL, 'parent' => $message['convid'], 'uid' => local_user()]);
-			}
-			// Clear DFRN private message notifications
-			DBA::update('notify', ['seen' => 1], ['type' => Type::MAIL, 'parent' => $message['parent-uri'], 'uid' => local_user()]);
+			DBA::update('notify', ['seen' => 1], ['type' => Type::MAIL, 'parent' => $message['id'], 'uid' => local_user()]);
 		} else {
 			$messages = false;
 		}
diff --git a/src/Model/Mail.php b/src/Model/Mail.php
index c0efe4f23..848b419be 100644
--- a/src/Model/Mail.php
+++ b/src/Model/Mail.php
@@ -92,7 +92,7 @@ class Mail
 			'to_email' => $user['email'],
 			'uid' => $user['uid'],
 			'item' => $msg,
-			'parent' => 0,
+			'parent' => $msg['id'],
 			'source_name' => $msg['from-name'],
 			'source_link' => $msg['from-url'],
 			'source_photo' => $msg['from-photo'],