Don't allow images in username change messages and user completer

Sorry, no fun for you!
This commit is contained in:
Nicolas Werner 2021-09-09 21:20:34 +02:00
parent 495a4334df
commit f9a334233f
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 6 additions and 4 deletions

View file

@ -42,21 +42,22 @@ UsersModel::data(const QModelIndex &index, int role) const
case CompletionModel::CompletionRole:
if (UserSettings::instance()->markdown())
return QString("[%1](https://matrix.to/#/%2)")
.arg(displayNames[index.row()])
.arg(displayNames[index.row()].toHtmlEscaped())
.arg(QString(QUrl::toPercentEncoding(userids[index.row()])));
else
return displayNames[index.row()];
case CompletionModel::SearchRole:
return displayNames[index.row()];
case Qt::DisplayRole:
case Roles::DisplayName:
return displayNames[index.row()];
return displayNames[index.row()].toHtmlEscaped();
case CompletionModel::SearchRole2:
return userids[index.row()];
case Roles::AvatarUrl:
return cache::avatarUrl(QString::fromStdString(room_id),
QString::fromStdString(roomMembers_[index.row()]));
case Roles::UserID:
return userids[index.row()];
return userids[index.row()].toHtmlEscaped();
}
}
return {};

View file

@ -1858,7 +1858,8 @@ TimelineModel::formatMemberEvent(QString id)
break;
case Membership::Join:
if (prevEvent && prevEvent->content.membership == Membership::Join) {
QString oldName = QString::fromStdString(prevEvent->content.display_name);
QString oldName = utils::replaceEmoji(
QString::fromStdString(prevEvent->content.display_name).toHtmlEscaped());
bool displayNameChanged =
prevEvent->content.display_name != event->content.display_name;