1
0
Fork 0

Don't create notifications for activities

This commit is contained in:
Michael 2020-08-12 08:37:38 +00:00
parent 60631f8a22
commit 8488ed76e4
2 changed files with 28 additions and 24 deletions

View file

@ -603,10 +603,6 @@ function check_item_notification($itemid, $uid, $notification_type) {
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;

View file

@ -58,6 +58,11 @@ class UserItem
return; return;
} }
// "Activity::FOLLOW" is an automated activity, so we ignore it here
if ($item['verb'] == Activity::FOLLOW) {
return;
}
// fetch all users in the thread // fetch all users in the thread
$users = DBA::p("SELECT DISTINCT(`contact`.`uid`) FROM `item` $users = DBA::p("SELECT DISTINCT(`contact`.`uid`) FROM `item`
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0 INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` != 0
@ -102,32 +107,35 @@ class UserItem
return; return;
} }
if (self::checkImplicitMention($item, $profiles)) { // Only create notifications for posts and comments, not for activities
$notification_type = $notification_type | self::NOTIF_IMPLICIT_TAGGED; if (in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT])) {
} if (self::checkImplicitMention($item, $profiles)) {
$notification_type = $notification_type | self::NOTIF_IMPLICIT_TAGGED;
}
if (self::checkExplicitMention($item, $profiles)) { if (self::checkExplicitMention($item, $profiles)) {
$notification_type = $notification_type | self::NOTIF_EXPLICIT_TAGGED; $notification_type = $notification_type | self::NOTIF_EXPLICIT_TAGGED;
} }
if (self::checkCommentedThread($item, $contacts)) { if (self::checkCommentedThread($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_THREAD_COMMENT; $notification_type = $notification_type | self::NOTIF_THREAD_COMMENT;
} }
if (self::checkDirectComment($item, $contacts)) { if (self::checkDirectComment($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_DIRECT_COMMENT; $notification_type = $notification_type | self::NOTIF_DIRECT_COMMENT;
} }
if (self::checkDirectCommentedThread($item, $contacts)) { if (self::checkDirectCommentedThread($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_DIRECT_THREAD_COMMENT; $notification_type = $notification_type | self::NOTIF_DIRECT_THREAD_COMMENT;
} }
if (self::checkCommentedParticipation($item, $contacts)) { if (self::checkCommentedParticipation($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_COMMENT_PARTICIPATION; $notification_type = $notification_type | self::NOTIF_COMMENT_PARTICIPATION;
} }
if (self::checkActivityParticipation($item, $contacts)) { if (self::checkActivityParticipation($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_ACTIVITY_PARTICIPATION; $notification_type = $notification_type | self::NOTIF_ACTIVITY_PARTICIPATION;
}
} }
if (empty($notification_type)) { if (empty($notification_type)) {