lockwise-addon icon indicating copy to clipboard operation
lockwise-addon copied to clipboard

Direct users to duplicate entry

Open linuxwolf opened this issue 6 years ago • 1 comments

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

linuxwolf avatar Apr 05 '19 17:04 linuxwolf

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:

  1. Firefoxy way: Add a simple passthru for Services.logins.findLogins to the browser.experiments.logins embedded API experiment, then call that to make sure we aren't creating a dupe. (Note that Services.logins.findLogins returns 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.)

  2. 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 of findLogins just 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.

jaredhirsch avatar Apr 10 '19 23:04 jaredhirsch