From b6be2044e03a09eb47c197dd49ea9b1d8e975c7d Mon Sep 17 00:00:00 2001 From: Amar Trebinjac Date: Mon, 20 Jan 2025 12:15:11 +0100 Subject: [PATCH 1/3] fix: Missing username --- .../shared/src/components/comments/CommentActionButtons.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/components/comments/CommentActionButtons.tsx b/packages/shared/src/components/comments/CommentActionButtons.tsx index b37a8bdc45..9b8ef8bb5e 100644 --- a/packages/shared/src/components/comments/CommentActionButtons.tsx +++ b/packages/shared/src/components/comments/CommentActionButtons.tsx @@ -180,7 +180,7 @@ export default function CommentActionButtons({ if (user && user.id !== comment.author.id) { commentOptions.push({ icon: , - label: `Block ${post.author.username}`, + label: `Block ${comment.author.username}`, action: async () => { const params = { id: comment.author.id, From e2bd0e241e027c17451df0b1a2db266ffccdd84b Mon Sep 17 00:00:00 2001 From: Amar Trebinjac Date: Mon, 20 Jan 2025 12:20:05 +0100 Subject: [PATCH 2/3] add nullchecks on all username calls --- .../shared/src/components/comments/CommentActionButtons.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/shared/src/components/comments/CommentActionButtons.tsx b/packages/shared/src/components/comments/CommentActionButtons.tsx index 9b8ef8bb5e..b578e83851 100644 --- a/packages/shared/src/components/comments/CommentActionButtons.tsx +++ b/packages/shared/src/components/comments/CommentActionButtons.tsx @@ -180,12 +180,12 @@ export default function CommentActionButtons({ if (user && user.id !== comment.author.id) { commentOptions.push({ icon: , - label: `Block ${comment.author.username}`, + label: `Block ${comment.author?.username}`, action: async () => { const params = { id: comment.author.id, entity: ContentPreferenceType.User, - entityName: comment.author.username, + entityName: comment.author?.username, feedId: user.id, opts: { hideToast: true, @@ -218,7 +218,7 @@ export default function CommentActionButtons({ !isCompanion; if (shouldShowFollow) { - const authorName = comment.author.name || `@${comment.author.username}`; + const authorName = comment.author?.name || `@${comment.author?.username}`; const isFollowingUser = isFollowingContent( comment.author?.contentPreference, ); From db27ad9c42c56db1d75c188be6f5eab1f4e62702 Mon Sep 17 00:00:00 2001 From: Amar Trebinjac Date: Mon, 20 Jan 2025 12:23:18 +0100 Subject: [PATCH 3/3] remove unnecessary checks --- .../shared/src/components/comments/CommentActionButtons.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/shared/src/components/comments/CommentActionButtons.tsx b/packages/shared/src/components/comments/CommentActionButtons.tsx index b578e83851..9b8ef8bb5e 100644 --- a/packages/shared/src/components/comments/CommentActionButtons.tsx +++ b/packages/shared/src/components/comments/CommentActionButtons.tsx @@ -180,12 +180,12 @@ export default function CommentActionButtons({ if (user && user.id !== comment.author.id) { commentOptions.push({ icon: , - label: `Block ${comment.author?.username}`, + label: `Block ${comment.author.username}`, action: async () => { const params = { id: comment.author.id, entity: ContentPreferenceType.User, - entityName: comment.author?.username, + entityName: comment.author.username, feedId: user.id, opts: { hideToast: true, @@ -218,7 +218,7 @@ export default function CommentActionButtons({ !isCompanion; if (shouldShowFollow) { - const authorName = comment.author?.name || `@${comment.author?.username}`; + const authorName = comment.author.name || `@${comment.author.username}`; const isFollowingUser = isFollowingContent( comment.author?.contentPreference, );