diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-08-23 16:17:01 +0200 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-08-23 16:17:01 +0200 |
commit | e9d04a5f527e823232807100966ed85b5d3360db (patch) | |
tree | 3e1fd10fab8f4d50deeed8d844866b20e4716578 | |
parent | c306470f21b888e0195f473c5030be40ffcdb5fc (diff) | |
download | libquotient-e9d04a5f527e823232807100966ed85b5d3360db.tar.gz libquotient-e9d04a5f527e823232807100966ed85b5d3360db.zip |
User: displayname() should fallback to name()
As of 0.6.1, User::name() triggers fetching the user profile (whether
this is right is a separate question but that's the way it works with
the current library API) - displayname() should use it rather than
shortcut to d->defaultName to get results consistent with User::name().
-rw-r--r-- | lib/user.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/user.cpp b/lib/user.cpp index 3c61bfd6..dac1bb68 100644 --- a/lib/user.cpp +++ b/lib/user.cpp @@ -215,9 +215,13 @@ bool User::isIgnored() const { return connection()->isIgnored(this); } QString User::displayname(const Room* room) const { - return room ? room->roomMembername(this) - : d->defaultName.isEmpty() ? d->id - : d->defaultName; + if (room) + return room->roomMembername(this); + + if (auto n = name(); !n.isEmpty()) + return n; + + return d->id; } QString User::fullName(const Room* room) const |