From 20d570823d081105505de324eb0644b8463a4abc Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 5 Jan 2020 10:16:01 +0000 Subject: [PATCH] Fix post update / clean up code --- src/Database/PostUpdate.php | 2 ++ src/Model/UserItem.php | 17 +++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Database/PostUpdate.php b/src/Database/PostUpdate.php index 5a2bbae058..f0050e0ef3 100644 --- a/src/Database/PostUpdate.php +++ b/src/Database/PostUpdate.php @@ -487,6 +487,8 @@ class PostUpdate } while ($item = DBA::fetch($items)) { + $id = $item['id']; + UserItem::setNotification($item['id']); ++$rows; diff --git a/src/Model/UserItem.php b/src/Model/UserItem.php index 698176454d..8b3b2b9f14 100644 --- a/src/Model/UserItem.php +++ b/src/Model/UserItem.php @@ -81,19 +81,19 @@ class UserItem return; } - if (self::checkImplicitMention($item, $uid, $profiles)) { + if (self::checkImplicitMention($item, $profiles)) { $notification_type = $notification_type | self::NOTIF_IMPLICIT_TAGGED; } - if (self::checkExplicitMention($item, $uid, $profiles)) { + if (self::checkExplicitMention($item, $profiles)) { $notification_type = $notification_type | self::NOTIF_EXPLICIT_TAGGED; } - if (self::checkCommentedThread($item, $uid, $contacts)) { + if (self::checkCommentedThread($item, $contacts)) { $notification_type = $notification_type | self::NOTIF_THREAD_COMMENT; } - if (self::checkDirectComment($item, $uid, $contacts, $thread)) { + if (self::checkDirectComment($item, $uid, $contacts)) { $notification_type = $notification_type | self::NOTIF_DIRECT_COMMENT; } @@ -198,10 +198,9 @@ class UserItem /** * Check for an implicit mention (only tag, no body) of the given user * @param array $item - * @param int $uid User ID * @return bool The user is mentioned */ - private static function checkImplicitMention($item, $uid, $profiles) + private static function checkImplicitMention($item, $profiles) { foreach ($profiles AS $profile) { if (strpos($item['tag'], '='.$profile.']') || strpos($item['body'], '='.$profile.']')) { @@ -217,10 +216,9 @@ class UserItem /** * Check for an explicit mention (tag and body) of the given user * @param array $item - * @param int $uid User ID * @return bool The user is mentioned */ - private static function checkExplicitMention($item, $uid, $profiles) + private static function checkExplicitMention($item, $profiles) { foreach ($profiles AS $profile) { if (strpos($item['tag'], '='.$profile.']') || strpos($item['body'], '='.$profile.']')) { @@ -236,10 +234,9 @@ class UserItem /** * Check if the given user had created this thread * @param array $item - * @param int $uid User ID * @return bool The user had created this thread */ - private static function checkCommentedThread($item, $uid, $contacts) + private static function checkCommentedThread($item, $contacts) { $condition = ['parent' => $item['parent'], 'author-id' => $contacts, 'deleted' => false, 'gravity' => GRAVITY_PARENT]; return Item::exists($condition); -- 2.39.5