Check if article isn't already saved before adding it
Steps to reproduce :
- Save an article (from browser share, for instance)
- Save it again
The « article saved » toast message shows up also the second time. It should return « article already saved instead ».
It doesn't need to call wallabag server to check that the article already has been saved a long time ago, but only check in it's local database.
In general, the app has to rely on the server for not saving duplicates (wallabag/wallabag#2232 ?).
The app can search local database for matches, but it may fail in some cases:
- A corner case when the URL is shared to the app when local DB is empty (the first sync wasn't done yet).
- When the same URL was saved from a different client (not present in local DB yet).
- Or the opposite of the above one: the URL is present in the local DB, but was already removed remotely. In this case the user might expect the URL to be added to the server again.
In all this cases the app has to rely on server-side logic. IMO, the last point is a good argument against local duplicate checks.
Regarding the message. I think it is better to consider this message's meaning as "OK: the URL should now be present in the wallabag" - it shouldn't matter whether it was added just now or it was there for ages. Also it is impossible to reliably check for duplication while being offline or out of sync.
Update: TL;DR: Server shouldn't save duplicates, the app's logic shouldn't be changed.
The app does check for local duplicates now, but there's no difference in the message.