Skip to content

Commit

Permalink
Fix load more notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed May 2, 2024
1 parent 10d646e commit c9cf690
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions protected/humhub/modules/notification/models/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public static function loadMore($from = 0, $limit = 6)
$query = Notification::findGrouped();

if ($from != 0) {
$query->andWhere(['<', 'id', $from]);
$query->andWhere(['<', 'notification.id', $from]);
}

$query->limit($limit);
Expand Down Expand Up @@ -258,7 +258,7 @@ public static function findGrouped(User $user = null, $sendWebNotifications = 1)
new Expression('min(notification.seen) as group_seen'),
]);

$query->andWhere(['user_id' => $user->id]);
$query->andWhere(['notification.user_id' => $user->id]);

// Exclude all not published contents
$query->leftJoin('content', 'content.object_model = notification.source_class AND content.object_id = notification.source_pk')
Expand Down Expand Up @@ -288,8 +288,8 @@ public static function findGrouped(User $user = null, $sendWebNotifications = 1)
public static function findUnseen(User $user = null)
{
return Notification::findGrouped($user)
->andWhere(['seen' => 0])
->orWhere(['IS', 'seen', new Expression('NULL')]);
->andWhere(['notification.seen' => 0])
->orWhere(['IS', 'notification.seen', new Expression('NULL')]);
}

/**
Expand All @@ -302,7 +302,7 @@ public static function findUnseen(User $user = null)
*/
public static function findUnnotifiedInFrontend(User $user = null)
{
return self::findUnseen($user)->andWhere(['desktop_notified' => 0]);
return self::findUnseen($user)->andWhere(['notification.desktop_notified' => 0]);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function createQuery(): ActiveQuery

$this->query = Notification::findGrouped();
if ($this->hasFilter()) {
$this->query->andFilterWhere(['not in', 'class', $this->getExcludeClassFilter()]);
$this->query->andFilterWhere(['not in', 'notification.class', $this->getExcludeClassFilter()]);
}

return $this->query;
Expand Down

0 comments on commit c9cf690

Please sign in to comment.