[Chat] Don't tag cards that have no match in the database (#2217)

Took 6 minutes
This commit is contained in:
Lukas Brübach
2026-08-04 18:46:10 +02:00
parent 1ed9823b56
commit 4ecf3d5267

View File

@@ -13,6 +13,7 @@
#include <QDesktopServices>
#include <QMouseEvent>
#include <QScrollBar>
#include <libcockatrice/card/database/card_database_manager.h>
#include <libcockatrice/network/server/remote/user_level.h>
#include <libcockatrice/settings/chat_settings.h>
@@ -172,6 +173,11 @@ void ChatView::appendHtmlServerMessage(const QString &html, bool optionalIsBold,
void ChatView::appendCardTag(QTextCursor &cursor, const QString &cardName)
{
if (!CardDatabaseManager::query()->lookupCardByName(cardName)) {
cursor.insertText(cardName);
return;
}
QTextCharFormat oldFormat = cursor.charFormat();
QTextCharFormat anchorFormat = oldFormat;
anchorFormat.setForeground(linkColor);