From 32f9a4e6231cefbdb9790afcfcd10d2ab5f56ea9 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 23 Jan 2020 17:35:36 -0700 Subject: [PATCH] Add some debugging around the recently DM'd users The suggestions are relatively stable, but the recents have some issues. Adding logging to the suggestions would also destroy the console log with thousands of messages whereas recents aren't too bad. --- src/components/views/dialogs/InviteDialog.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/InviteDialog.js b/src/components/views/dialogs/InviteDialog.js index 42319b1842..de11dbf9fa 100644 --- a/src/components/views/dialogs/InviteDialog.js +++ b/src/components/views/dialogs/InviteDialog.js @@ -338,19 +338,31 @@ export default class InviteDialog extends React.PureComponent { const recents = []; for (const userId in rooms) { // Filter out user IDs that are already in the room / should be excluded - if (excludedTargetIds.includes(userId)) continue; + if (excludedTargetIds.includes(userId)) { + console.warn(`[Invite:Recents] Excluding ${userId} from recents`); + continue; + } const room = rooms[userId]; const member = room.getMember(userId); - if (!member) continue; // just skip people who don't have memberships for some reason + if (!member) { + // just skip people who don't have memberships for some reason + console.warn(`[Invite:Recents] ${userId} is missing a member object in their own DM (${room.roomId})`); + continue; + } const lastEventTs = room.timeline && room.timeline.length ? room.timeline[room.timeline.length - 1].getTs() : 0; - if (!lastEventTs) continue; // something weird is going on with this room + if (!lastEventTs) { + // something weird is going on with this room + console.warn(`[Invite:Recents] ${userId} (${room.roomId}) has a weird last timestamp: ${lastEventTs}`); + continue; + } recents.push({userId, user: member, lastActive: lastEventTs}); } + if (!recents) console.warn("[Invite:Recents] No recents to suggest!"); // Sort the recents by last active to save us time later recents.sort((a, b) => b.lastActive - a.lastActive);