|
|
|
@ -724,39 +724,40 @@ export const getMessagePropsByMessageId = createSelector(
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const getMessageReactsProps = createSelector(getMessagePropsByMessageId, (props):
|
|
|
|
|
| MessageReactsSelectorProps
|
|
|
|
|
| undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
export const getMessageReactsProps = createSelector(
|
|
|
|
|
getMessagePropsByMessageId,
|
|
|
|
|
(props): MessageReactsSelectorProps | undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const msgProps: MessageReactsSelectorProps = pick(props.propsForMessage, [
|
|
|
|
|
'convoId',
|
|
|
|
|
'conversationType',
|
|
|
|
|
'reacts',
|
|
|
|
|
'serverId',
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
if (msgProps.reacts) {
|
|
|
|
|
// NOTE we don't want to render reactions that have 'senders' as an object this is a deprecated type used during development 25/08/2022
|
|
|
|
|
const oldReactions = Object.values(msgProps.reacts).filter(
|
|
|
|
|
reaction => !Array.isArray(reaction.senders)
|
|
|
|
|
);
|
|
|
|
|
const msgProps: MessageReactsSelectorProps = pick(props.propsForMessage, [
|
|
|
|
|
'convoId',
|
|
|
|
|
'conversationType',
|
|
|
|
|
'reacts',
|
|
|
|
|
'serverId',
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
if (msgProps.reacts) {
|
|
|
|
|
// NOTE we don't want to render reactions that have 'senders' as an object this is a deprecated type used during development 25/08/2022
|
|
|
|
|
const oldReactions = Object.values(msgProps.reacts).filter(
|
|
|
|
|
reaction => !Array.isArray(reaction.senders)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (oldReactions.length > 0) {
|
|
|
|
|
msgProps.reacts = undefined;
|
|
|
|
|
return msgProps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (oldReactions.length > 0) {
|
|
|
|
|
msgProps.reacts = undefined;
|
|
|
|
|
return msgProps;
|
|
|
|
|
const sortedReacts = Object.entries(msgProps.reacts).sort((a, b) => {
|
|
|
|
|
return a[1].index < b[1].index ? -1 : a[1].index > b[1].index ? 1 : 0;
|
|
|
|
|
});
|
|
|
|
|
msgProps.sortedReacts = sortedReacts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const sortedReacts = Object.entries(msgProps.reacts).sort((a, b) => {
|
|
|
|
|
return a[1].index < b[1].index ? -1 : a[1].index > b[1].index ? 1 : 0;
|
|
|
|
|
});
|
|
|
|
|
msgProps.sortedReacts = sortedReacts;
|
|
|
|
|
return msgProps;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return msgProps;
|
|
|
|
|
});
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const getMessageQuoteProps = createSelector(
|
|
|
|
|
getConversationLookup,
|
|
|
|
@ -840,45 +841,47 @@ export const getMessageQuoteProps = createSelector(
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const getMessageTextProps = createSelector(getMessagePropsByMessageId, (props):
|
|
|
|
|
| MessageTextSelectorProps
|
|
|
|
|
| undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const msgProps: MessageTextSelectorProps = pick(props.propsForMessage, [
|
|
|
|
|
'direction',
|
|
|
|
|
'status',
|
|
|
|
|
'text',
|
|
|
|
|
'isDeleted',
|
|
|
|
|
'conversationType',
|
|
|
|
|
]);
|
|
|
|
|
export const getMessageTextProps = createSelector(
|
|
|
|
|
getMessagePropsByMessageId,
|
|
|
|
|
(props): MessageTextSelectorProps | undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return msgProps;
|
|
|
|
|
});
|
|
|
|
|
const msgProps: MessageTextSelectorProps = pick(props.propsForMessage, [
|
|
|
|
|
'direction',
|
|
|
|
|
'status',
|
|
|
|
|
'text',
|
|
|
|
|
'isDeleted',
|
|
|
|
|
'conversationType',
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
export const getMessageAttachmentProps = createSelector(getMessagePropsByMessageId, (props):
|
|
|
|
|
| MessageAttachmentSelectorProps
|
|
|
|
|
| undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
return msgProps;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const msgProps: MessageAttachmentSelectorProps = {
|
|
|
|
|
attachments: props.propsForMessage.attachments || [],
|
|
|
|
|
...pick(props.propsForMessage, [
|
|
|
|
|
'direction',
|
|
|
|
|
'isTrustedForAttachmentDownload',
|
|
|
|
|
'timestamp',
|
|
|
|
|
'serverTimestamp',
|
|
|
|
|
'sender',
|
|
|
|
|
'convoId',
|
|
|
|
|
]),
|
|
|
|
|
};
|
|
|
|
|
export const getMessageAttachmentProps = createSelector(
|
|
|
|
|
getMessagePropsByMessageId,
|
|
|
|
|
(props): MessageAttachmentSelectorProps | undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return msgProps;
|
|
|
|
|
});
|
|
|
|
|
const msgProps: MessageAttachmentSelectorProps = {
|
|
|
|
|
attachments: props.propsForMessage.attachments || [],
|
|
|
|
|
...pick(props.propsForMessage, [
|
|
|
|
|
'direction',
|
|
|
|
|
'isTrustedForAttachmentDownload',
|
|
|
|
|
'timestamp',
|
|
|
|
|
'serverTimestamp',
|
|
|
|
|
'sender',
|
|
|
|
|
'convoId',
|
|
|
|
|
]),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return msgProps;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const getIsMessageSelected = createSelector(
|
|
|
|
|
getMessagePropsByMessageId,
|
|
|
|
@ -894,27 +897,28 @@ export const getIsMessageSelected = createSelector(
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const getMessageContentSelectorProps = createSelector(getMessagePropsByMessageId, (props):
|
|
|
|
|
| MessageContentSelectorProps
|
|
|
|
|
| undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
export const getMessageContentSelectorProps = createSelector(
|
|
|
|
|
getMessagePropsByMessageId,
|
|
|
|
|
(props): MessageContentSelectorProps | undefined => {
|
|
|
|
|
if (!props || isEmpty(props)) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const msgProps: MessageContentSelectorProps = {
|
|
|
|
|
...pick(props.propsForMessage, [
|
|
|
|
|
'direction',
|
|
|
|
|
'serverTimestamp',
|
|
|
|
|
'text',
|
|
|
|
|
'timestamp',
|
|
|
|
|
'previews',
|
|
|
|
|
'quote',
|
|
|
|
|
'attachments',
|
|
|
|
|
]),
|
|
|
|
|
};
|
|
|
|
|
const msgProps: MessageContentSelectorProps = {
|
|
|
|
|
...pick(props.propsForMessage, [
|
|
|
|
|
'direction',
|
|
|
|
|
'serverTimestamp',
|
|
|
|
|
'text',
|
|
|
|
|
'timestamp',
|
|
|
|
|
'previews',
|
|
|
|
|
'quote',
|
|
|
|
|
'attachments',
|
|
|
|
|
]),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return msgProps;
|
|
|
|
|
});
|
|
|
|
|
return msgProps;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const getMessageContentWithStatusesSelectorProps = createSelector(
|
|
|
|
|
getMessagePropsByMessageId,
|
|
|
|
|