@@ -154,6 +154,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
154
154
console . warn ( `${ activeRoomId } is current in RVS but missing from client - clearing sticky room` ) ;
155
155
await this . algorithm . setStickyRoom ( null ) ;
156
156
} else if ( activeRoom !== this . algorithm . stickyRoom ) {
157
+ if ( ! window . mx_QuietRoomListLogging ) {
158
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
159
+ console . log ( `Changing sticky room to ${ activeRoomId } ` ) ;
160
+ }
157
161
await this . algorithm . setStickyRoom ( activeRoom ) ;
158
162
}
159
163
}
@@ -214,12 +218,20 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
214
218
console . warn ( `Own read receipt was in unknown room ${ room . roomId } ` ) ;
215
219
return ;
216
220
}
221
+ if ( ! window . mx_QuietRoomListLogging ) {
222
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
223
+ console . log ( `[RoomListDebug] Got own read receipt in ${ room . roomId } ` ) ;
224
+ }
217
225
await this . handleRoomUpdate ( room , RoomUpdateCause . ReadReceipt ) ;
218
226
this . updateFn . trigger ( ) ;
219
227
return ;
220
228
}
221
229
} else if ( payload . action === 'MatrixActions.Room.tags' ) {
222
230
const roomPayload = ( < any > payload ) ; // TODO: Type out the dispatcher types
231
+ if ( ! window . mx_QuietRoomListLogging ) {
232
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
233
+ console . log ( `[RoomListDebug] Got tag change in ${ roomPayload . room . roomId } ` ) ;
234
+ }
223
235
await this . handleRoomUpdate ( roomPayload . room , RoomUpdateCause . PossibleTagChange ) ;
224
236
this . updateFn . trigger ( ) ;
225
237
} else if ( payload . action === 'MatrixActions.Room.timeline' ) {
@@ -231,7 +243,16 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
231
243
const roomId = eventPayload . event . getRoomId ( ) ;
232
244
const room = this . matrixClient . getRoom ( roomId ) ;
233
245
const tryUpdate = async ( updatedRoom : Room ) => {
246
+ if ( ! window . mx_QuietRoomListLogging ) {
247
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
248
+ console . log ( `[RoomListDebug] Live timeline event ${ eventPayload . event . getId ( ) } ` +
249
+ ` in ${ updatedRoom . roomId } ` ) ;
250
+ }
234
251
if ( eventPayload . event . getType ( ) === 'm.room.tombstone' && eventPayload . event . getStateKey ( ) === '' ) {
252
+ if ( ! window . mx_QuietRoomListLogging ) {
253
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
254
+ console . log ( `[RoomListDebug] Got tombstone event - trying to remove now-dead room` ) ;
255
+ }
235
256
const newRoom = this . matrixClient . getRoom ( eventPayload . event . getContent ( ) [ 'replacement_room' ] ) ;
236
257
if ( newRoom ) {
237
258
// If we have the new room, then the new room check will have seen the predecessor
@@ -261,10 +282,18 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
261
282
console . warn ( `Event ${ eventPayload . event . getId ( ) } was decrypted in an unknown room ${ roomId } ` ) ;
262
283
return ;
263
284
}
285
+ if ( ! window . mx_QuietRoomListLogging ) {
286
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
287
+ console . log ( `[RoomListDebug] Decrypted timeline event ${ eventPayload . event . getId ( ) } in ${ roomId } ` ) ;
288
+ }
264
289
await this . handleRoomUpdate ( room , RoomUpdateCause . Timeline ) ;
265
290
this . updateFn . trigger ( ) ;
266
291
} else if ( payload . action === 'MatrixActions.accountData' && payload . event_type === 'm.direct' ) {
267
292
const eventPayload = ( < any > payload ) ; // TODO: Type out the dispatcher types
293
+ if ( ! window . mx_QuietRoomListLogging ) {
294
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
295
+ console . log ( `[RoomListDebug] Received updated DM map` ) ;
296
+ }
268
297
const dmMap = eventPayload . event . getContent ( ) ;
269
298
for ( const userId of Object . keys ( dmMap ) ) {
270
299
const roomIds = dmMap [ userId ] ;
@@ -288,36 +317,65 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
288
317
const oldMembership = getEffectiveMembership ( membershipPayload . oldMembership ) ;
289
318
const newMembership = getEffectiveMembership ( membershipPayload . membership ) ;
290
319
if ( oldMembership !== EffectiveMembership . Join && newMembership === EffectiveMembership . Join ) {
320
+ if ( ! window . mx_QuietRoomListLogging ) {
321
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
322
+ console . log ( `[RoomListDebug] Handling new room ${ membershipPayload . room . roomId } ` ) ;
323
+ }
324
+
291
325
// If we're joining an upgraded room, we'll want to make sure we don't proliferate
292
326
// the dead room in the list.
293
327
const createEvent = membershipPayload . room . currentState . getStateEvents ( "m.room.create" , "" ) ;
294
328
if ( createEvent && createEvent . getContent ( ) [ 'predecessor' ] ) {
329
+ if ( ! window . mx_QuietRoomListLogging ) {
330
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
331
+ console . log ( `[RoomListDebug] Room has a predecessor` ) ;
332
+ }
295
333
const prevRoom = this . matrixClient . getRoom ( createEvent . getContent ( ) [ 'predecessor' ] [ 'room_id' ] ) ;
296
334
if ( prevRoom ) {
297
335
const isSticky = this . algorithm . stickyRoom === prevRoom ;
298
336
if ( isSticky ) {
337
+ if ( ! window . mx_QuietRoomListLogging ) {
338
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
339
+ console . log ( `[RoomListDebug] Clearing sticky room due to room upgrade` ) ;
340
+ }
299
341
await this . algorithm . setStickyRoom ( null ) ;
300
342
}
301
343
302
344
// Note: we hit the algorithm instead of our handleRoomUpdate() function to
303
345
// avoid redundant updates.
346
+ if ( ! window . mx_QuietRoomListLogging ) {
347
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
348
+ console . log ( `[RoomListDebug] Removing previous room from room list` ) ;
349
+ }
304
350
await this . algorithm . handleRoomUpdate ( prevRoom , RoomUpdateCause . RoomRemoved ) ;
305
351
}
306
352
}
307
353
354
+ if ( ! window . mx_QuietRoomListLogging ) {
355
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
356
+ console . log ( `[RoomListDebug] Adding new room to room list` ) ;
357
+ }
308
358
await this . handleRoomUpdate ( membershipPayload . room , RoomUpdateCause . NewRoom ) ;
309
359
this . updateFn . trigger ( ) ;
310
360
return ;
311
361
}
312
362
313
363
if ( oldMembership !== EffectiveMembership . Invite && newMembership === EffectiveMembership . Invite ) {
364
+ if ( ! window . mx_QuietRoomListLogging ) {
365
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
366
+ console . log ( `[RoomListDebug] Handling invite to ${ membershipPayload . room . roomId } ` ) ;
367
+ }
314
368
await this . handleRoomUpdate ( membershipPayload . room , RoomUpdateCause . NewRoom ) ;
315
369
this . updateFn . trigger ( ) ;
316
370
return ;
317
371
}
318
372
319
373
// If it's not a join, it's transitioning into a different list (possibly historical)
320
374
if ( oldMembership !== newMembership ) {
375
+ if ( ! window . mx_QuietRoomListLogging ) {
376
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
377
+ console . log ( `[RoomListDebug] Handling membership change in ${ membershipPayload . room . roomId } ` ) ;
378
+ }
321
379
await this . handleRoomUpdate ( membershipPayload . room , RoomUpdateCause . PossibleTagChange ) ;
322
380
this . updateFn . trigger ( ) ;
323
381
return ;
@@ -328,6 +386,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
328
386
private async handleRoomUpdate ( room : Room , cause : RoomUpdateCause ) : Promise < any > {
329
387
const shouldUpdate = await this . algorithm . handleRoomUpdate ( room , cause ) ;
330
388
if ( shouldUpdate ) {
389
+ if ( ! window . mx_QuietRoomListLogging ) {
390
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
391
+ console . log ( `[DEBUG] Room "${ room . name } " (${ room . roomId } ) triggered by ${ cause } requires list update` ) ;
392
+ }
331
393
this . updateFn . mark ( ) ;
332
394
}
333
395
}
@@ -447,6 +509,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
447
509
}
448
510
449
511
private onAlgorithmListUpdated = ( ) => {
512
+ if ( ! window . mx_QuietRoomListLogging ) {
513
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
514
+ console . log ( "Underlying algorithm has triggered a list update - marking" ) ;
515
+ }
450
516
this . updateFn . mark ( ) ;
451
517
} ;
452
518
@@ -493,6 +559,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
493
559
}
494
560
495
561
public addFilter ( filter : IFilterCondition ) : void {
562
+ if ( ! window . mx_QuietRoomListLogging ) {
563
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
564
+ console . log ( "Adding filter condition:" , filter ) ;
565
+ }
496
566
this . filterConditions . push ( filter ) ;
497
567
if ( this . algorithm ) {
498
568
this . algorithm . addFilterCondition ( filter ) ;
@@ -501,6 +571,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
501
571
}
502
572
503
573
public removeFilter ( filter : IFilterCondition ) : void {
574
+ if ( ! window . mx_QuietRoomListLogging ) {
575
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
576
+ console . log ( "Removing filter condition:" , filter ) ;
577
+ }
504
578
const idx = this . filterConditions . indexOf ( filter ) ;
505
579
if ( idx >= 0 ) {
506
580
this . filterConditions . splice ( idx , 1 ) ;
0 commit comments