@@ -2,10 +2,10 @@ import { StateStore } from './store';
22import { formatMessage , localMessageToNewMessagePayload } from './utils' ;
33import type {
44 DraftResponse ,
5- EventAPIResponse ,
65 EventType ,
76 LocalMessage ,
87 MarkReadRequest ,
8+ MarkReadResponseEvent ,
99 MessageResponse ,
1010 ReadStateResponse ,
1111 SortParamRequest ,
@@ -67,7 +67,7 @@ const DEFAULT_ITEM_ORDER: SortParamRequest[] = [{ field: 'created_at', direction
6767export type CustomThreadMarkReadRequestFn = ( params : {
6868 thread : Thread ;
6969 options ?: MarkReadRequest ;
70- } ) => Promise < EventAPIResponse | null > | void ;
70+ } ) => Promise < { event : MarkReadResponseEvent } | null > | void ;
7171
7272export type ThreadInstanceConfig = {
7373 requestHandlers ?: {
@@ -131,7 +131,7 @@ export class Thread extends WithSubscriptions {
131131 participants : threadData . thread_participants ,
132132 read : formatReadState (
133133 ! threadData . read || threadData . read . length === 0
134- ? getPlaceholderReadResponse ( client . userID )
134+ ? getPlaceholderReadResponse ( client . userId )
135135 : threadData . read ,
136136 ) ,
137137 // Use the parent message's reply_count, not the top-level threadData.reply_count. The
@@ -172,7 +172,7 @@ export class Thread extends WithSubscriptions {
172172 isStateStale : false ,
173173 parentMessage : formattedParentMessage ,
174174 participants : [ ] ,
175- read : formatReadState ( getPlaceholderReadResponse ( client . userID ) ) ,
175+ read : formatReadState ( getPlaceholderReadResponse ( client . userId ) ) ,
176176 replyCount : parentMessage . reply_count ?? 0 ,
177177 title : '' ,
178178 updatedAt : parentMessage . updated_at ? new Date ( parentMessage . updated_at ) : null ,
@@ -294,7 +294,7 @@ export class Thread extends WithSubscriptions {
294294 }
295295
296296 get ownUnreadCount ( ) {
297- return ownUnreadCountSelector ( this . client . userID ) ( this . state . getLatestValue ( ) ) ;
297+ return ownUnreadCountSelector ( this . client . userId ) ( this . state . getLatestValue ( ) ) ;
298298 }
299299
300300 public activate = ( ) => {
@@ -411,7 +411,7 @@ export class Thread extends WithSubscriptions {
411411 this . state . subscribeWithSelector (
412412 ( nextValue ) => ( {
413413 active : nextValue . active ,
414- unreadMessageCount : ownUnreadCountSelector ( this . client . userID ) ( nextValue ) ,
414+ unreadMessageCount : ownUnreadCountSelector ( this . client . userId ) ( nextValue ) ,
415415 } ) ,
416416 ( { active, unreadMessageCount } ) => {
417417 if ( ! active || ! unreadMessageCount ) return ;
@@ -434,8 +434,8 @@ export class Thread extends WithSubscriptions {
434434 const { channel } = this . state . getLatestValue ( ) ;
435435
436436 if (
437- ! this . client . userID ||
438- this . client . userID !== event . user ?. id ||
437+ ! this . client . userId ||
438+ this . client . userId !== event . user ?. id ||
439439 event . channel ?. cid !== channel . cid
440440 ) {
441441 return ;
@@ -473,11 +473,11 @@ export class Thread extends WithSubscriptions {
473473
474474 private subscribeNewReplies = ( ) =>
475475 this . client . on ( 'message.new' , ( event ) => {
476- if ( ! this . client . userID || event . message ?. parent_id !== this . id ) {
476+ if ( ! this . client . userId || event . message ?. parent_id !== this . id ) {
477477 return ;
478478 }
479479
480- const isOwnMessage = event . message . user ?. id === this . client . userID ;
480+ const isOwnMessage = event . message . user ?. id === this . client . userId ;
481481 const { active, read } = this . state . getLatestValue ( ) ;
482482
483483 this . upsertReplyLocally ( {
@@ -508,7 +508,7 @@ export class Thread extends WithSubscriptions {
508508 user : event . user ,
509509 unreadMessageCount : 0 ,
510510 } ;
511- } else if ( active && userId === this . client . userID ) {
511+ } else if ( active && userId === this . client . userId ) {
512512 // Do not increment unread count for the current user in an active thread
513513 } else {
514514 // Increment unread count for all users except the author of the new message
0 commit comments