types/persist: drop duplicated Persist.LoginName

It was duplicated from Persist.UserProfile.LoginName, drop it.

Updates #7726

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2023-08-03 18:38:28 -06:00
committed by Maisem Ali
parent ae63c51ff1
commit 6aaf1d48df
13 changed files with 46 additions and 76 deletions

View File

@@ -208,16 +208,10 @@ func init() {
func (pm *profileManager) SetPrefs(prefsIn ipn.PrefsView) error {
prefs := prefsIn.AsStruct().View()
newPersist := prefs.Persist().AsStruct()
if newPersist == nil || newPersist.NodeID == "" {
if newPersist == nil || newPersist.NodeID == "" || newPersist.UserProfile.LoginName == "" {
return pm.setPrefsLocked(prefs)
}
up := newPersist.UserProfile
if up.LoginName == "" {
// Backwards compatibility with old prefs files.
up.LoginName = newPersist.LoginName
} else {
newPersist.LoginName = up.LoginName
}
if up.DisplayName == "" {
up.DisplayName = up.LoginName
}