@@ -4,6 +4,7 @@ import { cacheSearchHitEvent } from "@/app/navigation/searchHitEventCache";
44import { useAppNavigation } from "@/app/navigation/useAppNavigation" ;
55import { useActiveChannelHeader } from "@/features/channels/useActiveChannelHeader" ;
66import { useChannelPaneHandlers } from "@/features/channels/useChannelPaneHandlers" ;
7+ import { useMessageEventProfilePubkeys } from "@/features/channels/useMessageEventProfilePubkeys" ;
78import { useThreadTargetSync } from "@/features/channels/useThreadTargetSync" ;
89import {
910 useChannelMembersQuery ,
@@ -37,12 +38,7 @@ import {
3738 useSendMessageMutation ,
3839 useToggleReactionMutation ,
3940} from "@/features/messages/hooks" ;
40- import {
41- collectMessageAuthorPubkeys ,
42- collectMessageMentionPubkeys ,
43- collectReactionActorPubkeys ,
44- formatTimelineMessages ,
45- } from "@/features/messages/lib/formatTimelineMessages" ;
41+ import { formatTimelineMessages } from "@/features/messages/lib/formatTimelineMessages" ;
4642import {
4743 channelWindowThreadSummaries ,
4844 type ChannelWindowThreadSummary ,
@@ -59,6 +55,7 @@ import { useThreadReplies } from "@/features/messages/useThreadReplies";
5955import { useChannelTyping } from "@/features/messages/useChannelTyping" ;
6056import type { TimelineMessage } from "@/features/messages/types" ;
6157import { useUsersBatchQuery } from "@/features/profile/hooks" ;
58+ import { useRelaySelfQuery } from "@/features/moderation/hooks" ;
6259import type { RelayEvent , RespondToMode , SearchHit } from "@/shared/api/types" ;
6360import { useChannelFind } from "@/features/search/useChannelFind" ;
6461import { ViewLoadingFallback } from "@/shared/ui/ViewLoadingFallback" ;
@@ -158,6 +155,7 @@ export function ChannelScreen({
158155 const mainInsetRef = useMainInsetRef ( ) ;
159156 const currentPubkey = currentIdentity ?. pubkey ;
160157 const activeChannelId = activeChannel ?. id ?? null ;
158+ const relaySelfPubkey = useRelaySelfQuery ( activeChannel !== null ) . data ;
161159 const effectiveOpenThreadHeadId =
162160 optimisticOpenThreadHeadId === undefined
163161 ? openThreadHeadId
@@ -249,16 +247,11 @@ export function ChannelScreen({
249247 return extraEvents . reduce ( mergeMessages , currentMessages ) ;
250248 } , [ activeChannel , findEvents , messagesQuery . data , targetMessageEvents ] ) ;
251249 const threadReplyEvents = threadRepliesQuery . data ?? EMPTY_RELAY_EVENTS ;
252- const messageEventProfilePubkeys = React . useMemo ( ( ) => {
253- const events = [ ...resolvedMessages , ...threadReplyEvents ] ;
254- return [
255- ...new Set ( [
256- ...collectMessageAuthorPubkeys ( events ) ,
257- ...collectMessageMentionPubkeys ( events ) ,
258- ...collectReactionActorPubkeys ( events ) ,
259- ] ) ,
260- ] ;
261- } , [ resolvedMessages , threadReplyEvents ] ) ;
250+ const messageEventProfilePubkeys = useMessageEventProfilePubkeys (
251+ resolvedMessages ,
252+ threadReplyEvents ,
253+ relaySelfPubkey ,
254+ ) ;
262255 const latestMessageEvent = React . useMemo (
263256 ( ) => resolvedMessages [ resolvedMessages . length - 1 ] ?? null ,
264257 [ resolvedMessages ] ,
@@ -267,6 +260,7 @@ export function ChannelScreen({
267260 activeChannel ,
268261 currentPubkey ,
269262 latestMessageEvent ,
263+ relaySelfPubkey ,
270264 ) ;
271265 const activeDmParticipantPubkeys = React . useMemo (
272266 ( ) =>
@@ -396,6 +390,7 @@ export function ChannelScreen({
396390 channelMembers ,
397391 personaLookup ,
398392 respondToLookup ,
393+ relaySelfPubkey ,
399394 ) ,
400395 [
401396 activeChannel ,
@@ -404,6 +399,7 @@ export function ChannelScreen({
404399 currentPubkey ,
405400 messageProfiles ,
406401 personaLookup ,
402+ relaySelfPubkey ,
407403 respondToLookup ,
408404 resolvedMessages ,
409405 ] ,
@@ -442,6 +438,7 @@ export function ChannelScreen({
442438 members : channelMembers ,
443439 personaLookup,
444440 respondToLookup,
441+ relaySelfPubkey,
445442 } ) ;
446443 const {
447444 firstUnreadMessageId,
0 commit comments