@@ -104,8 +104,10 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
104
104
console . warn ( `${ activeRoomId } is current in RVS but missing from client - clearing sticky room` ) ;
105
105
this . algorithm . stickyRoom = null ;
106
106
} else if ( activeRoom !== this . algorithm . stickyRoom ) {
107
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
108
- console . log ( `Changing sticky room to ${ activeRoomId } ` ) ;
107
+ if ( ! window . mx_QuietRoomListLogging ) {
108
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
109
+ console . log ( `Changing sticky room to ${ activeRoomId } ` ) ;
110
+ }
109
111
this . algorithm . stickyRoom = activeRoom ;
110
112
}
111
113
}
@@ -169,15 +171,19 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
169
171
console . warn ( `Own read receipt was in unknown room ${ room . roomId } ` ) ;
170
172
return ;
171
173
}
172
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
173
- console . log ( `[RoomListDebug] Got own read receipt in ${ room . roomId } ` ) ;
174
+ if ( ! window . mx_QuietRoomListLogging ) {
175
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
176
+ console . log ( `[RoomListDebug] Got own read receipt in ${ room . roomId } ` ) ;
177
+ }
174
178
await this . handleRoomUpdate ( room , RoomUpdateCause . ReadReceipt ) ;
175
179
return ;
176
180
}
177
181
} else if ( payload . action === 'MatrixActions.Room.tags' ) {
178
182
const roomPayload = ( < any > payload ) ; // TODO: Type out the dispatcher types
179
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
180
- console . log ( `[RoomListDebug] Got tag change in ${ roomPayload . room . roomId } ` ) ;
183
+ if ( ! window . mx_QuietRoomListLogging ) {
184
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
185
+ console . log ( `[RoomListDebug] Got tag change in ${ roomPayload . room . roomId } ` ) ;
186
+ }
181
187
await this . handleRoomUpdate ( roomPayload . room , RoomUpdateCause . PossibleTagChange ) ;
182
188
} else if ( payload . action === 'MatrixActions.Room.timeline' ) {
183
189
const eventPayload = ( < any > payload ) ; // TODO: Type out the dispatcher types
@@ -188,12 +194,16 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
188
194
const roomId = eventPayload . event . getRoomId ( ) ;
189
195
const room = this . matrixClient . getRoom ( roomId ) ;
190
196
const tryUpdate = async ( updatedRoom : Room ) => {
191
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
192
- console . log ( `[RoomListDebug] Live timeline event ${ eventPayload . event . getId ( ) } ` +
193
- ` in ${ updatedRoom . roomId } ` ) ;
194
- if ( eventPayload . event . getType ( ) === 'm.room.tombstone' && eventPayload . event . getStateKey ( ) === '' ) {
197
+ if ( ! window . mx_QuietRoomListLogging ) {
195
198
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
196
- console . log ( `[RoomListDebug] Got tombstone event - trying to remove now-dead room` ) ;
199
+ console . log ( `[RoomListDebug] Live timeline event ${ eventPayload . event . getId ( ) } ` +
200
+ ` in ${ updatedRoom . roomId } ` ) ;
201
+ }
202
+ if ( eventPayload . event . getType ( ) === 'm.room.tombstone' && eventPayload . event . getStateKey ( ) === '' ) {
203
+ if ( ! window . mx_QuietRoomListLogging ) {
204
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
205
+ console . log ( `[RoomListDebug] Got tombstone event - trying to remove now-dead room` ) ;
206
+ }
197
207
const newRoom = this . matrixClient . getRoom ( eventPayload . event . getContent ( ) [ 'replacement_room' ] ) ;
198
208
if ( newRoom ) {
199
209
// If we have the new room, then the new room check will have seen the predecessor
@@ -222,13 +232,17 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
222
232
console . warn ( `Event ${ eventPayload . event . getId ( ) } was decrypted in an unknown room ${ roomId } ` ) ;
223
233
return ;
224
234
}
225
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
226
- console . log ( `[RoomListDebug] Decrypted timeline event ${ eventPayload . event . getId ( ) } in ${ roomId } ` ) ;
235
+ if ( ! window . mx_QuietRoomListLogging ) {
236
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
237
+ console . log ( `[RoomListDebug] Decrypted timeline event ${ eventPayload . event . getId ( ) } in ${ roomId } ` ) ;
238
+ }
227
239
await this . handleRoomUpdate ( room , RoomUpdateCause . Timeline ) ;
228
240
} else if ( payload . action === 'MatrixActions.accountData' && payload . event_type === 'm.direct' ) {
229
241
const eventPayload = ( < any > payload ) ; // TODO: Type out the dispatcher types
230
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
231
- console . log ( `[RoomListDebug] Received updated DM map` ) ;
242
+ if ( ! window . mx_QuietRoomListLogging ) {
243
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
244
+ console . log ( `[RoomListDebug] Received updated DM map` ) ;
245
+ }
232
246
const dmMap = eventPayload . event . getContent ( ) ;
233
247
for ( const userId of Object . keys ( dmMap ) ) {
234
248
const roomIds = dmMap [ userId ] ;
@@ -251,45 +265,63 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
251
265
const oldMembership = getEffectiveMembership ( membershipPayload . oldMembership ) ;
252
266
const newMembership = getEffectiveMembership ( membershipPayload . membership ) ;
253
267
if ( oldMembership !== EffectiveMembership . Join && newMembership === EffectiveMembership . Join ) {
254
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
255
- console . log ( `[RoomListDebug] Handling new room ${ membershipPayload . room . roomId } ` ) ;
268
+ if ( ! window . mx_QuietRoomListLogging ) {
269
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
270
+ console . log ( `[RoomListDebug] Handling new room ${ membershipPayload . room . roomId } ` ) ;
271
+ }
256
272
257
273
// If we're joining an upgraded room, we'll want to make sure we don't proliferate
258
274
// the dead room in the list.
259
275
const createEvent = membershipPayload . room . currentState . getStateEvents ( "m.room.create" , "" ) ;
260
276
if ( createEvent && createEvent . getContent ( ) [ 'predecessor' ] ) {
261
- console . log ( `[RoomListDebug] Room has a predecessor` ) ;
277
+ if ( ! window . mx_QuietRoomListLogging ) {
278
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
279
+ console . log ( `[RoomListDebug] Room has a predecessor` ) ;
280
+ }
262
281
const prevRoom = this . matrixClient . getRoom ( createEvent . getContent ( ) [ 'predecessor' ] [ 'room_id' ] ) ;
263
282
if ( prevRoom ) {
264
283
const isSticky = this . algorithm . stickyRoom === prevRoom ;
265
284
if ( isSticky ) {
266
- console . log ( `[RoomListDebug] Clearing sticky room due to room upgrade` ) ;
285
+ if ( ! window . mx_QuietRoomListLogging ) {
286
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
287
+ console . log ( `[RoomListDebug] Clearing sticky room due to room upgrade` ) ;
288
+ }
267
289
await this . algorithm . setStickyRoomAsync ( null ) ;
268
290
}
269
291
270
292
// Note: we hit the algorithm instead of our handleRoomUpdate() function to
271
293
// avoid redundant updates.
272
- console . log ( `[RoomListDebug] Removing previous room from room list` ) ;
294
+ if ( ! window . mx_QuietRoomListLogging ) {
295
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
296
+ console . log ( `[RoomListDebug] Removing previous room from room list` ) ;
297
+ }
273
298
await this . algorithm . handleRoomUpdate ( prevRoom , RoomUpdateCause . RoomRemoved ) ;
274
299
}
275
300
}
276
301
277
- console . log ( `[RoomListDebug] Adding new room to room list` ) ;
302
+ if ( ! window . mx_QuietRoomListLogging ) {
303
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
304
+ console . log ( `[RoomListDebug] Adding new room to room list` ) ;
305
+ }
278
306
await this . handleRoomUpdate ( membershipPayload . room , RoomUpdateCause . NewRoom ) ;
279
307
return ;
280
308
}
281
309
282
310
if ( oldMembership !== EffectiveMembership . Invite && newMembership === EffectiveMembership . Invite ) {
283
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
284
- console . log ( `[RoomListDebug] Handling invite to ${ membershipPayload . room . roomId } ` ) ;
311
+ if ( ! window . mx_QuietRoomListLogging ) {
312
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
313
+ console . log ( `[RoomListDebug] Handling invite to ${ membershipPayload . room . roomId } ` ) ;
314
+ }
285
315
await this . handleRoomUpdate ( membershipPayload . room , RoomUpdateCause . NewRoom ) ;
286
316
return ;
287
317
}
288
318
289
319
// If it's not a join, it's transitioning into a different list (possibly historical)
290
320
if ( oldMembership !== newMembership ) {
291
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
292
- console . log ( `[RoomListDebug] Handling membership change in ${ membershipPayload . room . roomId } ` ) ;
321
+ if ( ! window . mx_QuietRoomListLogging ) {
322
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
323
+ console . log ( `[RoomListDebug] Handling membership change in ${ membershipPayload . room . roomId } ` ) ;
324
+ }
293
325
await this . handleRoomUpdate ( membershipPayload . room , RoomUpdateCause . PossibleTagChange ) ;
294
326
return ;
295
327
}
@@ -299,8 +331,10 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
299
331
private async handleRoomUpdate ( room : Room , cause : RoomUpdateCause ) : Promise < any > {
300
332
const shouldUpdate = await this . algorithm . handleRoomUpdate ( room , cause ) ;
301
333
if ( shouldUpdate ) {
302
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
303
- console . log ( `[DEBUG] Room "${ room . name } " (${ room . roomId } ) triggered by ${ cause } requires list update` ) ;
334
+ if ( ! window . mx_QuietRoomListLogging ) {
335
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
336
+ console . log ( `[DEBUG] Room "${ room . name } " (${ room . roomId } ) triggered by ${ cause } requires list update` ) ;
337
+ }
304
338
this . emit ( LISTS_UPDATE_EVENT , this ) ;
305
339
}
306
340
}
@@ -405,8 +439,10 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
405
439
}
406
440
407
441
private onAlgorithmListUpdated = ( ) => {
408
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
409
- console . log ( "Underlying algorithm has triggered a list update - refiring" ) ;
442
+ if ( ! window . mx_QuietRoomListLogging ) {
443
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
444
+ console . log ( "Underlying algorithm has triggered a list update - refiring" ) ;
445
+ }
410
446
this . emit ( LISTS_UPDATE_EVENT , this ) ;
411
447
} ;
412
448
@@ -439,17 +475,21 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
439
475
}
440
476
441
477
public addFilter ( filter : IFilterCondition ) : void {
442
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
443
- console . log ( "Adding filter condition:" , filter ) ;
478
+ if ( ! window . mx_QuietRoomListLogging ) {
479
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
480
+ console . log ( "Adding filter condition:" , filter ) ;
481
+ }
444
482
this . filterConditions . push ( filter ) ;
445
483
if ( this . algorithm ) {
446
484
this . algorithm . addFilterCondition ( filter ) ;
447
485
}
448
486
}
449
487
450
488
public removeFilter ( filter : IFilterCondition ) : void {
451
- // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
452
- console . log ( "Removing filter condition:" , filter ) ;
489
+ if ( ! window . mx_QuietRoomListLogging ) {
490
+ // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
491
+ console . log ( "Removing filter condition:" , filter ) ;
492
+ }
453
493
const idx = this . filterConditions . indexOf ( filter ) ;
454
494
if ( idx >= 0 ) {
455
495
this . filterConditions . splice ( idx , 1 ) ;
0 commit comments