fix(post ids): fall back to comment cid for missing ids (#1167)

* fix(post ids): fall back to comment cid for missing ids

* fix(post ids): count cid-resolved account replies
This commit is contained in:
Tommaso Casaburi
2026-06-09 19:08:02 +07:00
committed by GitHub
parent 9de2e6a851
commit c0f1a77958
8 changed files with 208 additions and 68 deletions
@@ -27,13 +27,14 @@ describe('getThreadPostCountsByAuthor', () => {
expect(counts.get('author-b')).toBe(2);
});
it('skips comments missing a cid or short address', () => {
it('uses cid fallback for comments without author metadata', () => {
const counts = getThreadPostCountsByAuthor(
{ cid: 'post-1', author: { shortAddress: 'author-a' } } as any,
[{ cid: 'reply-1' }, { author: { shortAddress: 'author-b' } }] as any[],
);
expect(counts.get('author-a')).toBe(1);
expect(counts.get('reply-1')).toBe(1);
expect(counts.has('author-b')).toBe(false);
});
});