Direct users to duplicate entry
While a user is adding or editing an entry and a duplicate is detected, help the user by linking to the existing entry.
Considerations
- Improve error message/type thrown by WebExt API better differentiate in the extension proper?
Background
The designs for #110 call for pointing the user to (one of) the duplicate entry. However, the effort point to that entry is significant, and there is definite user value to at least noting there is a duplicate.
Connected to #128
Porting over comments from #128:
In order to fully satisfy #110 we will need to create a method which will reverse lookup an item by its fields.
Two thoughts on how we could do this:
-
Firefoxy way: Add a simple passthru for
Services.logins.findLoginsto thebrowser.experiments.loginsembedded API experiment, then call that to make sure we aren't creating a dupe. (Note thatServices.logins.findLoginsreturns matching Logins, and the API experiment could convert those to plain JS objects before returning. I think we'd then point the user at the returned dupe with the most recent lastChanged or lastUsed date.) -
Javascripty way: Since we already have all the user's logins (via
browser.experiments.logins.getAll()), we could just filter the list by each field, but we'd have to get the wildcard behavior offindLoginsjust right--otherwise we won't detect the duplicate, but LoginManager will throw anyway. Seems potentially bug-prone.
The first option is probably better, since there are so many edge cases here. Happy to help with API questions.