import type { CompanyUserProfile } from "./company-members"; /** Task messages load uploaded Paperclip avatars automatically, never remote URLs. */ export function paperclipHumanAvatarUrl(value: string | null | undefined): string | null { return value && /^\/api\/assets\/[^/?#]+\/content$/.test(value) ? value : null; } export function resolveIssueChatHumanAuthor(args: { authorName?: string | null; authorUserId?: string | null; actorProfile?: string | null; currentUserId?: string | null; userProfileMap?: ReadonlyMap | null; }) { const { authorName, authorUserId, actorProfile, currentUserId, userProfileMap } = args; const trimmedActorProfile = actorProfile?.trim() || null; const profile = authorUserId ? userProfileMap?.get(authorUserId) : null; const isCurrentUser = !trimmedActorProfile && Boolean(authorUserId && currentUserId && authorUserId === currentUserId); return { isCurrentUser, authorName: trimmedActorProfile || profile?.label?.trim() || authorName?.trim() || (authorUserId === "local-board" ? "Board" : isCurrentUser ? "You" : "User"), avatarUrl: trimmedActorProfile ? null : (profile?.image ?? null), }; }