Skip to content

Commit

Permalink
Fix broken User::displayName() logic
Browse files Browse the repository at this point in the history
Also, add an assert to Connection::user() to make sure it doesn't create users with invalid ids. Closes quotient-im#201.
  • Loading branch information
KitsuneRal committed Apr 27, 2018
1 parent e74e485 commit 3a763fd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ Room* Connection::invitation(const QString& roomId) const

User* Connection::user(const QString& userId)
{
Q_ASSERT(userId.startsWith('@') && userId.contains(':'));
if( d->userMap.contains(userId) )
return d->userMap.value(userId);
auto* user = userFactory(this, userId);
Expand Down
2 changes: 1 addition & 1 deletion lib/user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ QString User::displayname(const Room* room) const
{
auto name = d->nameForRoom(room);
return name.isEmpty() ? d->userId :
room ? room->roomMembername(name) : name;
room ? room->roomMembername(this) : name;
}

QString User::fullName(const Room* room) const
Expand Down

0 comments on commit 3a763fd

Please sign in to comment.