Skip to content

Commit

Permalink
Fix select of next read message for redirect after mark as unread
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Jan 26, 2024
1 parent aa6c177 commit fb3e930
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/MailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ private function getNextReadMessage($id): ?Message
->leftJoin('user_message', 'user_message.message_id = message.id')
->where(['user_id' => Yii::$app->user->id])
->andWhere(['!=', 'message_id', $id])
->andWhere(['<=', 'last_viewed', 'updated_at'])
->andWhere('user_message.last_viewed >= message.updated_at')
->orderBy([
'user_message.pinned' => SORT_DESC,
'message.updated_at' => SORT_DESC
Expand Down

0 comments on commit fb3e930

Please sign in to comment.