Convert room list log setting to a real setting
To debug https://github.com/vector-im/riot-web/issues/14554 and https://github.com/vector-im/riot-web/issues/14508
This commit is contained in:
parent
8b65b19e60
commit
c29da883db
7 changed files with 58 additions and 39 deletions
|
@ -60,6 +60,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
|
||||
private readonly watchedSettings = [
|
||||
'feature_custom_tags',
|
||||
'advancedRoomListLogging', // TODO: Remove watch: https://github.com/vector-im/riot-web/issues/14367
|
||||
];
|
||||
|
||||
constructor() {
|
||||
|
@ -126,6 +127,9 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
if (this.enabled) {
|
||||
console.log("⚡ new room list store engaged");
|
||||
}
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
console.warn("Advanced room list logging is enabled");
|
||||
}
|
||||
}
|
||||
|
||||
private async readAndCacheSettingsFromStore() {
|
||||
|
@ -154,7 +158,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
console.warn(`${activeRoomId} is current in RVS but missing from client - clearing sticky room`);
|
||||
await this.algorithm.setStickyRoom(null);
|
||||
} else if (activeRoom !== this.algorithm.stickyRoom) {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`Changing sticky room to ${activeRoomId}`);
|
||||
}
|
||||
|
@ -196,6 +200,14 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
|
||||
if (payload.action === 'setting_updated') {
|
||||
if (this.watchedSettings.includes(payload.settingName)) {
|
||||
// TODO: Remove with https://github.com/vector-im/riot-web/issues/14367
|
||||
if (payload.settingName === "advancedRoomListLogging") {
|
||||
// Log when the setting changes so we know when it was turned on in the rageshake
|
||||
const enabled = SettingsStore.getValue("advancedRoomListLogging");
|
||||
console.warn("Advanced room list logging is enabled? " + enabled);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Regenerating room lists: Settings changed");
|
||||
await this.readAndCacheSettingsFromStore();
|
||||
|
||||
|
@ -218,7 +230,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
console.warn(`Own read receipt was in unknown room ${room.roomId}`);
|
||||
return;
|
||||
}
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Got own read receipt in ${room.roomId}`);
|
||||
}
|
||||
|
@ -228,7 +240,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
}
|
||||
} else if (payload.action === 'MatrixActions.Room.tags') {
|
||||
const roomPayload = (<any>payload); // TODO: Type out the dispatcher types
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Got tag change in ${roomPayload.room.roomId}`);
|
||||
}
|
||||
|
@ -243,13 +255,13 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
const roomId = eventPayload.event.getRoomId();
|
||||
const room = this.matrixClient.getRoom(roomId);
|
||||
const tryUpdate = async (updatedRoom: Room) => {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Live timeline event ${eventPayload.event.getId()}` +
|
||||
` in ${updatedRoom.roomId}`);
|
||||
}
|
||||
if (eventPayload.event.getType() === 'm.room.tombstone' && eventPayload.event.getStateKey() === '') {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Got tombstone event - trying to remove now-dead room`);
|
||||
}
|
||||
|
@ -282,7 +294,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
console.warn(`Event ${eventPayload.event.getId()} was decrypted in an unknown room ${roomId}`);
|
||||
return;
|
||||
}
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Decrypted timeline event ${eventPayload.event.getId()} in ${roomId}`);
|
||||
}
|
||||
|
@ -290,7 +302,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
this.updateFn.trigger();
|
||||
} else if (payload.action === 'MatrixActions.accountData' && payload.event_type === 'm.direct') {
|
||||
const eventPayload = (<any>payload); // TODO: Type out the dispatcher types
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Received updated DM map`);
|
||||
}
|
||||
|
@ -317,7 +329,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
const oldMembership = getEffectiveMembership(membershipPayload.oldMembership);
|
||||
const newMembership = getEffectiveMembership(membershipPayload.membership);
|
||||
if (oldMembership !== EffectiveMembership.Join && newMembership === EffectiveMembership.Join) {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Handling new room ${membershipPayload.room.roomId}`);
|
||||
}
|
||||
|
@ -326,7 +338,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
// the dead room in the list.
|
||||
const createEvent = membershipPayload.room.currentState.getStateEvents("m.room.create", "");
|
||||
if (createEvent && createEvent.getContent()['predecessor']) {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Room has a predecessor`);
|
||||
}
|
||||
|
@ -334,7 +346,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
if (prevRoom) {
|
||||
const isSticky = this.algorithm.stickyRoom === prevRoom;
|
||||
if (isSticky) {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Clearing sticky room due to room upgrade`);
|
||||
}
|
||||
|
@ -343,7 +355,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
|
||||
// Note: we hit the algorithm instead of our handleRoomUpdate() function to
|
||||
// avoid redundant updates.
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Removing previous room from room list`);
|
||||
}
|
||||
|
@ -351,7 +363,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
}
|
||||
}
|
||||
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Adding new room to room list`);
|
||||
}
|
||||
|
@ -361,7 +373,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
}
|
||||
|
||||
if (oldMembership !== EffectiveMembership.Invite && newMembership === EffectiveMembership.Invite) {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Handling invite to ${membershipPayload.room.roomId}`);
|
||||
}
|
||||
|
@ -372,7 +384,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
|
||||
// If it's not a join, it's transitioning into a different list (possibly historical)
|
||||
if (oldMembership !== newMembership) {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[RoomListDebug] Handling membership change in ${membershipPayload.room.roomId}`);
|
||||
}
|
||||
|
@ -386,7 +398,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
private async handleRoomUpdate(room: Room, cause: RoomUpdateCause): Promise<any> {
|
||||
const shouldUpdate = await this.algorithm.handleRoomUpdate(room, cause);
|
||||
if (shouldUpdate) {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log(`[DEBUG] Room "${room.name}" (${room.roomId}) triggered by ${cause} requires list update`);
|
||||
}
|
||||
|
@ -509,7 +521,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
}
|
||||
|
||||
private onAlgorithmListUpdated = () => {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log("Underlying algorithm has triggered a list update - marking");
|
||||
}
|
||||
|
@ -559,7 +571,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
}
|
||||
|
||||
public addFilter(filter: IFilterCondition): void {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log("Adding filter condition:", filter);
|
||||
}
|
||||
|
@ -571,7 +583,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
|
|||
}
|
||||
|
||||
public removeFilter(filter: IFilterCondition): void {
|
||||
if (window.mx_LoudRoomListLogging) {
|
||||
if (SettingsStore.getValue("advancedRoomListLogging")) {
|
||||
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
|
||||
console.log("Removing filter condition:", filter);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue