X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fenotify.php;h=8b98f9059072e2bb8978edd09f1ce2d29add6517;hb=2bfd53bf092cd97ad96df9406b40b16362a56fc9;hp=e89857b4041cc75d2bedd024ff739d52625a5f76;hpb=f5504ed8d1f59a59004fc3b8600eaa7ce141c369;p=friendica.git diff --git a/include/enotify.php b/include/enotify.php index e89857b404..8b98f90590 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -509,7 +509,8 @@ function notification($params) Logger::log('sending notification email'); if (isset($params['parent']) && (intval($params['parent']) != 0)) { - $id_for_parent = $params['parent'] . "@" . $hostname; + $parent = Item::selectFirst(['guid'], ['id' => $params['parent']]); + $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']])) { @@ -520,13 +521,13 @@ function notification($params) 'receiver-uid' => $params['uid'], 'parent-item' => 0]; DBA::insert('notify-threads', $fields); - $additional_mail_header .= "Message-ID: <${id_for_parent}>\n"; + $additional_mail_header .= "Message-ID: " . $message_id . "\n"; $log_msg = "include/enotify: No previous notification found for this parent:\n" . " parent: ${params['parent']}\n" . " uid : ${params['uid']}\n"; Logger::log($log_msg, Logger::DEBUG); } else { // If not, just "follow" the thread. - $additional_mail_header .= "References: <${id_for_parent}>\nIn-Reply-To: <${id_for_parent}>\n"; + $additional_mail_header .= "References: " . $message_id . "\nIn-Reply-To: " . $message_id . "\n"; Logger::log("There's already a notification for this parent.", Logger::DEBUG); } } @@ -645,6 +646,11 @@ function check_item_notification($itemid, $uid, $notification_type) { if ($item['gravity'] == GRAVITY_ACTIVITY) { $parent_item = Item::selectFirst($fields, ['uri-id' => $item['thr-parent-id'], 'uid' => [$uid, 0]]); if (DBA::isResult($parent_item)) { + // Don't notify on own entries + if (User::getIdForURL($parent_item['author-link']) == $uid) { + return false; + } + $params['origin_name'] = $parent_item['author-name']; $params['origin_link'] = $parent_item['author-link']; $params['origin_photo'] = $parent_item['author-avatar'];