tangled vouch map with historical data
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: display both reasons on mutual

+18 -3
+18 -3
web/main.js
··· 86 86 const kind = edge.kind === 'vouch/vouch' ? 'vouch' : edge.kind === 'vouch/denounce' ? 'denounce' : 'follow'; 87 87 if (kind === 'vouch' || kind === 'denounce') { 88 88 if (!entry[kind]) { 89 - entry[kind] = { source: edge.source, target: edge.target, kind: edge.kind, reason: edge.reason, time: edge.time, mutual: false }; 89 + entry[kind] = { source: edge.source, target: edge.target, kind: edge.kind, reasons: [{ source: edge.source, reason: edge.reason }], time: edge.time, mutual: false }; 90 90 } else { 91 91 entry[kind].mutual = true; 92 + entry[kind].reasons.push({ source: edge.source, reason: edge.reason }); 92 93 } 93 94 } else { 94 95 if (!entry.follows) entry.follows = []; ··· 99 100 for (const entry of pairIndex.values()) { 100 101 if (entry.vouch && entry.denounce) { 101 102 nodeSet.add(entry.vouch.source); nodeSet.add(entry.vouch.target); 102 - links.push({ source: entry.vouch.source, target: entry.vouch.target, kind: 'vouch/mixed', reason: entry.vouch.reason, time: entry.vouch.time, mutual: true }); 103 + links.push({ source: entry.vouch.source, target: entry.vouch.target, kind: 'vouch/mixed', reasons: [...entry.vouch.reasons, ...entry.denounce.reasons], time: entry.vouch.time, mutual: true }); 103 104 } else if (entry.vouch) { 104 105 nodeSet.add(entry.vouch.source); nodeSet.add(entry.vouch.target); 105 106 links.push(entry.vouch); ··· 361 362 tooltip.style.display = 'block'; 362 363 } 363 364 365 + function formatReasons(link) { 366 + if (link.reasons && link.reasons.length > 0) { 367 + const withReasons = link.reasons.filter(r => r.reason); 368 + if (withReasons.length === 0) return ''; 369 + return '<div style="margin-top:4px">' + withReasons.map(r => { 370 + const p = profileMap[r.source] || {}; 371 + const name = p.handle || shortenDID(r.source); 372 + return `<div style="color:var(--text-muted);word-break:break-word"><span style="color:var(--text-secondary)">${name}:</span> ${r.reason}</div>`; 373 + }).join('') + '</div>'; 374 + } 375 + if (link.reason) return `<div style="margin-top:4px;color:var(--text-muted);word-break:break-word">${link.reason}</div>`; 376 + return ''; 377 + } 378 + 364 379 function showLinkTooltip(link) { 365 380 const srcId = link.source; 366 381 const tgtId = link.target; ··· 389 404 ${tgtAvatar} 390 405 <span class="did">${tgtP.handle || shortenDID(tgtId)}</span> 391 406 </div> 392 - ${link.reason ? `<div style="margin-top:4px;color:var(--text-muted);word-break:break-word">${link.reason}</div>` : ''} 407 + ${formatReasons(link)} 393 408 `; 394 409 tooltip.style.display = 'block'; 395 410 }