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

Commit e1b34ac

Browse files
authored
Merge pull request #4972 from matrix-org/travis/room-list/prelaunch/3-remove-debug
Remove debug logging from new room list
2 parents 309c178 + 6632db0 commit e1b34ac

File tree

4 files changed

+1
-157
lines changed

4 files changed

+1
-157
lines changed

src/@types/global.d.ts

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ declare global {
3737
mx_RoomListStore2: RoomListStore2;
3838
mx_RoomListLayoutStore: RoomListLayoutStore;
3939
mxPlatformPeg: PlatformPeg;
40-
41-
// TODO: Remove flag before launch: https://github.com/vector-im/riot-web/issues/14231
42-
mx_QuietRoomListLogging: boolean;
4340
}
4441

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

src/components/views/rooms/RoomList2.tsx

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

211211
private updateLists = () => {
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}, () => {
212+
this.setState({sublists: RoomListStore.instance.orderedLists}, () => {
219213
this.props.onResize();
220214
});
221215
};

src/stores/room-list/RoomListStore2.ts

-74
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ 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-
}
161157
await this.algorithm.setStickyRoom(activeRoom);
162158
}
163159
}
@@ -218,20 +214,12 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
218214
console.warn(`Own read receipt was in unknown room ${room.roomId}`);
219215
return;
220216
}
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-
}
225217
await this.handleRoomUpdate(room, RoomUpdateCause.ReadReceipt);
226218
this.updateFn.trigger();
227219
return;
228220
}
229221
} else if (payload.action === 'MatrixActions.Room.tags') {
230222
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-
}
235223
await this.handleRoomUpdate(roomPayload.room, RoomUpdateCause.PossibleTagChange);
236224
this.updateFn.trigger();
237225
} else if (payload.action === 'MatrixActions.Room.timeline') {
@@ -243,16 +231,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
243231
const roomId = eventPayload.event.getRoomId();
244232
const room = this.matrixClient.getRoom(roomId);
245233
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-
}
251234
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-
}
256235
const newRoom = this.matrixClient.getRoom(eventPayload.event.getContent()['replacement_room']);
257236
if (newRoom) {
258237
// If we have the new room, then the new room check will have seen the predecessor
@@ -282,18 +261,10 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
282261
console.warn(`Event ${eventPayload.event.getId()} was decrypted in an unknown room ${roomId}`);
283262
return;
284263
}
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-
}
289264
await this.handleRoomUpdate(room, RoomUpdateCause.Timeline);
290265
this.updateFn.trigger();
291266
} else if (payload.action === 'MatrixActions.accountData' && payload.event_type === 'm.direct') {
292267
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-
}
297268
const dmMap = eventPayload.event.getContent();
298269
for (const userId of Object.keys(dmMap)) {
299270
const roomIds = dmMap[userId];
@@ -317,65 +288,36 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
317288
const oldMembership = getEffectiveMembership(membershipPayload.oldMembership);
318289
const newMembership = getEffectiveMembership(membershipPayload.membership);
319290
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-
325291
// If we're joining an upgraded room, we'll want to make sure we don't proliferate
326292
// the dead room in the list.
327293
const createEvent = membershipPayload.room.currentState.getStateEvents("m.room.create", "");
328294
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-
}
333295
const prevRoom = this.matrixClient.getRoom(createEvent.getContent()['predecessor']['room_id']);
334296
if (prevRoom) {
335297
const isSticky = this.algorithm.stickyRoom === prevRoom;
336298
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-
}
341299
await this.algorithm.setStickyRoom(null);
342300
}
343301

344302
// Note: we hit the algorithm instead of our handleRoomUpdate() function to
345303
// 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-
}
350304
await this.algorithm.handleRoomUpdate(prevRoom, RoomUpdateCause.RoomRemoved);
351305
}
352306
}
353307

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-
}
358308
await this.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.NewRoom);
359309
this.updateFn.trigger();
360310
return;
361311
}
362312

363313
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-
}
368314
await this.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.NewRoom);
369315
this.updateFn.trigger();
370316
return;
371317
}
372318

373319
// If it's not a join, it's transitioning into a different list (possibly historical)
374320
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-
}
379321
await this.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.PossibleTagChange);
380322
this.updateFn.trigger();
381323
return;
@@ -386,10 +328,6 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
386328
private async handleRoomUpdate(room: Room, cause: RoomUpdateCause): Promise<any> {
387329
const shouldUpdate = await this.algorithm.handleRoomUpdate(room, cause);
388330
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-
}
393331
this.updateFn.mark();
394332
}
395333
}
@@ -509,10 +447,6 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
509447
}
510448

511449
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-
}
516450
this.updateFn.mark();
517451
};
518452

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

561495
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-
}
566496
this.filterConditions.push(filter);
567497
if (this.algorithm) {
568498
this.algorithm.addFilterCondition(filter);
@@ -571,10 +501,6 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
571501
}
572502

573503
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-
}
578504
const idx = this.filterConditions.indexOf(filter);
579505
if (idx >= 0) {
580506
this.filterConditions.splice(idx, 1);

0 commit comments

Comments
 (0)