diff --git a/native/avatars/thread-avatar.react.js b/native/avatars/thread-avatar.react.js --- a/native/avatars/thread-avatar.react.js +++ b/native/avatars/thread-avatar.react.js @@ -4,8 +4,9 @@ import { useAvatarForThread } from 'lib/hooks/avatar-hooks.js'; import { useResolvedThreadAvatar } from 'lib/shared/avatar-utils.js'; -import { getSingleOtherUser } from 'lib/shared/thread-utils.js'; +import { getSingleOtherUser, getCommunity } from 'lib/shared/thread-utils.js'; import type { AvatarSize } from 'lib/types/avatar-types.js'; +import type { CommunityInfo } from 'lib/types/community-types.js'; import type { ThreadInfo, ResolvedThreadInfo, @@ -33,6 +34,14 @@ state => state.currentUserInfo && state.currentUserInfo.id, ); + const communityID = getCommunity(threadInfo); + const communityInfo: ?CommunityInfo = useSelector(state => { + if (!communityID) { + return null; + } + return state.communityStore.communityInfos[communityID]; + }); + let displayUserIDForThread; if (threadTypeIsPrivate(threadInfo.type)) { displayUserIDForThread = viewerID; @@ -55,7 +64,17 @@ }; }); - const resolvedThreadAvatar = useResolvedThreadAvatar(avatarInfo, displayUser); + let userOrChannel; + if (displayUserIDForThread) { + userOrChannel = displayUser; + } else if (communityInfo?.farcasterChannelID) { + userOrChannel = { fcChannelID: communityInfo.farcasterChannelID }; + } + + const resolvedThreadAvatar = useResolvedThreadAvatar( + avatarInfo, + userOrChannel, + ); return ; }