[epiphany] sync: Prevent duplicates after target_origin migration
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] sync: Prevent duplicates after target_origin migration
- Date: Fri, 25 Aug 2017 18:48:44 +0000 (UTC)
commit 4f54f52f51155b3bbb043328c05a5f78e0046944
Author: Exalm <exalm7659 gmail com>
Date: Wed Aug 16 17:42:51 2017 +0500
sync: Prevent duplicates after target_origin migration
If target_origin value is different from hostname, then
migration and syncing will cause duplicate records. Add
a special case to prevent that
https://bugzilla.gnome.org/show_bug.cgi?id=666326
lib/sync/ephy-password-manager.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index 99a1f59..9a491ff 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -987,9 +987,22 @@ ephy_password_manager_handle_initial_merge (EphyPasswordManager *self,
g_hash_table_add (dont_upload, g_strdup (remote_id));
}
} else {
- /* Different id, different tuple. This is a new record. */
- ephy_password_manager_store_record (self, l->data);
- g_hash_table_add (dont_upload, g_strdup (remote_id));
+ record = get_record_by_parameters (local_records,
+ remote_hostname,
+ remote_hostname,
+ remote_username,
+ remote_username_field,
+ remote_password_field);
+ if (record) {
+ /* A leftover from migration: the local record has incorrect target_origin
+ * Replace it with remote record */
+ ephy_password_manager_forget_record (self, record, l->data);
+ g_hash_table_add (dont_upload, g_strdup (ephy_password_record_get_id (record)));
+ } else {
+ /* Different id, different tuple. This is a new record. */
+ ephy_password_manager_store_record (self, l->data);
+ g_hash_table_add (dont_upload, g_strdup (remote_id));
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]