mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-11 18:47:47 +00:00
Remove non-existent tags when importing ab peers from another ab (#12062)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -347,6 +347,9 @@ class AbModel {
|
||||
if (ab == null) {
|
||||
return 'no such addressbook: $name';
|
||||
}
|
||||
for (var p in ps) {
|
||||
ab.removeNonExistentTags(p);
|
||||
}
|
||||
String? errMsg = await ab.addPeers(ps);
|
||||
await pullNonLegacyAfterChange(name: name);
|
||||
if (name == _currentName.value) {
|
||||
@@ -822,6 +825,18 @@ abstract class BaseAb {
|
||||
p.remove('password');
|
||||
}
|
||||
|
||||
removeNonExistentTags(Map<String, dynamic> p) {
|
||||
try {
|
||||
final oldTags = p.remove('tags');
|
||||
if (oldTags is List) {
|
||||
final newTags = oldTags.where((e) => tagContainBy(e)).toList();
|
||||
p['tags'] = newTags;
|
||||
}
|
||||
} catch (e) {
|
||||
print("removeNonExistentTags: $e");
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> changeTagForPeers(List<String> ids, List<dynamic> tags);
|
||||
|
||||
Future<bool> changeAlias({required String id, required String alias});
|
||||
|
||||
Reference in New Issue
Block a user