From fb3e930eee30859fc1a586c362649b2f817e2aa2 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Fri, 26 Jan 2024 14:43:44 +0100 Subject: [PATCH] Fix select of next read message for redirect after mark as unread --- controllers/MailController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/MailController.php b/controllers/MailController.php index f19abbfc..9962b6ba 100644 --- a/controllers/MailController.php +++ b/controllers/MailController.php @@ -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