From e9d04a5f527e823232807100966ed85b5d3360db Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 23 Aug 2020 16:17:01 +0200 Subject: 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(). --- lib/user.cpp | 10 +++++++--- 1 file 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 -- cgit v1.2.3