Fix the master show link preview setting and add back the per room setting
Title BUG: 486126
This commit is contained in:
@@ -277,7 +277,9 @@ void MessageContentModel::updateComponents(bool isEditing)
|
|||||||
m_components.append(componentsForType(eventHandler.messageComponentType()));
|
m_components.append(componentsForType(eventHandler.messageComponentType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
addLinkPreviews();
|
if (m_room->urlPreviewEnabled()) {
|
||||||
|
addLinkPreviews();
|
||||||
|
}
|
||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
@@ -360,8 +362,9 @@ void MessageContentModel::addLinkPreviews()
|
|||||||
if (LinkPreviewer::hasPreviewableLinks(component.content)) {
|
if (LinkPreviewer::hasPreviewableLinks(component.content)) {
|
||||||
const auto links = LinkPreviewer::linkPreviews(component.content);
|
const auto links = LinkPreviewer::linkPreviews(component.content);
|
||||||
for (qsizetype j = 0; j < links.size(); ++j) {
|
for (qsizetype j = 0; j < links.size(); ++j) {
|
||||||
if (!m_removedLinkPreviews.contains(links[j])) {
|
const auto linkPreview = linkPreviewComponent(links[j]);
|
||||||
m_components.insert(i + j + 1, linkPreviewComponent(links[j]));
|
if (!m_removedLinkPreviews.contains(links[j]) && !linkPreview.isEmpty()) {
|
||||||
|
m_components.insert(i + j + 1, linkPreview);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "neochatroom.h"
|
#include "neochatroom.h"
|
||||||
|
|
||||||
struct MessageComponent {
|
struct MessageComponent {
|
||||||
MessageComponentType::Type type;
|
MessageComponentType::Type type = MessageComponentType::Other;
|
||||||
QString content;
|
QString content;
|
||||||
QVariantMap attributes;
|
QVariantMap attributes;
|
||||||
|
|
||||||
@@ -23,6 +23,11 @@ struct MessageComponent {
|
|||||||
{
|
{
|
||||||
return type == right.type && content == right.content && attributes == right.attributes;
|
return type == right.type && content == right.content && attributes == right.attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isEmpty() const
|
||||||
|
{
|
||||||
|
return type == MessageComponentType::Other;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user