Don't show the file name underneath the image
This still keeps custom image descriptions, but no longer shows it for images where it was the same as their filename.
This commit is contained in:
@@ -588,15 +588,22 @@ QList<MessageComponent> MessageContentModel::componentsForType(MessageComponentT
|
|||||||
case MessageComponentType::Video: {
|
case MessageComponentType::Video: {
|
||||||
if (!event.first->is<StickerEvent>()) {
|
if (!event.first->is<StickerEvent>()) {
|
||||||
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
|
||||||
QList<MessageComponent> components;
|
const auto fileContent = roomMessageEvent->get<EventContent::FileContentBase>();
|
||||||
components += MessageComponent{type, QString(), {}};
|
if (fileContent != nullptr) {
|
||||||
auto body = EventHandler::rawMessageBody(*roomMessageEvent);
|
const auto fileInfo = fileContent->commonInfo();
|
||||||
components += TextHandler().textComponents(body,
|
const auto body = EventHandler::rawMessageBody(*roomMessageEvent);
|
||||||
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
// Do not attach the description to the image, if it's the same as the original filename.
|
||||||
m_room,
|
if (fileInfo.originalName != body) {
|
||||||
roomMessageEvent,
|
QList<MessageComponent> components;
|
||||||
roomMessageEvent->isReplaced());
|
components += MessageComponent{type, QString(), {}};
|
||||||
return components;
|
components += TextHandler().textComponents(body,
|
||||||
|
EventHandler::messageBodyInputFormat(*roomMessageEvent),
|
||||||
|
m_room,
|
||||||
|
roomMessageEvent,
|
||||||
|
roomMessageEvent->isReplaced());
|
||||||
|
return components;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user