use shortcode as a fallback for custom emote title

Some clients (e.g. FluffyChat) don't have a UI for specifying the emote
title, and instead use the shortcode as the title. This sets the title
accordingly even if the emote was added through such a client and only
has a shortcode.
This commit is contained in:
Ivan Pavluk 2022-02-13 04:46:15 +07:00
parent dfb8f9a160
commit 2a2ef2f2e5
1 changed files with 3 additions and 1 deletions

View File

@ -60,7 +60,9 @@ CombinedImagePackModel::data(const QModelIndex &index, int role) const
return QStringLiteral(
"<img data-mx-emoticon height=32 src=\"%1\" alt=\"%2\" title=\"%2\">")
.arg(QString::fromStdString(images[index.row()].image.url).toHtmlEscaped(),
QString::fromStdString(images[index.row()].image.body));
images[index.row()].image.body.length() > 0
? QString::fromStdString(images[index.row()].image.body)
: images[index.row()].shortcode);
case Roles::Url:
return QString::fromStdString(images[index.row()].image.url);
case CompletionModel::SearchRole: