Rename Model\Post\UserNotifications type constants

This commit is contained in:
Hypolite Petovan 2021-09-17 22:14:32 -04:00
parent 47acb6a278
commit bf81f21001
5 changed files with 84 additions and 73 deletions

View file

@ -2193,11 +2193,14 @@ function api_statuses_mentions($type)
(SELECT `uri-id` FROM `post-user-notification` WHERE `uid` = ? AND `notification-type` & ? != 0 ORDER BY `uri-id`) (SELECT `uri-id` FROM `post-user-notification` WHERE `uid` = ? AND `notification-type` & ? != 0 ORDER BY `uri-id`)
AND (`uid` = 0 OR (`uid` = ? AND NOT `global`)) AND `id` > ?"; AND (`uid` = 0 OR (`uid` = ? AND NOT `global`)) AND `id` > ?";
$condition = [GRAVITY_PARENT, GRAVITY_COMMENT, api_user(), $condition = [
Post\UserNotification::NOTIF_EXPLICIT_TAGGED | Post\UserNotification::NOTIF_IMPLICIT_TAGGED | GRAVITY_PARENT, GRAVITY_COMMENT,
Post\UserNotification::NOTIF_THREAD_COMMENT | Post\UserNotification::NOTIF_DIRECT_COMMENT | api_user(),
Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT, Post\UserNotification::TYPE_EXPLICIT_TAGGED | Post\UserNotification::TYPE_IMPLICIT_TAGGED |
api_user(), $since_id]; Post\UserNotification::TYPE_THREAD_COMMENT | Post\UserNotification::TYPE_DIRECT_COMMENT |
Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT,
api_user(), $since_id,
];
if ($max_id > 0) { if ($max_id > 0) {
$query .= " AND `id` <= ?"; $query .= " AND `id` <= ?";

View file

@ -495,7 +495,7 @@ function notification_from_array(array $notification)
{ {
Logger::info('Start', ['uid' => $notification['uid'], 'id' => $notification['id'], 'type' => $notification['type']]); Logger::info('Start', ['uid' => $notification['uid'], 'id' => $notification['id'], 'type' => $notification['type']]);
if ($notification['type'] == Post\UserNotification::NOTIF_NONE) { if ($notification['type'] == Post\UserNotification::TYPE_NONE) {
Logger::info('Not an item based notification, quitting', ['uid' => $notification['uid'], 'id' => $notification['id'], 'type' => $notification['type']]); Logger::info('Not an item based notification, quitting', ['uid' => $notification['uid'], 'id' => $notification['id'], 'type' => $notification['type']]);
return false; return false;
} }
@ -562,10 +562,10 @@ function notification_from_array(array $notification)
// So, we cannot have different subjects for notifications of the same thread. // So, we cannot have different subjects for notifications of the same thread.
// Before this we have the name of the replier on the subject rendering // Before this we have the name of the replier on the subject rendering
// different subjects for messages on the same thread. // different subjects for messages on the same thread.
if ($notification['type'] == Post\UserNotification::NOTIF_EXPLICIT_TAGGED) { if ($notification['type'] == Post\UserNotification::TYPE_EXPLICIT_TAGGED) {
$params['type'] = Notification\Type::TAG_SELF; $params['type'] = Notification\Type::TAG_SELF;
$subject = $l10n->t('%s %s tagged you', $subjectPrefix, $contact['name']); $subject = $l10n->t('%s %s tagged you', $subjectPrefix, $contact['name']);
} elseif ($notification['type'] == Post\UserNotification::NOTIF_SHARED) { } elseif ($notification['type'] == Post\UserNotification::TYPE_SHARED) {
$params['type'] = Notification\Type::SHARE; $params['type'] = Notification\Type::SHARE;
$subject = $l10n->t('%s %s shared a new post', $subjectPrefix, $contact['name']); $subject = $l10n->t('%s %s shared a new post', $subjectPrefix, $contact['name']);
} else { } else {

View file

@ -44,20 +44,24 @@ class Notification extends BaseModel
*/ */
public static function getType(array $notification): string public static function getType(array $notification): string
{ {
if (($notification['vid'] == Verb::getID(Activity::FOLLOW)) && ($notification['type'] == Post\UserNotification::NOTIF_NONE)) { if (($notification['vid'] == Verb::getID(Activity::FOLLOW)) && ($notification['type'] == Post\UserNotification::TYPE_NONE)) {
$contact = Contact::getById($notification['actor-id'], ['pending']); $contact = Contact::getById($notification['actor-id'], ['pending']);
$type = $contact['pending'] ? 'follow_request' : 'follow'; $type = $contact['pending'] ? 'follow_request' : 'follow';
} elseif (($notification['vid'] == Verb::getID(Activity::ANNOUNCE)) && } elseif (($notification['vid'] == Verb::getID(Activity::ANNOUNCE)) &&
in_array($notification['type'], [Post\UserNotification::NOTIF_DIRECT_COMMENT, Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT])) { in_array($notification['type'], [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) {
$type = 'reblog'; $type = 'reblog';
} elseif (in_array($notification['vid'], [Verb::getID(Activity::LIKE), Verb::getID(Activity::DISLIKE)]) && } elseif (in_array($notification['vid'], [Verb::getID(Activity::LIKE), Verb::getID(Activity::DISLIKE)]) &&
in_array($notification['type'], [Post\UserNotification::NOTIF_DIRECT_COMMENT, Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT])) { in_array($notification['type'], [Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT])) {
$type = 'favourite'; $type = 'favourite';
} elseif ($notification['type'] == Post\UserNotification::NOTIF_SHARED) { } elseif ($notification['type'] == Post\UserNotification::TYPE_SHARED) {
$type = 'status'; $type = 'status';
} elseif (in_array($notification['type'], [Post\UserNotification::NOTIF_EXPLICIT_TAGGED, } elseif (in_array($notification['type'], [
Post\UserNotification::NOTIF_IMPLICIT_TAGGED, Post\UserNotification::NOTIF_DIRECT_COMMENT, Post\UserNotification::TYPE_EXPLICIT_TAGGED,
Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT, Post\UserNotification::NOTIF_THREAD_COMMENT])) { Post\UserNotification::TYPE_IMPLICIT_TAGGED,
Post\UserNotification::TYPE_DIRECT_COMMENT,
Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT,
Post\UserNotification::TYPE_THREAD_COMMENT
])) {
$type = 'mention'; $type = 'mention';
} else { } else {
return ''; return '';
@ -90,7 +94,7 @@ class Notification extends BaseModel
return $message; return $message;
} }
if ($notification['type'] == Post\UserNotification::NOTIF_NONE) { if ($notification['type'] == Post\UserNotification::TYPE_NONE) {
if ($contact['pending']) { if ($contact['pending']) {
$msg = $l10n->t('%1$s wants to follow you'); $msg = $l10n->t('%1$s wants to follow you');
} else { } else {
@ -108,7 +112,7 @@ class Notification extends BaseModel
$announce = Verb::getID(Activity::ANNOUNCE); $announce = Verb::getID(Activity::ANNOUNCE);
$post = Verb::getID(Activity::POST); $post = Verb::getID(Activity::POST);
if (in_array($notification['type'], [Post\UserNotification::NOTIF_THREAD_COMMENT, Post\UserNotification::NOTIF_COMMENT_PARTICIPATION, Post\UserNotification::NOTIF_ACTIVITY_PARTICIPATION, Post\UserNotification::NOTIF_EXPLICIT_TAGGED])) { if (in_array($notification['type'], [Post\UserNotification::TYPE_THREAD_COMMENT, Post\UserNotification::TYPE_COMMENT_PARTICIPATION, Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION, Post\UserNotification::TYPE_EXPLICIT_TAGGED])) {
$item = Post::selectFirst([], ['uri-id' => $notification['parent-uri-id'], 'uid' => [0, $notification['uid']]], ['order' => ['uid' => true]]); $item = Post::selectFirst([], ['uri-id' => $notification['parent-uri-id'], 'uid' => [0, $notification['uid']]], ['order' => ['uid' => true]]);
if (empty($item)) { if (empty($item)) {
Logger::info('Parent post not found', ['uri-id' => $notification['parent-uri-id']]); Logger::info('Parent post not found', ['uri-id' => $notification['parent-uri-id']]);
@ -137,13 +141,13 @@ class Notification extends BaseModel
$cid = $item['causer-id']; $cid = $item['causer-id'];
} }
if (($notification['type'] == Post\UserNotification::NOTIF_SHARED) && !empty($cid)) { if (($notification['type'] == Post\UserNotification::TYPE_SHARED) && !empty($cid)) {
$causer = Contact::getById($cid, ['id', 'name', 'url']); $causer = Contact::getById($cid, ['id', 'name', 'url']);
if (empty($contact)) { if (empty($contact)) {
Logger::info('Causer not found', ['causer' => $cid]); Logger::info('Causer not found', ['causer' => $cid]);
return $message; return $message;
} }
} elseif (in_array($notification['type'], [Post\UserNotification::NOTIF_COMMENT_PARTICIPATION, Post\UserNotification::NOTIF_ACTIVITY_PARTICIPATION])) { } elseif (in_array($notification['type'], [Post\UserNotification::TYPE_COMMENT_PARTICIPATION, Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION])) {
$contact = Contact::getById($item['author-id'], ['id', 'name', 'url']); $contact = Contact::getById($item['author-id'], ['id', 'name', 'url']);
if (empty($contact)) { if (empty($contact)) {
Logger::info('Author not found', ['author' => $item['author-id']]); Logger::info('Author not found', ['author' => $item['author-id']]);
@ -163,54 +167,54 @@ class Notification extends BaseModel
switch ($notification['vid']) { switch ($notification['vid']) {
case $like: case $like:
switch ($notification['type']) { switch ($notification['type']) {
case Post\UserNotification::NOTIF_DIRECT_COMMENT: case Post\UserNotification::TYPE_DIRECT_COMMENT:
$msg = $l10n->t('%1$s liked your comment %2$s'); $msg = $l10n->t('%1$s liked your comment %2$s');
break; break;
case Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT: case Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT:
$msg = $l10n->t('%1$s liked your post %2$s'); $msg = $l10n->t('%1$s liked your post %2$s');
break; break;
} }
break; break;
case $dislike: case $dislike:
switch ($notification['type']) { switch ($notification['type']) {
case Post\UserNotification::NOTIF_DIRECT_COMMENT: case Post\UserNotification::TYPE_DIRECT_COMMENT:
$msg = $l10n->t('%1$s disliked your comment %2$s'); $msg = $l10n->t('%1$s disliked your comment %2$s');
break; break;
case Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT: case Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT:
$msg = $l10n->t('%1$s disliked your post %2$s'); $msg = $l10n->t('%1$s disliked your post %2$s');
break; break;
} }
break; break;
case $announce: case $announce:
switch ($notification['type']) { switch ($notification['type']) {
case Post\UserNotification::NOTIF_DIRECT_COMMENT: case Post\UserNotification::TYPE_DIRECT_COMMENT:
$msg = $l10n->t('%1$s shared your comment %2$s'); $msg = $l10n->t('%1$s shared your comment %2$s');
break; break;
case Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT: case Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT:
$msg = $l10n->t('%1$s shared your post %2$s'); $msg = $l10n->t('%1$s shared your post %2$s');
break; break;
} }
break; break;
case $post: case $post:
switch ($notification['type']) { switch ($notification['type']) {
case Post\UserNotification::NOTIF_EXPLICIT_TAGGED: case Post\UserNotification::TYPE_EXPLICIT_TAGGED:
$msg = $l10n->t('%1$s tagged you on %2$s'); $msg = $l10n->t('%1$s tagged you on %2$s');
break; break;
case Post\UserNotification::NOTIF_IMPLICIT_TAGGED: case Post\UserNotification::TYPE_IMPLICIT_TAGGED:
$msg = $l10n->t('%1$s replied to you on %2$s'); $msg = $l10n->t('%1$s replied to you on %2$s');
break; break;
case Post\UserNotification::NOTIF_THREAD_COMMENT: case Post\UserNotification::TYPE_THREAD_COMMENT:
$msg = $l10n->t('%1$s commented in your thread %2$s'); $msg = $l10n->t('%1$s commented in your thread %2$s');
break; break;
case Post\UserNotification::NOTIF_DIRECT_COMMENT: case Post\UserNotification::TYPE_DIRECT_COMMENT:
$msg = $l10n->t('%1$s commented on your comment %2$s'); $msg = $l10n->t('%1$s commented on your comment %2$s');
break; break;
case Post\UserNotification::NOTIF_COMMENT_PARTICIPATION: case Post\UserNotification::TYPE_COMMENT_PARTICIPATION:
case Post\UserNotification::NOTIF_ACTIVITY_PARTICIPATION: case Post\UserNotification::TYPE_ACTIVITY_PARTICIPATION:
if (($causer['id'] == $contact['id']) && ($title != '')) { if (($causer['id'] == $contact['id']) && ($title != '')) {
$msg = $l10n->t('%1$s commented in their thread %2$s'); $msg = $l10n->t('%1$s commented in their thread %2$s');
} elseif ($causer['id'] == $contact['id']) { } elseif ($causer['id'] == $contact['id']) {
@ -222,11 +226,11 @@ class Notification extends BaseModel
} }
break; break;
case Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT: case Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT:
$msg = $l10n->t('%1$s commented on your thread %2$s'); $msg = $l10n->t('%1$s commented on your thread %2$s');
break; break;
case Post\UserNotification::NOTIF_SHARED: case Post\UserNotification::TYPE_SHARED:
if (($causer['id'] != $contact['id']) && ($title != '')) { if (($causer['id'] != $contact['id']) && ($title != '')) {
$msg = $l10n->t('%1$s shared the post %2$s from %3$s'); $msg = $l10n->t('%1$s shared the post %2$s from %3$s');
} elseif ($causer['id'] != $contact['id']) { } elseif ($causer['id'] != $contact['id']) {

View file

@ -39,16 +39,15 @@ use Friendica\Util\DateTimeFormat;
class UserNotification class UserNotification
{ {
// Notification types // Notification types
const NOTIF_NONE = 0; const TYPE_NONE = 0;
const NOTIF_EXPLICIT_TAGGED = 1; const TYPE_EXPLICIT_TAGGED = 1;
const NOTIF_IMPLICIT_TAGGED = 2; const TYPE_IMPLICIT_TAGGED = 2;
const NOTIF_THREAD_COMMENT = 4; const TYPE_THREAD_COMMENT = 4;
const NOTIF_DIRECT_COMMENT = 8; const TYPE_DIRECT_COMMENT = 8;
const NOTIF_COMMENT_PARTICIPATION = 16; const TYPE_COMMENT_PARTICIPATION = 16;
const NOTIF_ACTIVITY_PARTICIPATION = 32; const TYPE_ACTIVITY_PARTICIPATION = 32;
const NOTIF_DIRECT_THREAD_COMMENT = 64; const TYPE_DIRECT_THREAD_COMMENT = 64;
const NOTIF_SHARED = 128; const TYPE_SHARED = 128;
/** /**
* Insert a new user notification entry * Insert a new user notification entry
@ -174,11 +173,11 @@ class UserNotification
return; return;
} }
$notification_type = self::NOTIF_NONE; $notification_type = self::TYPE_NONE;
if (self::checkShared($item, $uid)) { if (self::checkShared($item, $uid)) {
$notification_type = $notification_type | self::NOTIF_SHARED; $notification_type = $notification_type | self::TYPE_SHARED;
self::insertNoticationByItem(self::NOTIF_SHARED, $uid, $item); self::insertNoticationByItem(self::TYPE_SHARED, $uid, $item);
$notified = true; $notified = true;
} else { } else {
$notified = false; $notified = false;
@ -200,57 +199,57 @@ class UserNotification
} }
if (self::checkExplicitMention($item, $profiles)) { if (self::checkExplicitMention($item, $profiles)) {
$notification_type = $notification_type | self::NOTIF_EXPLICIT_TAGGED; $notification_type = $notification_type | self::TYPE_EXPLICIT_TAGGED;
if (!$notified) { if (!$notified) {
self::insertNoticationByItem( self::NOTIF_EXPLICIT_TAGGED, $uid, $item); self::insertNoticationByItem( self::TYPE_EXPLICIT_TAGGED, $uid, $item);
$notified = true; $notified = true;
} }
} }
if (self::checkImplicitMention($item, $profiles)) { if (self::checkImplicitMention($item, $profiles)) {
$notification_type = $notification_type | self::NOTIF_IMPLICIT_TAGGED; $notification_type = $notification_type | self::TYPE_IMPLICIT_TAGGED;
if (!$notified) { if (!$notified) {
self::insertNoticationByItem(self::NOTIF_IMPLICIT_TAGGED, $uid, $item); self::insertNoticationByItem(self::TYPE_IMPLICIT_TAGGED, $uid, $item);
$notified = true; $notified = true;
} }
} }
if (self::checkDirectComment($item, $contacts)) { if (self::checkDirectComment($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_DIRECT_COMMENT; $notification_type = $notification_type | self::TYPE_DIRECT_COMMENT;
if (!$notified) { if (!$notified) {
self::insertNoticationByItem(self::NOTIF_DIRECT_COMMENT, $uid, $item); self::insertNoticationByItem(self::TYPE_DIRECT_COMMENT, $uid, $item);
$notified = true; $notified = true;
} }
} }
if (self::checkDirectCommentedThread($item, $contacts)) { if (self::checkDirectCommentedThread($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_DIRECT_THREAD_COMMENT; $notification_type = $notification_type | self::TYPE_DIRECT_THREAD_COMMENT;
if (!$notified) { if (!$notified) {
self::insertNoticationByItem(self::NOTIF_DIRECT_THREAD_COMMENT, $uid, $item); self::insertNoticationByItem(self::TYPE_DIRECT_THREAD_COMMENT, $uid, $item);
$notified = true; $notified = true;
} }
} }
if (self::checkCommentedThread($item, $contacts)) { if (self::checkCommentedThread($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_THREAD_COMMENT; $notification_type = $notification_type | self::TYPE_THREAD_COMMENT;
if (!$notified) { if (!$notified) {
self::insertNoticationByItem(self::NOTIF_THREAD_COMMENT, $uid, $item); self::insertNoticationByItem(self::TYPE_THREAD_COMMENT, $uid, $item);
$notified = true; $notified = true;
} }
} }
if (self::checkCommentedParticipation($item, $contacts)) { if (self::checkCommentedParticipation($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_COMMENT_PARTICIPATION; $notification_type = $notification_type | self::TYPE_COMMENT_PARTICIPATION;
if (!$notified) { if (!$notified) {
self::insertNoticationByItem(self::NOTIF_COMMENT_PARTICIPATION, $uid, $item); self::insertNoticationByItem(self::TYPE_COMMENT_PARTICIPATION, $uid, $item);
$notified = true; $notified = true;
} }
} }
if (self::checkActivityParticipation($item, $contacts)) { if (self::checkActivityParticipation($item, $contacts)) {
$notification_type = $notification_type | self::NOTIF_ACTIVITY_PARTICIPATION; $notification_type = $notification_type | self::TYPE_ACTIVITY_PARTICIPATION;
if (!$notified) { if (!$notified) {
self::insertNoticationByItem(self::NOTIF_ACTIVITY_PARTICIPATION, $uid, $item); self::insertNoticationByItem(self::TYPE_ACTIVITY_PARTICIPATION, $uid, $item);
$notified = true; $notified = true;
} }
} }
@ -278,7 +277,7 @@ class UserNotification
private static function insertNoticationByItem(int $type, int $uid, array $item) private static function insertNoticationByItem(int $type, int $uid, array $item)
{ {
if (($item['gravity'] == GRAVITY_ACTIVITY) && if (($item['gravity'] == GRAVITY_ACTIVITY) &&
!in_array($type, [self::NOTIF_DIRECT_COMMENT, self::NOTIF_DIRECT_THREAD_COMMENT])) { !in_array($type, [self::TYPE_DIRECT_COMMENT, self::TYPE_DIRECT_THREAD_COMMENT])) {
// Activities are only stored when performed on the user's post or comment // Activities are only stored when performed on the user's post or comment
return; return;
} }
@ -321,7 +320,7 @@ class UserNotification
$fields = [ $fields = [
'uid' => $uid, 'uid' => $uid,
'vid' => $vid, 'vid' => $vid,
'type' => self::NOTIF_NONE, 'type' => self::TYPE_NONE,
'actor-id' => $actor, 'actor-id' => $actor,
'created' => DateTimeFormat::utcNow(), 'created' => DateTimeFormat::utcNow(),
]; ];

View file

@ -77,37 +77,42 @@ class Notifications extends BaseApi
if (in_array('follow_request', $request['exclude_types'])) { if (in_array('follow_request', $request['exclude_types'])) {
$condition = DBA::mergeConditions($condition, $condition = DBA::mergeConditions($condition,
["(`vid` != ? OR `type` != ? OR NOT EXISTS (SELECT `id` FROM `contact` WHERE `id` = `actor-id` AND `pending`))", ["(`vid` != ? OR `type` != ? OR NOT EXISTS (SELECT `id` FROM `contact` WHERE `id` = `actor-id` AND `pending`))",
Verb::getID(Activity::FOLLOW), Post\UserNotification::NOTIF_NONE]); Verb::getID(Activity::FOLLOW), Post\UserNotification::TYPE_NONE]);
} }
if (in_array('follow', $request['exclude_types'])) { if (in_array('follow', $request['exclude_types'])) {
$condition = DBA::mergeConditions($condition, $condition = DBA::mergeConditions($condition,
["(`vid` != ? OR `type` != ? OR NOT EXISTS (SELECT `id` FROM `contact` WHERE `id` = `actor-id` AND NOT `pending`))", ["(`vid` != ? OR `type` != ? OR NOT EXISTS (SELECT `id` FROM `contact` WHERE `id` = `actor-id` AND NOT `pending`))",
Verb::getID(Activity::FOLLOW), Post\UserNotification::NOTIF_NONE]); Verb::getID(Activity::FOLLOW), Post\UserNotification::TYPE_NONE]);
} }
if (in_array('favourite', $request['exclude_types'])) { if (in_array('favourite', $request['exclude_types'])) {
$condition = DBA::mergeConditions($condition, ["(NOT `vid` IN (?, ?) OR NOT `type` IN (?, ?))", $condition = DBA::mergeConditions($condition, [
"(NOT `vid` IN (?, ?) OR NOT `type` IN (?, ?))",
Verb::getID(Activity::LIKE), Verb::getID(Activity::DISLIKE), Verb::getID(Activity::LIKE), Verb::getID(Activity::DISLIKE),
Post\UserNotification::NOTIF_DIRECT_COMMENT, Post\UserNotification::NOTIF_THREAD_COMMENT]); Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_THREAD_COMMENT
]);
} }
if (in_array('reblog', $request['exclude_types'])) { if (in_array('reblog', $request['exclude_types'])) {
$condition = DBA::mergeConditions($condition, ["(NOT `vid` IN (?) OR NOT `type` IN (?, ?))", $condition = DBA::mergeConditions($condition, [
"(NOT `vid` IN (?) OR NOT `type` IN (?, ?))",
Verb::getID(Activity::ANNOUNCE), Verb::getID(Activity::ANNOUNCE),
Post\UserNotification::NOTIF_DIRECT_COMMENT, Post\UserNotification::NOTIF_THREAD_COMMENT]); Post\UserNotification::TYPE_DIRECT_COMMENT, Post\UserNotification::TYPE_THREAD_COMMENT
]);
} }
if (in_array('mention', $request['exclude_types'])) { if (in_array('mention', $request['exclude_types'])) {
$condition = DBA::mergeConditions($condition, ["(NOT `vid` IN (?) OR NOT `type` IN (?, ?, ?, ?, ?))", $condition = DBA::mergeConditions($condition, [
Verb::getID(Activity::POST), Post\UserNotification::NOTIF_EXPLICIT_TAGGED, "(NOT `vid` IN (?) OR NOT `type` IN (?, ?, ?, ?, ?))",
Post\UserNotification::NOTIF_IMPLICIT_TAGGED, Post\UserNotification::NOTIF_DIRECT_COMMENT, Verb::getID(Activity::POST), Post\UserNotification::TYPE_EXPLICIT_TAGGED,
Post\UserNotification::NOTIF_DIRECT_THREAD_COMMENT, Post\UserNotification::NOTIF_THREAD_COMMENT]); Post\UserNotification::TYPE_IMPLICIT_TAGGED, Post\UserNotification::TYPE_DIRECT_COMMENT,
Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT, Post\UserNotification::TYPE_THREAD_COMMENT]);
} }
if (in_array('status', $request['exclude_types'])) { if (in_array('status', $request['exclude_types'])) {
$condition = DBA::mergeConditions($condition, ["(NOT `vid` IN (?) OR NOT `type` IN (?))", $condition = DBA::mergeConditions($condition, ["(NOT `vid` IN (?) OR NOT `type` IN (?))",
Verb::getID(Activity::POST), Post\UserNotification::NOTIF_SHARED]); Verb::getID(Activity::POST), Post\UserNotification::TYPE_SHARED]);
} }
if (!empty($request['max_id'])) { if (!empty($request['max_id'])) {