Skip to content

Commit

Permalink
receive last_read_msg_id from server
Browse files Browse the repository at this point in the history
also populate last_read_message_id
  • Loading branch information
shaljam committed Apr 11, 2023
1 parent 716db00 commit d3d1368
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,7 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
for (const read of state.read) {
this.state.read[read.user.id] = {
last_read: new Date(read.last_read),
last_read_message_id: read.last_read_msg_id,
unread_messages: read.unread_messages ?? 0,
user: read.user,
};
Expand Down
2 changes: 1 addition & 1 deletion src/channel_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

type ChannelReadStatus<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = Record<
string,
{ last_read: Date; unread_messages: number; user: UserResponse<StreamChatGenerics> }
{ last_read: Date; unread_messages: number; user: UserResponse<StreamChatGenerics>; last_read_message_id?: string }
>;

/**
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ export type ReactionResponse<

export type ReadResponse<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
last_read: string;
last_read_msg_id: string;
user: UserResponse<StreamChatGenerics>;
unread_messages?: number;
};
Expand Down

0 comments on commit d3d1368

Please sign in to comment.