Avoid getting too much notifications

This commit is contained in:
Michael 2020-08-12 06:50:02 +00:00
parent 26df7595ac
commit 60631f8a22

View File

@ -596,13 +596,17 @@ function check_user_notification($itemid) {
function check_item_notification($itemid, $uid, $notification_type) { function check_item_notification($itemid, $uid, $notification_type) {
$fields = ['id', 'uri-id', 'mention', 'parent', 'parent-uri-id', 'title', 'body', $fields = ['id', 'uri-id', 'mention', 'parent', 'parent-uri-id', 'title', 'body',
'author-link', 'author-name', 'author-avatar', 'author-id', 'author-link', 'author-name', 'author-avatar', 'author-id',
'guid', 'parent-uri', 'uri', 'contact-id', 'network']; 'guid', 'parent-uri', 'uri', 'contact-id', 'network', 'gravity', 'verb'];
$condition = ['id' => $itemid, 'deleted' => false]; $condition = ['id' => $itemid, 'deleted' => false];
$item = Item::selectFirstForUser($uid, $fields, $condition); $item = Item::selectFirstForUser($uid, $fields, $condition);
if (!DBA::isResult($item)) { if (!DBA::isResult($item)) {
return false; return false;
} }
if (!in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT]) && ($item['verb'] != Activity::ANNOUNCE)) {
return false;
}
// Generate the notification array // Generate the notification array
$params = []; $params = [];
$params['uid'] = $uid; $params['uid'] = $uid;