Page MenuHomePhorge

D9465.1768439523.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D9465.1768439523.diff

diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -1768,12 +1768,30 @@
return chatMentionCandidatesObj;
}
-const emptyMentionCandidates = {};
function useThreadChatMentionCandidates(
- // eslint-disable-next-line no-unused-vars
threadInfo: ThreadInfo,
): ChatMentionCandidates {
- return emptyMentionCandidates;
+ const { chatMentionCandidatesObj, communityThreadIDForGenesisThreads } =
+ useChatMentionCandidatesObjAndUtils();
+ return React.useMemo(() => {
+ let communityID,
+ result = {};
+ if (threadInfo.community === genesis.id) {
+ communityID = communityThreadIDForGenesisThreads[threadInfo.id];
+ } else {
+ communityID = threadInfo.community ?? threadInfo.id;
+ }
+ if (chatMentionCandidatesObj[communityID]) {
+ result = { ...chatMentionCandidatesObj[communityID] };
+ }
+ delete result[threadInfo.id];
+ return result;
+ }, [
+ chatMentionCandidatesObj,
+ communityThreadIDForGenesisThreads,
+ threadInfo.community,
+ threadInfo.id,
+ ]);
}
function useUserProfileThreadInfo(userInfo: ?UserInfo): ?UserProfileThreadInfo {
@@ -1834,7 +1852,6 @@
]);
}
-// eslint-disable-next-line no-unused-vars
function useChatMentionSearchIndex(): {
+[id: string]: SentencePrefixSearchIndex,
} {
@@ -1863,12 +1880,20 @@
}, [chatMentionCandidatesObj]);
}
-const emptySearchIndex = new SentencePrefixSearchIndex();
function useThreadChatMentionSearchIndex(
- // eslint-disable-next-line no-unused-vars
threadInfo: ThreadInfo,
): SentencePrefixSearchIndex {
- return emptySearchIndex;
+ const chatMentionCandidatesSearchIndex = useChatMentionSearchIndex();
+ const { communityThreadIDForGenesisThreads } =
+ useChatMentionCandidatesObjAndUtils();
+ if (threadInfo.community === genesis.id) {
+ return chatMentionCandidatesSearchIndex[
+ communityThreadIDForGenesisThreads[threadInfo.id]
+ ];
+ }
+ return chatMentionCandidatesSearchIndex[
+ threadInfo.community ?? threadInfo.id
+ ];
}
export {

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 1:12 AM (10 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5930246
Default Alt Text
D9465.1768439523.diff (2 KB)

Event Timeline