This commit is contained in:
Matthias Hochmeister
2026-03-13 16:12:11 +01:00
parent 602d9fd5b9
commit 02d9d808b2
3 changed files with 66 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ interface ChatMessageProps {
isOwnMessage: boolean;
onReplyClick?: (message: NextcloudMessage) => void;
onReactionToggled?: (messageId: number) => void;
reactionsOverride?: { reactions: Record<string, number>; reactionsSelf: string[] };
}
function hasFileParams(params?: Record<string, any>): boolean {
@@ -27,7 +28,7 @@ function hasPollParam(params?: Record<string, any>): boolean {
return params?.object?.type === 'talk-poll';
}
const ChatMessage: React.FC<ChatMessageProps> = ({ message, isOwnMessage, onReplyClick, onReactionToggled }) => {
const ChatMessage: React.FC<ChatMessageProps> = ({ message, isOwnMessage, onReplyClick, onReactionToggled, reactionsOverride }) => {
const [hovered, setHovered] = useState(false);
const longPressTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -79,8 +80,8 @@ const ChatMessage: React.FC<ChatMessageProps> = ({ message, isOwnMessage, onRepl
const textBeforeFile = isFileMessage ? message.message.split('{file}')[0].trim() : null;
const reactions = message.reactions ?? {};
const reactionsSelf = message.reactionsSelf ?? [];
const reactions = reactionsOverride?.reactions ?? message.reactions ?? {};
const reactionsSelf = reactionsOverride?.reactionsSelf ?? message.reactionsSelf ?? [];
const hasReactions = Object.keys(reactions).length > 0;
return (