Skip to content

Upload: preserve duplicate images in custom selector and add warning#6765

Open
Akul-Tyagi wants to merge 1 commit intocommons-app:mainfrom
Akul-Tyagi:fix/custom-selector-duplicate-warning
Open

Upload: preserve duplicate images in custom selector and add warning#6765
Akul-Tyagi wants to merge 1 commit intocommons-app:mainfrom
Akul-Tyagi:fix/custom-selector-duplicate-warning

Conversation

@Akul-Tyagi
Copy link
Contributor

Fixes #6764

The Problem

In the custom selector flow, selecting duplicate content images (matching SHA1 hashes) silently reduced the number of images passed forward to the upload screen. This caused UX confusion because users would select N images but see fewer in the upload details. Additionally, if users realize they made a mistake, they needed an in place way to correct their selection without entirely leaving the selector flow.

The Solution & Justification

I updated the custom selector's completion flow to:

  • Preserve all selected images, preventing the silent dropping of duplicates.
  • Show a duplicate warning dialog when duplicate content selections are detected.
  • Provide two explicit actions in the dialog:
  • OK: Continues to the upload screen with all selected images.
  • Review selection: Dismisses the dialog and keeps the user on the selector screen to adjust their choices.

This approach is minimal and tightly scoped to the custom selector's done flow. It improves clarity, keeps the behavior explicit, and brings the custom selector's duplicate handling closer to parity with the normal selector.

Alternative Solutions Considered

I considered completely blocking the upload of duplicates directly from the selector. However, I discarded this because the normal selector currently permits duplicate selections, and blocking it here would create an inconsistent experience across the app. A non blocking warning dialog provides the safest, most informative UX.

Testing Performed

  • Compiled and ran the betaDebug variant successfully.

  • Passed targeted unit tests: :app:testBetaDebugUnitTest --tests "fr.free.nrw.commons.customselector.ui.selector.CustomSelectorActivityTest"

  • Passed broader adapter tests: :app:testBetaDebugUnitTest --tests "fr.free.nrw.commons.customselector.ui.selector." --tests "fr.free.nrw.commons.customselector.ui.adapter."

  • Manually verified that the duplicate warning is shown when identical images are selected.

  • Manually verified that tapping "Review selection" dismisses the dialog and retains the current selection state.

  • Manually verified that tapping "OK" proceeds to the upload details screen successfully.

Videos
Before :

Screen_Recording_20260318_082650_Commons.mp4

After :

Screen_Recording_20260319_135832_Commons.mp4

Updated CustomSelectorActivity to prevent silent dropping of duplicate images. Added a warning dialog with a 'Review selection' option to improve UX and maintain parity with the normal selector.
@github-actions
Copy link

✅ Generated APK variants!

@RitikaPahwa4444
Copy link
Collaborator

We should rather block duplicates from the normal selector as well. I don't think duplicate uploads are helpful. Just a warning that duplicate images would be dropped should suffice.

@Akul-Tyagi
Copy link
Contributor Author

Alright... @RitikaPahwa4444 that makes complete sense!

Just to make sure we are fully aligned: you would like the custom selector to continue intentionally dropping the duplicates, but we should add a warning notifying the user that the duplicates were automatically removed, rather than it happening silently.

I will update this PR to restore the dropping behavior and implement that warning!

Regarding the normal selector: would you prefer I add the blocking/warning logic for the normal selector into this PR, or should we keep this PR scoped to the Custom Selector and track the normal selector update in a separate issue/PR?

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.

[Bug]: Custom selector silently drops duplicate content images

2 participants