Repository navigation
feat: duplicate images for the moderators - #2735
Merged
Merged
Conversation
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>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 402 |
| Duplication | 15 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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=truekeeps 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).POST /images/duplicates/dismiss(moderators): "not duplicates", stored as pairs in the new tableguidebook.dismissed_image_duplicates. A set is hidden while all its pairs are dismissed;againstdismisses one image against the others of its set. The soft-delete snapshot keeps the pairs of a deleted image.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