From f763753b26df2925999d0e765e79481c99d6bd57 Mon Sep 17 00:00:00 2001 From: HoonBaek Date: Tue, 26 Oct 2021 14:29:34 +0900 Subject: [PATCH 1/2] Set includeThreadInfo to true when replyType is 'quote_reply' --- .../Conversation/hooks/useHandleReconnect.ts | 1 + .../Conversation/hooks/useInitialMessagesFetch.js | 14 ++++++++++++++ .../Conversation/hooks/useScrollCallback.js | 1 + .../Conversation/hooks/useScrollDownCallback.js | 1 + src/utils/index.ts | 2 +- 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/smart-components/Conversation/hooks/useHandleReconnect.ts b/src/smart-components/Conversation/hooks/useHandleReconnect.ts index 9949ec531..1ddf65c25 100644 --- a/src/smart-components/Conversation/hooks/useHandleReconnect.ts +++ b/src/smart-components/Conversation/hooks/useHandleReconnect.ts @@ -42,6 +42,7 @@ function useHandleReconnect( messageListParams.includeReplies = false; messageListParams.includeReaction = useReaction; if (replyType && replyType === 'QUOTE_REPLY') { + messageListParams.includeThreadInfo = true; messageListParams.includeParentMessageInfo = true; messageListParams.replyType = 'all'; } diff --git a/src/smart-components/Conversation/hooks/useInitialMessagesFetch.js b/src/smart-components/Conversation/hooks/useInitialMessagesFetch.js index 04b05dae5..8772ddae5 100644 --- a/src/smart-components/Conversation/hooks/useInitialMessagesFetch.js +++ b/src/smart-components/Conversation/hooks/useInitialMessagesFetch.js @@ -36,6 +36,7 @@ function useInitialMessagesFetch({ messageListParams.includeReplies = false; messageListParams.includeReaction = true; if (replyType && replyType === 'QUOTE_REPLY') { + messageListParams.includeThreadInfo = true; messageListParams.includeParentMessageInfo = true; messageListParams.replyType = 'all'; } @@ -72,6 +73,19 @@ function useInitialMessagesFetch({ // to make sure there are no more messages below const nextMessageListParams = new sdk.MessageListParams(); nextMessageListParams.nextResultSize = NEXT_RESULT_SIZE; + nextMessageListParams.isInclusive = true; + nextMessageListParams.includeReplies = false; + nextMessageListParams.includeReaction = true; + if (replyType && replyType === 'QUOTE_REPLY') { + nextMessageListParams.includeThreadInfo = true; + nextMessageListParams.includeParentMessageInfo = true; + nextMessageListParams.replyType = 'all'; + } + if (userFilledMessageListQuery) { + Object.keys(userFilledMessageListQuery).forEach((key) => { + nextMessageListParams[key] = userFilledMessageListQuery[key]; + }); + } currentGroupChannel.getMessagesByTimestamp( latestFetchedMessageTimeStamp || new Date().getTime(), nextMessageListParams, diff --git a/src/smart-components/Conversation/hooks/useScrollCallback.js b/src/smart-components/Conversation/hooks/useScrollCallback.js index 4f4690e16..82d28eabe 100644 --- a/src/smart-components/Conversation/hooks/useScrollCallback.js +++ b/src/smart-components/Conversation/hooks/useScrollCallback.js @@ -24,6 +24,7 @@ function useScrollCallback({ messageListParams.includeReplies = false; messageListParams.includeReaction = useReaction; if (replyType && replyType === 'QUOTE_REPLY') { + messageListParams.includeThreadInfo = true; messageListParams.includeParentMessageInfo = true; messageListParams.replyType = 'all'; } diff --git a/src/smart-components/Conversation/hooks/useScrollDownCallback.js b/src/smart-components/Conversation/hooks/useScrollDownCallback.js index 0eed187e0..d081a8814 100644 --- a/src/smart-components/Conversation/hooks/useScrollDownCallback.js +++ b/src/smart-components/Conversation/hooks/useScrollDownCallback.js @@ -26,6 +26,7 @@ function useScrollDownCallback({ messageListParams.includeReplies = false; messageListParams.includeReaction = useReaction; if (replyType && replyType === 'QUOTE_REPLY') { + messageListParams.includeThreadInfo = true; messageListParams.includeParentMessageInfo = true; messageListParams.replyType = 'all'; } diff --git a/src/utils/index.ts b/src/utils/index.ts index 3dc309056..69419714c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -294,7 +294,7 @@ export const getEmojiListAll = (emojiContainer: EmojiContainer): Array => ); export const getEmojiMapAll = (emojiContainer: EmojiContainer): Map => { const emojiMap = new Map(); - emojiContainer.emojiCategories.forEach((category: EmojiCategory) => category.emojis.forEach((emoji: Emoji): void => { emojiMap.set(emoji.key, emoji) })); + emojiContainer?.emojiCategories?.forEach((category: EmojiCategory) => category.emojis.forEach((emoji: Emoji): void => { emojiMap.set(emoji.key, emoji) })); return emojiMap; }; From 46373c1e340ae97ed825c60d1999548e9f23006a Mon Sep 17 00:00:00 2001 From: HoonBaek Date: Tue, 26 Oct 2021 15:34:45 +0900 Subject: [PATCH 2/2] Make code looks simple --- src/utils/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 69419714c..7975e418f 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -294,7 +294,11 @@ export const getEmojiListAll = (emojiContainer: EmojiContainer): Array => ); export const getEmojiMapAll = (emojiContainer: EmojiContainer): Map => { const emojiMap = new Map(); - emojiContainer?.emojiCategories?.forEach((category: EmojiCategory) => category.emojis.forEach((emoji: Emoji): void => { emojiMap.set(emoji.key, emoji) })); + emojiContainer?.emojiCategories?.forEach((category: EmojiCategory) => { + category.emojis.forEach((emoji: Emoji): void => { + emojiMap.set(emoji.key, emoji); + }); + }); return emojiMap; };