From 3095d4aa706ff6047862f9bde366df70dcee382d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 30 Dec 2018 01:10:10 -0500 Subject: [PATCH] Add parent to private message notifications - Fix item id for Diaspora private message notification --- src/Protocol/DFRN.php | 1 + src/Protocol/Diaspora.php | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index c3366f5bcc..f8405ee92b 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -1870,6 +1870,7 @@ class DFRN "to_email" => $importer["email"], "uid" => $importer["importer_uid"], "item" => $msg, + "parent" => $msg["parent-uri"], "source_name" => $msg["from-name"], "source_link" => $importer["url"], "source_photo" => $importer["thumb"], diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index fb851e3356..b4e494121a 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -1824,6 +1824,8 @@ class Diaspora 'created' => $msg_created_at ]); + $message_id = DBA::lastInsertId(); + DBA::unlock(); DBA::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]); @@ -1834,8 +1836,9 @@ class Diaspora "language" => $importer["language"], "to_name" => $importer["username"], "to_email" => $importer["email"], - "uid" =>$importer["uid"], - "item" => ["id" => $conversation["id"], "title" => $subject, "subject" => $subject, "body" => $body], + "uid" => $importer["uid"], + "item" => ["id" => $message_id, "title" => $subject, "subject" => $subject, "body" => $body], + "parent" => $conversation["id"], "source_name" => $person["name"], "source_link" => $person["url"], "source_photo" => $person["photo"], @@ -2081,9 +2084,28 @@ class Diaspora 'created' => $created_at ]); + $message_id = DBA::lastInsertId(); + DBA::unlock(); DBA::update('conv', ['updated' => DateTimeFormat::utcNow()], ['id' => $conversation["id"]]); + + notification([ + "type" => NOTIFY_MAIL, + "notify_flags" => $importer["notify-flags"], + "language" => $importer["language"], + "to_name" => $importer["username"], + "to_email" => $importer["email"], + "uid" => $importer["uid"], + "item" => ["id" => $message_id, "title" => $conversation["subject"], "subject" => $conversation["subject"], "body" => $body], + "parent" => $conversation["id"], + "source_name" => $person["name"], + "source_link" => $person["url"], + "source_photo" => $person["photo"], + "verb" => ACTIVITY_POST, + "otype" => "mail" + ]); + return true; }