mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-27 19:35:10 +01:00
Prevent importing duplicate saved searches
This commit is contained in:
@@ -1118,8 +1118,18 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||
for (int s = 0; s < jsearches.length(); s++) {
|
||||
JSONObject jsearch = (JSONObject) jsearches.get(s);
|
||||
EntitySearch search = EntitySearch.fromJSON(jsearch);
|
||||
search.id = null;
|
||||
db.search().insertSearch(search);
|
||||
|
||||
boolean found = false;
|
||||
for (EntitySearch other : db.search().getSearches())
|
||||
if (other.equals(search)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
search.id = null;
|
||||
db.search().insertSearch(search);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user