Open zahid49 opened 6 years ago
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.
How can i get information that particular Thread contains unread messages. So , we can differentiate CSS of threads to look like unread.