Only try to display images if they exist
This commit is contained in:
parent
82bbdfb929
commit
64dd10a6a0
3 changed files with 14 additions and 7 deletions
|
|
@ -216,12 +216,18 @@ NotificationsManager::formatNotification(const mtx::responses::Notification ¬
|
|||
if (hasMarkup_) {
|
||||
if (hasImages_ &&
|
||||
mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Image)
|
||||
{
|
||||
QString imgPath = cacheImage(notification.event);
|
||||
if (imgPath.isNull())
|
||||
return mtx::accessors::formattedBodyWithFallback(notification.event).prepend(messageLeadIn);
|
||||
else
|
||||
return QString(
|
||||
"<img src=\"file:///" + cacheImage(notification.event) +
|
||||
"<img src=\"file:///" + imgPath +
|
||||
"\" alt=\"" +
|
||||
mtx::accessors::formattedBodyWithFallback(notification.event) +
|
||||
"\">")
|
||||
.prepend(messageLeadIn);
|
||||
}
|
||||
|
||||
return mtx::accessors::formattedBodyWithFallback(notification.event)
|
||||
.prepend(messageLeadIn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue