Skip to content

feat: duplicate images for the moderators - #2735

Merged
lbesson merged 5 commits into
masterfrom
feat/image-duplicates
Nov 24, 2026
Merged

lbesson merged 5 commits into
masterfrom
feat/image-duplicates

Conversation

@lbesson

@lbesson lbesson commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

A moderation list of the images uploaded more than once: typically the same photo as a personal image of an outing and as a collaborative image of a route, or twice on one document.

  • GET /images/duplicates (moderators): the sets of copies, the last uploaded first; same_document=true keeps the sets with two images linked to one document. Each image comes with its type, author, upload date, linked documents and the texts showing it ([img=ID], also through an image merged into it).
  • Copies = same file size, width, height and EXIF date. Size and dimensions alone match by chance too often. Without an EXIF date, a set counts only when one user uploaded all its images or the uploads are within 7 days.
  • POST /images/duplicates/dismiss (moderators): "not duplicates", stored as pairs in the new table guidebook.dismissed_image_duplicates. A set is hidden while all its pairs are dismissed; against dismisses one image against the others of its set. The soft-delete snapshot keeps the pairs of a deleted image.
  • Merge (POST /documents/merge): documents already redirected to the source now follow to the target, so an embed stays one redirect away from its image.

Load: the sets come from a scan of all the images (about 1 s for 650k images). They are cached in Redis for an hour, with a 20 s statement timeout. Each request then only looks up the cached images by id (about 65 ms on the 2018 dump): merges, deletions and dismissals leave the list at once, new copies show within the hour.

Migration d41c7e9a2b85 (one table and one index, PostgreSQL 9.6 compatible). On the 2018 dump: 3,668 sets.

UI: c2corg/c2c_ui#5254. The API must be released first.

🤖 Generated with Claude Code

lbesson and others added 5 commits November 24, 2026 16:56
GET /images/duplicates lists the sets of images with the same file size,
dimensions and EXIF date, the last uploaded first, with their authors and
linked documents; same_document=true keeps the sets with two images on one
document. POST /images/duplicates/dismiss tells that images are not copies:
the pairs are kept in the new table dismissed_image_duplicates, a set is
hidden while all its pairs are dismissed. The soft delete keeps the pairs of
a deleted image. Merging uses POST /documents/merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The documents merged into the source before kept redirecting to it. A
merged image shows the files of its target, and those of the source are
deleted: the texts embedding an image merged twice lost it. They now
redirect to the new target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r within 7 days

Without EXIF date, the same size and dimensions often match by chance:
such a set is listed when one user uploaded all its images, or when the
uploads are at most 7 days apart (photos shared after a group outing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sets come from a scan of all the images (1 s for 650k). Cached,
the query runs at most once an hour, with a 20 s timeout. Each request
checks the images of the cached sets by id: merged or deleted images
and dismissed pairs leave the list at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lbesson
lbesson merged commit a712853 into master Nov 24, 2026
6 of 7 checks passed
@lbesson
lbesson deleted the feat/image-duplicates branch November 24, 2026 17:12
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 402 complexity · 15 duplication

Metric Results
Complexity 402
Duplication 15

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant