Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to know , particular Thread contains unread messages . #49

Open
zahid49 opened this issue Jan 12, 2018 · 1 comment
Open

How to know , particular Thread contains unread messages . #49

zahid49 opened this issue Jan 12, 2018 · 1 comment

Comments

@zahid49
Copy link

zahid49 commented Jan 12, 2018

How can i get information that particular Thread contains unread messages.
So , we can differentiate CSS of threads to look like unread.

@vp93
Copy link

vp93 commented Feb 16, 2019

By using the action stream

markThreadAsRead: Subject<any> = new Subject<any>();

    // on the `updates` stream to mark the Messages as read
    this.markThreadAsRead
      .map( (thread: Thread) => {
        return (messages: Message[]) => {
          return messages.map( (message: Message) => {
            // note that we're manipulating `message` directly here. Mutability
            // can be confusing and there are lots of reasons why you might want
            // to, say, copy the Message object or some other 'immutable' here
            if (message.thread.id === thread.id) {
              message.isRead = true;
            }
            return message;
          });
        };
      })
      .subscribe(this.updates);
  }

now just use the isRead property on message to identify whether a message is read or not, and add the CSS accordingly.

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

No branches or pull requests

2 participants