Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit e955feb

Browse files
committed
Revert "Merge pull request #4972 from matrix-org/travis/room-list/prelaunch/3-remove-debug"
This reverts commit e1b34ac.
1 parent 4903ce5 commit e955feb

File tree

4 files changed

+157
-1
lines changed

4 files changed

+157
-1
lines changed

src/@types/global.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ declare global {
3939
mx_RoomListStore2: RoomListStore2;
4040
mx_RoomListLayoutStore: RoomListLayoutStore;
4141
mxPlatformPeg: PlatformPeg;
42+
43+
// TODO: Remove flag before launch: https://github.com/vector-im/riot-web/issues/14231
44+
mx_QuietRoomListLogging: boolean;
4245
}
4346

4447
// workaround for https://github.com/microsoft/TypeScript/issues/30933

src/components/views/rooms/RoomList2.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ export default class RoomList2 extends React.Component<IProps, IState> {
209209
};
210210

211211
private updateLists = () => {
212-
this.setState({sublists: RoomListStore.instance.orderedLists}, () => {
212+
const newLists = RoomListStore.instance.orderedLists;
213+
if (!window.mx_QuietRoomListLogging) {
214+
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
215+
console.log("new lists", newLists);
216+
}
217+
218+
this.setState({sublists: newLists}, () => {
213219
this.props.onResize();
214220
});
215221
};

src/stores/room-list/RoomListStore2.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
154154
console.warn(`${activeRoomId} is current in RVS but missing from client - clearing sticky room`);
155155
await this.algorithm.setStickyRoom(null);
156156
} 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+
}
157161
await this.algorithm.setStickyRoom(activeRoom);
158162
}
159163
}
@@ -214,12 +218,20 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
214218
console.warn(`Own read receipt was in unknown room ${room.roomId}`);
215219
return;
216220
}
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+
}
217225
await this.handleRoomUpdate(room, RoomUpdateCause.ReadReceipt);
218226
this.updateFn.trigger();
219227
return;
220228
}
221229
} else if (payload.action === 'MatrixActions.Room.tags') {
222230
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+
}
223235
await this.handleRoomUpdate(roomPayload.room, RoomUpdateCause.PossibleTagChange);
224236
this.updateFn.trigger();
225237
} else if (payload.action === 'MatrixActions.Room.timeline') {
@@ -231,7 +243,16 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
231243
const roomId = eventPayload.event.getRoomId();
232244
const room = this.matrixClient.getRoom(roomId);
233245
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+
}
234251
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+
}
235256
const newRoom = this.matrixClient.getRoom(eventPayload.event.getContent()['replacement_room']);
236257
if (newRoom) {
237258
// 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> {
261282
console.warn(`Event ${eventPayload.event.getId()} was decrypted in an unknown room ${roomId}`);
262283
return;
263284
}
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+
}
264289
await this.handleRoomUpdate(room, RoomUpdateCause.Timeline);
265290
this.updateFn.trigger();
266291
} else if (payload.action === 'MatrixActions.accountData' && payload.event_type === 'm.direct') {
267292
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+
}
268297
const dmMap = eventPayload.event.getContent();
269298
for (const userId of Object.keys(dmMap)) {
270299
const roomIds = dmMap[userId];
@@ -288,36 +317,65 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
288317
const oldMembership = getEffectiveMembership(membershipPayload.oldMembership);
289318
const newMembership = getEffectiveMembership(membershipPayload.membership);
290319
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+
291325
// If we're joining an upgraded room, we'll want to make sure we don't proliferate
292326
// the dead room in the list.
293327
const createEvent = membershipPayload.room.currentState.getStateEvents("m.room.create", "");
294328
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+
}
295333
const prevRoom = this.matrixClient.getRoom(createEvent.getContent()['predecessor']['room_id']);
296334
if (prevRoom) {
297335
const isSticky = this.algorithm.stickyRoom === prevRoom;
298336
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+
}
299341
await this.algorithm.setStickyRoom(null);
300342
}
301343

302344
// Note: we hit the algorithm instead of our handleRoomUpdate() function to
303345
// 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+
}
304350
await this.algorithm.handleRoomUpdate(prevRoom, RoomUpdateCause.RoomRemoved);
305351
}
306352
}
307353

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+
}
308358
await this.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.NewRoom);
309359
this.updateFn.trigger();
310360
return;
311361
}
312362

313363
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+
}
314368
await this.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.NewRoom);
315369
this.updateFn.trigger();
316370
return;
317371
}
318372

319373
// If it's not a join, it's transitioning into a different list (possibly historical)
320374
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+
}
321379
await this.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.PossibleTagChange);
322380
this.updateFn.trigger();
323381
return;
@@ -328,6 +386,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
328386
private async handleRoomUpdate(room: Room, cause: RoomUpdateCause): Promise<any> {
329387
const shouldUpdate = await this.algorithm.handleRoomUpdate(room, cause);
330388
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+
}
331393
this.updateFn.mark();
332394
}
333395
}
@@ -447,6 +509,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
447509
}
448510

449511
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+
}
450516
this.updateFn.mark();
451517
};
452518

@@ -493,6 +559,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
493559
}
494560

495561
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+
}
496566
this.filterConditions.push(filter);
497567
if (this.algorithm) {
498568
this.algorithm.addFilterCondition(filter);
@@ -501,6 +571,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
501571
}
502572

503573
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+
}
504578
const idx = this.filterConditions.indexOf(filter);
505579
if (idx >= 0) {
506580
this.filterConditions.splice(idx, 1);

0 commit comments

Comments
 (0)