Skip to content

feat: add unread message indicator and scroll functionality in person…#2111

Open
Ashwin-op wants to merge 1 commit intocommudle:test-serverfrom
Ashwin-op:feature/personal-chat-read-receipt
Open

feat: add unread message indicator and scroll functionality in person…#2111
Ashwin-op wants to merge 1 commit intocommudle:test-serverfrom
Ashwin-op:feature/personal-chat-read-receipt

Conversation

@Ashwin-op
Copy link
Contributor

…al discussion chat

PR Template

Type

  • ( ) Fix
  • ( ) Refactor
  • ( ) Style
  • ( ) Docs
  • (X) Feat
  • ( ) Hotfix
  • ( ) Merge
  • ( ) Revamp
  • ( ) Chore

Description

Screenshots

Testing

Bundle Size

@Ashwin-op Ashwin-op self-assigned this Oct 14, 2025
Copilot AI review requested due to automatic review settings October 14, 2025 14:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds unread message indicator and scroll functionality to the personal discussion chat. The changes enable users to see where they left off in a conversation by highlighting the first unread message and automatically scrolling to it.

Key changes include:

  • Uncommented and imported the UserMessageReceiptHandlerService to enable message read tracking
  • Added scroll-to-unread functionality that finds and scrolls to the first unread message on initial load
  • Added a visual "You left off here" divider that appears above the first unread message

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
message.component.ts Re-enabled message receipt tracking by uncommenting service import and markAsRead method
discussion-personal-chat.component.ts Added logic to find first unread message and scroll to it on initial load
discussion-personal-chat.component.scss Added styling for the unread message divider with red accent color
discussion-personal-chat.component.html Added visual divider element and message ID attributes for scroll targeting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

try {
// If there's a scroll target message (first unread), scroll to it
if (this.scrollToMessageId) {
const messageElement = document.getElementById(`message-${this.scrollToMessageId}`);
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using document.getElementById for DOM manipulation in Angular is not recommended. Consider using ViewChild, template reference variables, or the Renderer2 service for better Angular integration and testability.

Copilot uses AI. Check for mistakes.

// On first load, find the first unread message to scroll to
if (this.nextPage === 1) {
const firstUnreadMessage = this.messages.find((msg) => !msg.read);
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic assumes that messages have a 'read' property, but this should be validated or documented. Consider adding a type guard or null check to ensure the property exists and is properly typed.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants