removed the necessity of messageId or id
This commit is contained in:
parent
3072196cda
commit
fb7da4f70c
|
@ -54,7 +54,7 @@ const AttachedActions = ({ attachment, getCustomEmoji }: { attachment: IAttachme
|
||||||
};
|
};
|
||||||
|
|
||||||
const Attachments: React.FC<IMessageAttachments> = React.memo(
|
const Attachments: React.FC<IMessageAttachments> = React.memo(
|
||||||
({ attachments, timeFormat, showAttachment, style, getCustomEmoji, isReply, id, author }: IMessageAttachments) => {
|
({ attachments, timeFormat, showAttachment, style, getCustomEmoji, isReply, author }: IMessageAttachments) => {
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
|
|
||||||
if (!attachments || attachments.length === 0) {
|
if (!attachments || attachments.length === 0) {
|
||||||
|
@ -112,16 +112,7 @@ const Attachments: React.FC<IMessageAttachments> = React.memo(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return <Reply key={index} index={index} attachment={file} timeFormat={timeFormat} getCustomEmoji={getCustomEmoji} />;
|
||||||
<Reply
|
|
||||||
key={index}
|
|
||||||
index={index}
|
|
||||||
attachment={file}
|
|
||||||
timeFormat={timeFormat}
|
|
||||||
getCustomEmoji={getCustomEmoji}
|
|
||||||
messageId={id}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
return <>{attachmentsElements}</>;
|
return <>{attachmentsElements}</>;
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { StyleSheet, Text, View } from 'react-native';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { dequal } from 'dequal';
|
import { dequal } from 'dequal';
|
||||||
import FastImage from 'react-native-fast-image';
|
import FastImage from 'react-native-fast-image';
|
||||||
import parse from 'url-parse';
|
|
||||||
|
|
||||||
import Touchable from './Touchable';
|
import Touchable from './Touchable';
|
||||||
import Markdown from '../markdown';
|
import Markdown from '../markdown';
|
||||||
|
@ -92,7 +91,6 @@ interface IMessageReply {
|
||||||
timeFormat?: string;
|
timeFormat?: string;
|
||||||
index: number;
|
index: number;
|
||||||
getCustomEmoji: TGetCustomEmoji;
|
getCustomEmoji: TGetCustomEmoji;
|
||||||
messageId: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Title = React.memo(
|
const Title = React.memo(
|
||||||
|
@ -199,7 +197,7 @@ const Fields = React.memo(
|
||||||
);
|
);
|
||||||
|
|
||||||
const Reply = React.memo(
|
const Reply = React.memo(
|
||||||
({ attachment, timeFormat, index, getCustomEmoji, messageId }: IMessageReply) => {
|
({ attachment, timeFormat, index, getCustomEmoji }: IMessageReply) => {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
const { baseUrl, user, jumpToMessage } = useContext(MessageContext);
|
const { baseUrl, user, jumpToMessage } = useContext(MessageContext);
|
||||||
|
@ -226,12 +224,6 @@ const Reply = React.memo(
|
||||||
openLink(url, theme);
|
openLink(url, theme);
|
||||||
};
|
};
|
||||||
|
|
||||||
let attachmentId = '';
|
|
||||||
if (attachment.message_link) {
|
|
||||||
const parsedUrl = parse(attachment.message_link, true);
|
|
||||||
attachmentId = parsedUrl.query.msg || messageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
let { borderColor } = themes[theme];
|
let { borderColor } = themes[theme];
|
||||||
if (attachment.color) {
|
if (attachment.color) {
|
||||||
borderColor = attachment.color;
|
borderColor = attachment.color;
|
||||||
|
@ -264,7 +256,6 @@ const Reply = React.memo(
|
||||||
timeFormat={timeFormat}
|
timeFormat={timeFormat}
|
||||||
style={[{ color: themes[theme].auxiliaryTintColor, fontSize: 14, marginBottom: 8 }]}
|
style={[{ color: themes[theme].auxiliaryTintColor, fontSize: 14, marginBottom: 8 }]}
|
||||||
isReply
|
isReply
|
||||||
id={attachmentId}
|
|
||||||
/>
|
/>
|
||||||
<Fields attachment={attachment} getCustomEmoji={getCustomEmoji} theme={theme} />
|
<Fields attachment={attachment} getCustomEmoji={getCustomEmoji} theme={theme} />
|
||||||
{loading ? (
|
{loading ? (
|
||||||
|
|
|
@ -14,7 +14,6 @@ export interface IMessageAttachments {
|
||||||
isReply?: boolean;
|
isReply?: boolean;
|
||||||
showAttachment?: (file: IAttachment) => void;
|
showAttachment?: (file: IAttachment) => void;
|
||||||
getCustomEmoji: TGetCustomEmoji;
|
getCustomEmoji: TGetCustomEmoji;
|
||||||
id: string;
|
|
||||||
author?: IUserMessage;
|
author?: IUserMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue