fix if prop undefined for getMxc and event

dev
adb 4 years ago
parent 64d52b071d
commit 01fe023d06

@ -1,7 +1,7 @@
<template> <template>
<div class="event"> <div class="event">
<div v-if="event.type==='m.room.message'" :class="type==='send'?'messageSend':'messageReceive'" class="message"> <div v-if="event.type==='m.room.message'" :class="type==='send'?'messageSend':'messageReceive'" class="message">
<reply-event :event="replyEvent"/> <reply-event :event="replyEvent" v-if="replyEvent"/>
<div v-if="event.content.msgtype==='m.text'" v-html="parseMessage(event.content.body)"/> <div v-if="event.content.msgtype==='m.text'" v-html="parseMessage(event.content.body)"/>
<div v-else-if="event.content.msgtype==='m.notice'" class="notice" v-html="parseMessage(event.content.body)"/> <div v-else-if="event.content.msgtype==='m.notice'" class="notice" v-html="parseMessage(event.content.body)"/>

@ -26,6 +26,7 @@ export function getPreviewUrl(mxcUrl, size = 64, resizeMethod = 'crop'){
} }
export function getMediaUrl(mxcUrl){ export function getMediaUrl(mxcUrl){
if (!mxcUrl) return undefined;
let mxc = parseMXC.parse(mxcUrl); let mxc = parseMXC.parse(mxcUrl);
return `${matrix.baseUrl}/_matrix/media/r0/download/${ return `${matrix.baseUrl}/_matrix/media/r0/download/${
mxc.homeserver}/${mxc.id}`; mxc.homeserver}/${mxc.id}`;

Loading…
Cancel
Save