File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -8749,8 +8749,8 @@ async function countAndVisibleUserIds(pkValue: string): Promise<{
87498749 totalCount : number ;
87508750 visibleUserIds : string [ ] ;
87518751} > {
8752- let totalCount = 0 ;
8753- const visibleUserIds : string [ ] = [ ] ;
8752+ const allUsers = new Set < string > ( ) ;
8753+ const visibleUsers = new Set < string > ( ) ;
87548754 let lastKey : Record < string , any > | undefined = undefined ;
87558755
87568756 do {
@@ -8768,23 +8768,21 @@ async function countAndVisibleUserIds(pkValue: string): Promise<{
87688768 const result = await ddbDocClient . send ( new QueryCommand ( params ) ) ;
87698769 const items = result . Items ?? [ ] ;
87708770
8771- // Count all items
8772- totalCount += items . length ;
8773-
87748771 // Collect userIds where invisible is missing or false
87758772 for ( const item of items ) {
8773+ allUsers . add ( item . userId ) ;
87768774 if ( item . invisible !== true ) {
87778775 // invisible is undefined OR false
87788776 if ( item . userId ) {
8779- visibleUserIds . push ( item . userId ) ;
8777+ visibleUsers . add ( item . userId ) ;
87808778 }
87818779 }
87828780 }
87838781
87848782 lastKey = result . LastEvaluatedKey ;
87858783 } while ( lastKey ) ;
87868784
8787- return { totalCount, visibleUserIds } ;
8785+ return { totalCount : allUsers . size , visibleUserIds : [ ... visibleUsers ] } ;
87888786}
87898787
87908788async function wsBroadcast ( verb : string , payload : any , exclude ?: string [ ] ) : Promise < SendMessageCommandOutput > {
You can’t perform that action at this time.
0 commit comments