Further refactor MessageContentModel
Further refactor MessageContentModel. Move away from special casing certian MessageContentTypes. Use forEachComponentOfType more
This commit is contained in:
@@ -78,7 +78,15 @@ public:
|
||||
{
|
||||
using namespace Quotient;
|
||||
|
||||
if (event.isRedacted()) {
|
||||
return MessageComponentType::Text;
|
||||
}
|
||||
|
||||
if (const auto e = eventCast<const RoomMessageEvent>(&event)) {
|
||||
if (e->rawMsgtype() == u"m.key.verification.request"_s) {
|
||||
return MessageComponentType::Verification;
|
||||
}
|
||||
|
||||
switch (e->msgtype()) {
|
||||
case MessageEventType::Emote:
|
||||
return MessageComponentType::Text;
|
||||
|
||||
@@ -570,8 +570,8 @@ QVariantMap TextHandler::getAttributes(const QString &tag, const QString &tagStr
|
||||
QList<MessageComponent>
|
||||
TextHandler::textComponents(QString string, Qt::TextFormat inputFormat, const NeoChatRoom *room, const Quotient::RoomEvent *event, bool isEdited)
|
||||
{
|
||||
if (string.isEmpty()) {
|
||||
return {};
|
||||
if (string.trimmed().isEmpty()) {
|
||||
return {MessageComponent{MessageComponentType::Text, i18n("<i>This event does not have any content.</i>"), {}}};
|
||||
}
|
||||
|
||||
// Strip mx-reply if present.
|
||||
|
||||
Reference in New Issue
Block a user