diff --git a/webui-src/app/people/people_details_tab.js b/webui-src/app/people/people_details_tab.js index 4d56020..d635516 100644 --- a/webui-src/app/people/people_details_tab.js +++ b/webui-src/app/people/people_details_tab.js @@ -7,6 +7,7 @@ const { EditIdentity, DeleteIdentity } = ownIdsLayout; const { State, fetchIdDetails, + refreshSelectedIdDetails, getSafeAvatar, get64Num, createUsageString, @@ -16,6 +17,7 @@ const { const DetailsTab = () => { return { + oninit: () => refreshSelectedIdDetails(), view: () => { fetchIdDetails(State.selectedId); const details = State.selectedId ? State.gxsIdToDetailsMap[State.selectedId] : null; @@ -164,23 +166,26 @@ const DetailsTab = () => { m('.info-label', 'GXS ID'), m('.info-value', details.mId), m('.info-label', 'Type'), - m('.info-value', details.mFlags === 14 ? 'Signed ID' : 'Anonymous ID'), + // mFlags is a bitfield: RS_IDENTITY_FLAGS_PGP_LINKED is 0x2. + // Comparing the whole word against 14 -- PGP_LINKED | PGP_KNOWN | + // IS_OWN_ID -- only ever matched our own signed identities, so + // every signed identity of somebody else read "Anonymous". + m('.info-value', (details.mFlags & 0x2) ? 'Signed ID' : 'Anonymous ID'), m('.info-label', 'Owner Node GPG'), m('.info-value', pgpId && pgpId !== '0000000000000000' ? pgpId : 'None'), m('.info-label', 'Created On'), - m( - '.info-value', - typeof details.mPublishTS === 'object' - ? new Date(details.mPublishTS.xint64 * 1000).toLocaleString() - : 'Unknown' - ), + // get64Num exists for these: a 64 bit field arrives as + // {xint64, xstr64}, and large values carry xstr64 alone -- reading + // .xint64 straight then dates the identity to "Invalid Date". + m('.info-value', (() => { + const ts = get64Num(details.mPublishTS); + return ts > 0 ? new Date(ts * 1000).toLocaleString() : 'Unknown'; + })()), m('.info-label', 'Last Used'), - m( - '.info-value', - typeof details.mLastUsageTS === 'object' - ? new Date(details.mLastUsageTS.xint64 * 1000).toLocaleDateString() - : 'Unknown' - ), + m('.info-value', (() => { + const ts = get64Num(details.mLastUsageTS); + return ts > 0 ? new Date(ts * 1000).toLocaleDateString() : 'Unknown'; + })()), m('.info-label', 'Friend votes'), m('.info-value', details.mReputation && (details.mReputation.mFriendsPositiveVotes > 0 || details.mReputation.mFriendsNegativeVotes > 0) ? `${details.mReputation.mFriendsPositiveVotes} positive, ${details.mReputation.mFriendsNegativeVotes} negative` diff --git a/webui-src/app/people/people_state.js b/webui-src/app/people/people_state.js index efdd795..bce437f 100644 --- a/webui-src/app/people/people_state.js +++ b/webui-src/app/people/people_state.js @@ -185,18 +185,32 @@ function get64Num(val) { return Number(val) || 0; } +// RsIdentityUsage::mServiceId is an RsServiceType (rsserviceids.h), a 16 bit +// service number -- 0x0215 for the forums, 0x0217 for the channels. Matching it +// against 1..8 could never succeed, so every line of the usage panel used to +// read "Unknown (533)". +const SERVICE_NAMES = { + 0x0012: 'Chat', + 0x0022: 'Mail', + 0x0023: 'Direct mail', + 0x0024: 'Distant mail', + 0x0027: 'Distant chat', + 0x0028: 'GXS tunnels', + 0x0211: 'Identities', + 0x0213: 'Wiki', + 0x0214: 'Wire', + 0x0215: 'Forums', + 0x0216: 'Boards', + 0x0217: 'Channels', + 0x0218: 'Circles', + 0x0219: 'Reputation', + 0x0221: 'Calendar', + 0x0230: 'Distant messages', +}; + function getServiceName(serviceId) { - switch (serviceId) { - case 1: return 'Channels'; - case 2: return 'Forums'; - case 3: return 'Boards'; - case 4: return 'Chat'; - case 5: return 'GxsCircles'; - case 6: return 'GxsMail'; - case 7: return 'GxsCircles'; - case 8: return 'Wire'; - default: return 'Unknown (' + serviceId + ')'; - } + const id = Number(serviceId); + return SERVICE_NAMES[id] || ('Unknown (0x' + id.toString(16) + ')'); } function createUsageString(u) {