Skip to content

feat: add "other" option and notes field to image deletion reasons list#6704

Open
amahuli03 wants to merge 9 commits intocommons-app:mainfrom
amahuli03:6643/fix-vague-deletion-reasons
Open

feat: add "other" option and notes field to image deletion reasons list#6704
amahuli03 wants to merge 9 commits intocommons-app:mainfrom
amahuli03:6643/fix-vague-deletion-reasons

Conversation

@amahuli03
Copy link

@amahuli03 amahuli03 commented Mar 3, 2026

Description (required)

The deletion nomination options previously provided vague deletion reasons and no way for users to specify reasons other than the ones listed and/or a justification in text form. This made deletion reasons vague and unhelpful.

Now the deletion reasons list for "out of scope" gives the "other" option. Both "out of scope" and "copyright" deletion dialog pages require a justification in text in order to nominate an image for deletion.

Fixes #6643
Fixes part of #6710

What changes did you make and why?

modified app/src/main/java/fr/free/nrw/commons/delete/DeleteHelper.kt:

  • replaced built-in setMultiChoiceItems() with custom dialog layout
  • Added Other: specify below option in spam reasons list
  • Updated reason building to combine checkbox selections with custom text

modified app/src/main/res/values/strings.xml:

  • Added delete_helper_ask_spam_other--this is "Other: specify below" option
  • Added delete_helper_other_notes_hint -- this is notes section

added app/src/main/res/layout/dialog_deletion_reason.xml:

  • Created custom dialog layout with checkbox container and text field
  • This custom layout was necessary because Android's built-in setMultiChoiceItems() only supports checkboxes and doesn't allow adding additional UI elements like text fields.

Update (March 6, 2026): Following @nicolas-raoul 's comment, I have updated the hint in the text field to say "Justification" instead of "Other notes"
Update (March 6, 2026): Per #6710, I have updated this PR to enforce justification text in order to submit a deletion nomination.

Tests performed (required)
Performed manual testing, observing behavior and logs that I added for testing this screen.
Navigated to review -> click "No" to nominate image for deletion.
Verified that "Other" option and notes text field appears with correct strings.
Tested with all checkbox and text combinations.
Verified that "OK" button is only enabled if either

  1. at least one (non-"Other) checkbox is checked OR
  2. "Other" checkbox is checked AND reviewer provides notes in the text field

Checked Logcat output to confirm deletion reasons properly combine selections and custom text.

(Update March 6, 2026) I added 2 new tests in DeleteHelperTest.kt:
I realized that the existing unit tests for this logic were not actually testing anything, since the listener they used to simulate checkbox clicks was never assigned. The simulated interaction was skipped every time, making the tests pass by default, not because the logic was correct. I replaced them with 2 new tests:

  • buttonRemainsDisabledWhenCheckboxCheckedButNoText: verifies that checking a delation reason checkbox alone is not enough to enable the OK button
  • buttonEnabledWhenCheckboxCheckedAndTextEntered: verifies that the OK button enabled correctly when both a checkbox is checks and justification text is provided.

Screenshots (for UI changes only)

Screenshot_20260306_175407 Screenshot_20260306_160304

Initially had designed it to allow reviewers to submit only notes with no boxes checked. This doesn't make sense

Also initially designed it to allow reviewers to submit image for deletion with only "Other" option checked but no notes provided. This also doesn't make sense.
@nicolas-raoul
Copy link
Member

Would you mind changing "Other notes" to "Justification"?
Thanks!

the "OK" button does not enable until there is both a box checked AND some text in the justification text field. The second requirement is the new one
The previous alertDialogPositiveButtonDisableTest() was a no-op. getListener() returned null so the simulated click was silently skipped, and the button defaulted to enabled regardless of any logic. The new test actually checks a checkbox via the view hierarchy and asserts the button stays disabled when no justification text has been entered.
…teraction

The previous alertDialogPositiveButtonEnableTest() was a no-op. getListener() returns null so the simulated click was silently skipped, and the button defaulted to enabled regardless of any logic. The new test checks a checkbox and enters justification text via the view hierarchy, asserting the button enabled only when both conditions are met.
@amahuli03
Copy link
Author

@nicolas-raoul Done! Let me know if there's any other changes or clarfication needed.

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

✅ Generated APK variants!

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.

Vague deletion reasons

2 participants