diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5b86185..00a8d19 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,7 @@ Changelog - Enh #411: Standardization of Modal Button Positions - Enh #363: Deny access for files from message where current user is not participant - Fix #412: Fix active message after mark unread +- Fix #15: When replying to a message, the conversation is marked as unread 3.2.2 (July 9, 2024) -------------------- diff --git a/models/forms/ReplyForm.php b/models/forms/ReplyForm.php index e21546d..e78c2b5 100644 --- a/models/forms/ReplyForm.php +++ b/models/forms/ReplyForm.php @@ -82,6 +82,14 @@ public function save() $this->reply->refresh(); // Update created_by date, otherwise db expression is set... $this->reply->notify(); $this->reply->fileManager->attach(Yii::$app->request->post('fileList')); + + // Update last viewed date to avoid marking the conversation as unread + $userMessage = $this->model->getUserMessage($this->reply->user_id); + if ($userMessage) { + $userMessage->last_viewed = date('Y-m-d G:i:s'); + $userMessage->save(); + } + return true; }