Your comments

Image 859

# Duplicate entries in list pages with multi-user bookmarks

Observed in Ubooquity 3.1.0.

## Summary

List pages can show the same document multiple times when more than one user has bookmark/read-status data for that document.

This does not appear to be file duplication or `opus` table corruption. It appears to be caused by how bookmark rows are joined into list queries.

## Likely cause

- `bookmark` is keyed by `(documentid, username)`

- list queries join bookmarks on `documentid` only

- a document with bookmark rows for multiple users can therefore produce multiple result rows

In other words, the join behaves like one row per bookmark record instead of one row per document.

## How to reproduce

1. Set up at least two users.

2. Make sure both users interact with the same book/comic so each gets bookmark or reading-status data for that document.

3. Open a list page that includes bookmark data, such as `recently added`.

4. Find a document that has bookmark rows for both users.

5. The same document can appear multiple times in the list.

## Expected result

Each document should appear once in list pages.

## Actual result

A single document can appear multiple times when it has bookmark/read-status rows for multiple users.

## Notes

The simplest fix is likely to make bookmark joins user-scoped in list queries, or otherwise collapse bookmark rows to one row per document before joining.