stats: refactor inReplyToId

This commit is contained in:
Alex Gleason 2023-12-10 13:58:35 -06:00
parent 7167553afe
commit 0f10a7c3a2
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 3 additions and 3 deletions

View File

@ -29,13 +29,13 @@ function getStatsDiff(event: Event): StatDiff[] {
const statDiffs: StatDiff[] = []; const statDiffs: StatDiff[] = [];
const firstE = event.tags.find(([name]) => name === 'e')?.[1]; const firstE = event.tags.find(([name]) => name === 'e')?.[1];
const replyTag = findReplyTag(event as Event<1>); const inReplyToId = findReplyTag(event as Event<1>)?.[1];
switch (event.kind) { switch (event.kind) {
case 1: case 1:
statDiffs.push(['pubkey_stats', event.pubkey, 'notes_count', 1]); statDiffs.push(['pubkey_stats', event.pubkey, 'notes_count', 1]);
if (replyTag && replyTag[1]) { if (inReplyToId) {
statDiffs.push(['event_stats', replyTag[1], 'replies_count', 1]); statDiffs.push(['event_stats', inReplyToId, 'replies_count', 1]);
} }
break; break;
case 6: case 6: