Merge pull request #5771 from 21pages/ab

merge info from group when add id to addressbook
This commit is contained in:
RustDesk 2023-09-21 16:37:10 +08:00 committed by GitHub
commit 0eae0da781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,6 +132,7 @@ class AbModel {
'alias': alias,
'tags': tags,
});
_mergePeerFromGroup(peer);
peers.add(peer);
}
@ -573,4 +574,18 @@ class AbModel {
peers.clear();
await bind.mainClearAb();
}
_mergePeerFromGroup(Peer p) {
final g = gFFI.groupModel.peers.firstWhereOrNull((e) => p.id == e.id);
if (g == null) return;
if (p.username.isEmpty) {
p.username = g.username;
}
if (p.hostname.isEmpty) {
p.hostname = g.hostname;
}
if (p.platform.isEmpty) {
p.platform = g.platform;
}
}
}