From 5bfc9a5e459fcbc9ea6655fd578176c985839752 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Mon, 23 Sep 2019 13:31:32 -0400
Subject: [PATCH] migration: do not overwrite settings during migration

Change-Id: I9c0fbf2afe1fff0d3c5816203824dd7d004d85c6
---
 src/jamidht/archive_account_manager.cpp | 2 ++
 src/jamidht/jamiaccount.cpp             | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/jamidht/archive_account_manager.cpp b/src/jamidht/archive_account_manager.cpp
index 1418e9b610..c55b6a6d74 100644
--- a/src/jamidht/archive_account_manager.cpp
+++ b/src/jamidht/archive_account_manager.cpp
@@ -286,6 +286,8 @@ ArchiveAccountManager::migrateAccount(AuthContext& ctx)
         return;
     }
 
+    updateArchive(archive);
+
     if (updateCertificates(archive, ctx.credentials->updateIdentity)) {
         onArchiveLoaded(ctx, std::move(archive));
     } else
diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp
index 2a41c7afa4..a2cdcd99ab 100644
--- a/src/jamidht/jamiaccount.cpp
+++ b/src/jamidht/jamiaccount.cpp
@@ -995,11 +995,11 @@ JamiAccount::loadAccount(const std::string& archive_password, const std::string&
                     ringDeviceName_ = info.deviceId.substr(8);
 
                 auto nameServerIt = config.find(DRing::Account::ConfProperties::RingNS::URI);
-                if (nameServerIt != config.end()) {
+                if (nameServerIt != config.end() && !nameServerIt->second.empty()) {
                     nameServer_ = nameServerIt->second;
                 }
                 auto displayNameIt = config.find(DRing::Account::ConfProperties::DISPLAYNAME);
-                if (displayNameIt != config.end()) {
+                if (displayNameIt != config.end() && !displayNameIt->second.empty()) {
                     displayName_ = displayNameIt->second;
                 }
 
-- 
GitLab