Fix pmp messages showing fallback in copy

This commit is contained in:
Josie committed 2026-08-04 00:10:02 +01:00
1 parent a9ac09e56a
commit ccdce73e62
1 file changed
+6 -2
@@ -62,7 +62,10 @@ import {
} from '$features/bookmarks';
import { CopyIcon } from '@phosphor-icons/react';
import * as OptionsCss from './Options.css';
import { MATRIX_SABLE_UNSTABLE_FAVORITE_GIFS } from '$unstable/prefixes';
import {
MATRIX_SABLE_UNSTABLE_FAVORITE_GIFS,
MATRIX_UNSTABLE_PER_MESSAGE_PROFILE_PROPERTY_NAME,
} from '$unstable/prefixes';
import { useFavoriteGifs } from '$hooks/useFavoriteGifs';
import type { IImageInfo } from '$types/matrix/common';
import { getIncomingMediaMxcUrl } from '../MsgTypeRenderers';
@@ -172,7 +175,8 @@ const MessageCopyTextItem = as<
>(({ room, mEvent, onClose, ...props }, ref) => {
const handleCopy = () => {
const content = mEvent.getContent();
const body = content?.body;
const pmp = content[MATRIX_UNSTABLE_PER_MESSAGE_PROFILE_PROPERTY_NAME];
const body = pmp ? content?.body?.replace(`${pmp.displayname}: `, '') : content?.body;
if (body) copyToClipboard(body);
onClose();