Prevent opening empty profiles

Should fix 1707
This commit is contained in:
Nicolas Werner 2024-06-04 00:18:38 +02:00
parent ce0e9624fe
commit 9f5982e180
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -232,6 +232,9 @@ TimelineViewManager::openRoomSettings(QString room_id)
void void
TimelineViewManager::openInviteUsers(QString roomId) TimelineViewManager::openInviteUsers(QString roomId)
{ {
if (!roomId.startsWith('!'))
return;
InviteesModel *model = new InviteesModel{rooms_->getRoomById(roomId).data()}; InviteesModel *model = new InviteesModel{rooms_->getRoomById(roomId).data()};
connect(model, &InviteesModel::accept, this, [this, model, roomId]() { connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
emit inviteUsers(roomId, model->mxids()); emit inviteUsers(roomId, model->mxids());
@ -243,6 +246,9 @@ TimelineViewManager::openInviteUsers(QString roomId)
void void
TimelineViewManager::openGlobalUserProfile(QString userId) TimelineViewManager::openGlobalUserProfile(QString userId)
{ {
if (!userId.startsWith('@'))
return;
UserProfile *profile = new UserProfile{QString{}, userId, this}; UserProfile *profile = new UserProfile{QString{}, userId, this};
QQmlEngine::setObjectOwnership(profile, QQmlEngine::JavaScriptOwnership); QQmlEngine::setObjectOwnership(profile, QQmlEngine::JavaScriptOwnership);
emit openProfile(profile); emit openProfile(profile);