fix: add optional chaning check for actor details (#6437)

This commit is contained in:
Prateek Shourya 2025-01-21 20:33:38 +05:30 committed by GitHub
parent 3a86fff7c1
commit 12501d0597
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,11 +28,13 @@ export const IssueCommentBlock: FC<TIssueCommentBlock> = observer((props) => {
<div className={`relative flex gap-3 ${ends === "top" ? `pb-2` : ends === "bottom" ? `pt-2` : `py-2`}`}>
<div className="absolute left-[13px] top-0 bottom-0 w-0.5 bg-custom-background-80" aria-hidden />
<div className="flex-shrink-0 relative w-7 h-7 rounded-full flex justify-center items-center z-[3] bg-gray-500 text-white border border-white uppercase font-medium">
{comment.actor_detail.avatar_url && comment.actor_detail.avatar_url !== "" ? (
{comment.actor_detail?.avatar_url && comment.actor_detail?.avatar_url !== "" ? (
<img
src={getFileURL(comment.actor_detail.avatar_url)}
src={getFileURL(comment.actor_detail?.avatar_url)}
alt={
comment.actor_detail.is_bot ? comment.actor_detail.first_name + " Bot" : comment.actor_detail.display_name
comment.actor_detail?.is_bot
? comment.actor_detail?.first_name + " Bot"
: comment.actor_detail?.display_name
}
height={30}
width={30}
@ -40,9 +42,9 @@ export const IssueCommentBlock: FC<TIssueCommentBlock> = observer((props) => {
/>
) : (
<>
{comment.actor_detail.is_bot
? comment.actor_detail.first_name.charAt(0)
: comment.actor_detail.display_name.charAt(0)}
{comment.actor_detail?.is_bot
? comment.actor_detail?.first_name.charAt(0)
: comment.actor_detail?.display_name.charAt(0)}
</>
)}
<div className="absolute top-2 left-4 w-5 h-5 rounded-full overflow-hidden flex justify-center items-center bg-custom-background-80">
@ -53,9 +55,9 @@ export const IssueCommentBlock: FC<TIssueCommentBlock> = observer((props) => {
<div className="w-full truncate space-y-1">
<div>
<div className="text-xs capitalize">
{comment.actor_detail.is_bot
? comment.actor_detail.first_name + " Bot"
: comment.actor_detail.display_name}
{comment.actor_detail?.is_bot
? comment.actor_detail?.first_name + " Bot"
: comment.actor_detail?.display_name}
</div>
<div className="text-xs text-custom-text-200">commented {calculateTimeAgo(comment.created_at)}</div>
</div>