diff --git a/src/components/__tests__/post-community-address-compat.test.tsx b/src/components/__tests__/post-community-address-compat.test.tsx
index cb601fa7..9d809773 100644
--- a/src/components/__tests__/post-community-address-compat.test.tsx
+++ b/src/components/__tests__/post-community-address-compat.test.tsx
@@ -549,7 +549,7 @@ describe('post community address compatibility', () => {
expect(container.textContent).toContain('ID: ReplyKid');
});
- it('falls back to the reply cid when published reply author metadata is missing', async () => {
+ it('shows a pending ID while published reply author metadata is missing', async () => {
testState.pseudonymityMode = 'per-post';
const post = makeLegacyThread();
const reply = post.replies?.pages?.new?.comments?.[0];
@@ -560,10 +560,10 @@ describe('post community address compatibility', () => {
reply.author = {};
await renderWithRoute(createElement(PostDesktop, { post, showAllReplies: true }), '/mu/thread/post-1');
- expect(container.textContent).toContain('ID: Qmb4NxbR');
+ expect(container.textContent).toContain('ID: Pending');
await renderWithRoute(createElement(PostMobile, { post, showAllReplies: true }), '/mu/thread/post-1');
- expect(container.textContent).toContain('ID: Qmb4NxbR');
+ expect(container.textContent).toContain('ID: Pending');
});
it('forwards Pretext-backed reply estimates into Virtuoso for desktop and mobile thread views', async () => {
diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx
index 75eeb0f5..9529fefe 100644
--- a/src/components/post-desktop/post-desktop.tsx
+++ b/src/components/post-desktop/post-desktop.tsx
@@ -387,7 +387,7 @@ const PostInfo = ({
t('removed')
) : purged ? (
t('purged')
- ) : !cid && pseudonymityMode ? (
+ ) : !userID && pseudonymityMode ? (
{hasFailedState ? '?' : capitalize(t('pending'))}
) : (
{hasFailedState ? '?' : capitalize(t('pending'))}
) : (
{
expect(counts.get('author-b')).toBe(2);
});
- it('uses cid fallback for comments without author metadata', () => {
+ it('skips 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('reply-1')).toBe(false);
expect(counts.has('author-b')).toBe(false);
});
});
diff --git a/src/lib/utils/__tests__/comment-user-id-utils.test.ts b/src/lib/utils/__tests__/comment-user-id-utils.test.ts
new file mode 100644
index 00000000..8d4a090a
--- /dev/null
+++ b/src/lib/utils/__tests__/comment-user-id-utils.test.ts
@@ -0,0 +1,13 @@
+import { describe, expect, it } from 'vitest';
+import { getCommentUserID } from '../comment-user-id-utils';
+
+describe('getCommentUserID', () => {
+ it('uses resolved author identity data for per-post user IDs', () => {
+ expect(getCommentUserID({ author: { address: 'poster.bso', shortAddress: 'short-poster' } } as any)).toBe('poster.bso');
+ expect(getCommentUserID({ author: { shortAddress: 'short-poster' } } as any)).toBe('short-poster');
+ });
+
+ it('does not fall back to the comment cid while author metadata is missing', () => {
+ expect(getCommentUserID({ cid: 'QmQU6BiPkB77b3rAkdj973ptTp5A6X77tfPrwTvCQDL9cq' } as any)).toBe('');
+ });
+});
diff --git a/src/lib/utils/comment-user-id-utils.ts b/src/lib/utils/comment-user-id-utils.ts
index 97db017e..4bac5f8b 100644
--- a/src/lib/utils/comment-user-id-utils.ts
+++ b/src/lib/utils/comment-user-id-utils.ts
@@ -3,5 +3,5 @@ import getShortAddress from '../get-short-address';
export function getCommentUserID(comment: Comment | undefined): string {
const { address, shortAddress } = comment?.author || {};
- return (address ? getShortAddress(address) : '') || shortAddress || comment?.cid || '';
+ return (address ? getShortAddress(address) : '') || shortAddress || '';
}