fix(web): always show media actions in context menu for media messages
Some checks failed
CI / test (push) Failing after 20s
Some checks failed
CI / test (push) Failing after 20s
This commit is contained in:
@@ -378,7 +378,7 @@ export function MessageList() {
|
||||
event.preventDefault();
|
||||
void ensureReactionsLoaded(message.id);
|
||||
const pos = getSafeContextPosition(event.clientX, event.clientY, 220, 220);
|
||||
setCtx({ x: pos.x, y: pos.y, messageId: message.id, attachmentUrl: null });
|
||||
setCtx({ x: pos.x, y: pos.y, messageId: message.id, attachmentUrl: getMessageAttachmentUrl(message) });
|
||||
}}
|
||||
>
|
||||
{selectedIds.size > 0 ? (
|
||||
@@ -876,6 +876,17 @@ function canDeleteForEveryone(
|
||||
return message.sender_id === meId;
|
||||
}
|
||||
|
||||
function getMessageAttachmentUrl(message: Message): string | null {
|
||||
const mediaTypes = new Set(["image", "video", "audio", "voice", "file", "circle_video"]);
|
||||
if (!mediaTypes.has(message.type)) {
|
||||
return null;
|
||||
}
|
||||
if (!message.text || !/^https?:\/\//i.test(message.text)) {
|
||||
return null;
|
||||
}
|
||||
return message.text;
|
||||
}
|
||||
|
||||
function extractFileName(url: string): string {
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
|
||||
Reference in New Issue
Block a user