ipn/ipnlocal: update profile on server sent profile changes

We were not updating the LoginProfile.UserProfile when a netmap
updated the UserProfile (e.g. when a node was tagged via the admin panel).

Updates #713

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-11-16 18:14:02 +05:00
committed by Maisem Ali
parent 976e88d430
commit 49b0ce8180
2 changed files with 8 additions and 4 deletions

View File

@@ -126,6 +126,7 @@ func (pm *profileManager) SetPrefs(prefsIn ipn.PrefsView) error {
up.DisplayName = up.LoginName
}
cp := pm.currentProfile
wasNamedWithLoginName := cp.Name == cp.UserProfile.LoginName
if pm.isNewProfile {
pm.isNewProfile = false
cp.ID, cp.Key = newUnusedID(pm.knownProfiles)
@@ -135,6 +136,9 @@ func (pm *profileManager) SetPrefs(prefsIn ipn.PrefsView) error {
} else {
cp.UserProfile = ps.UserProfile
}
if wasNamedWithLoginName {
cp.Name = ps.LoginName
}
pm.knownProfiles[cp.ID] = cp
if err := pm.writeKnownProfiles(); err != nil {
return err