Skip to content

Commit b51c13a

Browse files
authored
[QU-289] Get messages with include thread info (#45)
* Set includeThreadInfo to true when replyType is 'quote_reply'
1 parent 1d1c489 commit b51c13a

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed

src/smart-components/Conversation/hooks/useHandleReconnect.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ function useHandleReconnect(
4242
messageListParams.includeReplies = false;
4343
messageListParams.includeReaction = useReaction;
4444
if (replyType && replyType === 'QUOTE_REPLY') {
45+
messageListParams.includeThreadInfo = true;
4546
messageListParams.includeParentMessageInfo = true;
4647
messageListParams.replyType = 'all';
4748
}

src/smart-components/Conversation/hooks/useInitialMessagesFetch.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function useInitialMessagesFetch({
3636
messageListParams.includeReplies = false;
3737
messageListParams.includeReaction = true;
3838
if (replyType && replyType === 'QUOTE_REPLY') {
39+
messageListParams.includeThreadInfo = true;
3940
messageListParams.includeParentMessageInfo = true;
4041
messageListParams.replyType = 'all';
4142
}
@@ -72,6 +73,19 @@ function useInitialMessagesFetch({
7273
// to make sure there are no more messages below
7374
const nextMessageListParams = new sdk.MessageListParams();
7475
nextMessageListParams.nextResultSize = NEXT_RESULT_SIZE;
76+
nextMessageListParams.isInclusive = true;
77+
nextMessageListParams.includeReplies = false;
78+
nextMessageListParams.includeReaction = true;
79+
if (replyType && replyType === 'QUOTE_REPLY') {
80+
nextMessageListParams.includeThreadInfo = true;
81+
nextMessageListParams.includeParentMessageInfo = true;
82+
nextMessageListParams.replyType = 'all';
83+
}
84+
if (userFilledMessageListQuery) {
85+
Object.keys(userFilledMessageListQuery).forEach((key) => {
86+
nextMessageListParams[key] = userFilledMessageListQuery[key];
87+
});
88+
}
7589
currentGroupChannel.getMessagesByTimestamp(
7690
latestFetchedMessageTimeStamp || new Date().getTime(),
7791
nextMessageListParams,

src/smart-components/Conversation/hooks/useScrollCallback.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function useScrollCallback({
2424
messageListParams.includeReplies = false;
2525
messageListParams.includeReaction = useReaction;
2626
if (replyType && replyType === 'QUOTE_REPLY') {
27+
messageListParams.includeThreadInfo = true;
2728
messageListParams.includeParentMessageInfo = true;
2829
messageListParams.replyType = 'all';
2930
}

src/smart-components/Conversation/hooks/useScrollDownCallback.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function useScrollDownCallback({
2626
messageListParams.includeReplies = false;
2727
messageListParams.includeReaction = useReaction;
2828
if (replyType && replyType === 'QUOTE_REPLY') {
29+
messageListParams.includeThreadInfo = true;
2930
messageListParams.includeParentMessageInfo = true;
3031
messageListParams.replyType = 'all';
3132
}

src/utils/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ export const getEmojiListAll = (emojiContainer: EmojiContainer): Array<Emoji> =>
294294
);
295295
export const getEmojiMapAll = (emojiContainer: EmojiContainer): Map<string, Emoji> => {
296296
const emojiMap = new Map();
297-
emojiContainer.emojiCategories.forEach((category: EmojiCategory) => category.emojis.forEach((emoji: Emoji): void => { emojiMap.set(emoji.key, emoji) }));
297+
emojiContainer?.emojiCategories?.forEach((category: EmojiCategory) => {
298+
category.emojis.forEach((emoji: Emoji): void => {
299+
emojiMap.set(emoji.key, emoji);
300+
});
301+
});
298302
return emojiMap;
299303
};
300304

0 commit comments

Comments
 (0)