mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 02:57:22 +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) {
|
if (ab == null) {
|
||||||
return 'no such addressbook: $name';
|
return 'no such addressbook: $name';
|
||||||
}
|
}
|
||||||
|
for (var p in ps) {
|
||||||
|
ab.removeNonExistentTags(p);
|
||||||
|
}
|
||||||
String? errMsg = await ab.addPeers(ps);
|
String? errMsg = await ab.addPeers(ps);
|
||||||
await pullNonLegacyAfterChange(name: name);
|
await pullNonLegacyAfterChange(name: name);
|
||||||
if (name == _currentName.value) {
|
if (name == _currentName.value) {
|
||||||
@@ -822,6 +825,18 @@ abstract class BaseAb {
|
|||||||
p.remove('password');
|
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> changeTagForPeers(List<String> ids, List<dynamic> tags);
|
||||||
|
|
||||||
Future<bool> changeAlias({required String id, required String alias});
|
Future<bool> changeAlias({required String id, required String alias});
|
||||||
|
|||||||
Reference in New Issue
Block a user