Skip to content

Commit

Permalink
fix lastSeen logic
Browse files Browse the repository at this point in the history
  • Loading branch information
matthme committed Nov 24, 2024
1 parent aa31195 commit a2ab22f
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions ui/src/room-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ export class RoomView extends LitElement {
knownAgents[agentB64] = {
pubkey: agentB64,
type: 'told',
lastSeen: agentInfo.lastSeen,
lastSeen: undefined, // We did not receive a Pong from them directly
appVersion: agentInfo.appVersion,
};
}
Expand Down Expand Up @@ -1581,7 +1581,22 @@ export class RoomView extends LitElement {
.map(agent => encodeHashToBase64(agent))
.forEach(agentB64 => {
if (agentB64 !== myPubKeyB64) {
knownAgents[agentB64] = { pubkey: agentB64, type: 'known' };
const alreadyKnown = knownAgents[agentB64];
if (alreadyKnown && alreadyKnown.type !== 'known') {
knownAgents[agentB64] = {
pubkey: agentB64,
type: 'known',
lastSeen: alreadyKnown.lastSeen,
appVersion: alreadyKnown.appVersion,
};
} else if (!alreadyKnown) {
knownAgents[agentB64] = {
pubkey: agentB64,
type: 'known',
lastSeen: undefined,
appVersion: undefined,
};
}
}
});
this._knownAgents = knownAgents;
Expand Down Expand Up @@ -2213,7 +2228,9 @@ export class RoomView extends LitElement {
knownAgents[pubkeyb64].type === 'told'
);
const lastSeen = knownAgents ? knownAgents[pubkeyb64].lastSeen : undefined;
const lastSeen = knownAgents
? knownAgents[pubkeyb64].lastSeen
: undefined;
return html`<agent-connection-status-icon
style="margin-right: 2px; margin-bottom: 2px; ${staleInfo
Expand Down

0 comments on commit a2ab22f

Please sign in to comment.