Use prettyName more widely, instead of duplicating fallback string code
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 6 Oct 2022 17:47:39 +0000 (19:47 +0200)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 19 Oct 2022 11:31:48 +0000 (13:31 +0200)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/settingsdialog.cpp
src/gui/tray/usermodel.cpp

index e66cd2a96218f142d6ab6a246fbf5f377bb0bd5a..399e55df342bbfdbe6a0edf04d6c7f26a6c9099c 100644 (file)
@@ -57,10 +57,7 @@ const float buttonSizeRatio = 1.618f; // golden ratio
  */
 QString shortDisplayNameForSettings(OCC::Account *account, int width)
 {
-    QString user = account->davDisplayName();
-    if (user.isEmpty()) {
-        user = account->credentials()->user();
-    }
+    QString user = account->prettyName();
     QString host = account->url().host();
     int port = account->url().port();
     if (port > 0 && port != 80 && port != 443) {
index 76a857064eaed6192fc2c91c47fa2a8b4f509ed1..79c75d4eb5c97f65b2990d17fa20f5248ae5da4c 100644 (file)
@@ -733,12 +733,7 @@ void User::logout() const
 
 QString User::name() const
 {
-    // If davDisplayName is empty (can be several reasons, simplest is missing login at startup), fall back to username
-    QString name = _account->account()->davDisplayName();
-    if (name == "") {
-        name = _account->account()->credentials()->user();
-    }
-    return name;
+    return _account->account()->prettyName();
 }
 
 QString User::server(bool shortened) const