Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const AttachmentsItem = ({ attachment, id, source }: AttachmentsItemProps) => {
}

if (isQuoteAttachment(attachment)) {
return <QuoteAttachment attachment={attachment} />;
return <QuoteAttachment attachment={attachment} source={source} />;
}

return <DefaultAttachment {...(attachment as any)} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useUserPreference } from '@rocket.chat/ui-contexts';
import { useTimeAgo } from '../../../../hooks/useTimeAgo';
import MessageContentBody from '../../MessageContentBody';
import Attachments from '../Attachments';
import type { AudioAttachmentSource } from './file/AudioAttachment';
import AttachmentAuthor from './structure/AttachmentAuthor';
import AttachmentAuthorAvatar from './structure/AttachmentAuthorAvatar';
import AttachmentAuthorName from './structure/AttachmentAuthorName';
Expand Down Expand Up @@ -34,9 +35,10 @@ const quoteStyles = css`

export type QuoteAttachmentProps = {
attachment: MessageQuoteAttachment;
source?: AudioAttachmentSource;
};

export const QuoteAttachment = ({ attachment }: QuoteAttachmentProps) => {
export const QuoteAttachment = ({ attachment, source }: QuoteAttachmentProps) => {
const formatTime = useTimeAgo();
const displayAvatarPreference = useUserPreference<boolean>('displayAvatars');

Expand Down Expand Up @@ -65,7 +67,11 @@ export const QuoteAttachment = ({ attachment }: QuoteAttachmentProps) => {
</AttachmentAuthor>
{attachment.attachments && (
<AttachmentInner>
<Attachments attachments={attachment.attachments} id={attachment.attachments[0]?.title_link} />
<Attachments
attachments={attachment.attachments}
id={attachment.attachments[0]?.title_link}
source={source && { rid: source.rid, mid: source.mid, name: attachment.author_name }}
/>
</AttachmentInner>
)}
{attachment.md ? <MessageContentBody md={attachment.md} /> : attachment.text.substring(attachment.text.indexOf('\n') + 1)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ const RoomMessageContent = ({ message, unread, all, mention, searchText }: RoomM
</MessageBody>
)}

{!!quotes?.length && <Attachments attachments={quotes} />}
{!!quotes?.length && (
<Attachments
attachments={quotes}
source={{ rid: message.rid, mid: message._id, username: message.u.username, name: message.u.name }}
/>
)}

{!normalizedMessage.blocks?.length && !!normalizedMessage.md?.length && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ const ThreadMessageContent = ({ message }: ThreadMessageContentProps) => {
</MessageBody>
)}

{!!quotes?.length && <Attachments attachments={quotes} />}
{!!quotes?.length && (
<Attachments
attachments={quotes}
source={{ rid: message.rid, mid: message._id, username: message.u.username, name: message.u.name }}
/>
)}

{!normalizedMessage.blocks?.length && !!normalizedMessage.md?.length && (
<>
Expand Down
Loading