fix(api): Ignore "parsed" link and icon urls when deleting #1858
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tested on prod for myself after seeing that I had 73 notifications in the database but only 2 displayed in the UI.
The problem is Talk and some others don't have an icon/link stored in the database (as they might change), instead they are added on rendering, e.g. here:
https://github.com/nextcloud/spreed/blob/eb45b2eb8787207d072e5399da50f24f000df658/lib/Notification/Notifier.php#L242-L244
However Talk does this generally up front, so when it later on says "alright, the chat was read already, lets mark the notification as processed":
https://github.com/nextcloud/spreed/blob/eb45b2eb8787207d072e5399da50f24f000df658/lib/Notification/Notifier.php#L487-L498
the data is already manipulated.
Notifications app is then asked to delete the notification, but it adds the non-empty link and icon to the query, they are empty in the DB => No match => No delete
I think it's save to assume that link and icon are never used as "uniqueness" factor and therefore we can ignore them on deletion.