Skip to content

Conversation

@NishantSinghhhhh
Copy link

Closes #10033

Feature: Community Deletion Queue

This PR extends the merge queue system to support deletion requests, allowing librarians to request removal of entries that are not books (e.g., calendars, magazines, etc.) in a structured, reviewable way.

Technical

Backend Changes:

  • Added DELETION (type 3) to CommunityEditsQueue.TYPE in openlibrary/core/edits.py
  • Extended MODES dictionary to include deletion_open and deletion_closed modes
  • Updated where_clause() method to filter deletion requests by mr_type = 3
  • Modified openlibrary/plugins/upstream/edits.py:
    • Added deletion counts in GET() method (deletion_open, deletion_closed)
    • Updated create_url() to generate deletion URLs (/works/{olid}/delete)
    • Updated create_title() to fetch titles for deletion requests
    • Added DELETION type to needs_unique_url() validation

Frontend Changes:

  • Updated merge_request_table.html to display "Community Deletion Requests" title and pass is_deletion_mode flag
  • Enhanced table_header.html with two new tabs: "Deletion Open" and "Deletion Closed"
  • Modified status filter labels to show "Removed"/"Kept" for deletion mode instead of "Merged"/"Declined"
  • Updated table_row.html to display deletion-specific UI:
    • "Deletion:" badge on request titles
    • Different tooltips and messages for deletion requests
    • Updated comment placeholders and submission text
  • Added DELETION: 3 to JavaScript REQUEST_TYPES
  • Created createDeletionRequest(), approveDeletionRequest(), and declineDeletionRequest() helper functions

Key Implementation Notes:

  • Deletion requests only require a single OLID (unlike merges which need multiple)
  • Deletion requests are filtered separately from merge requests using mr_type field
  • Reuses existing approval/decline workflow - no new database schema changes needed
  • Maintains backwards compatibility with existing merge request functionality

Testing

Create a Deletion Request:

curl -X POST http://localhost:8080/merges \
  -H "Content-Type: application/json" \
  -H "Cookie: session=YOUR_SESSION" \
  -d '{"rtype":"create-request","action":"create-pending","mr_type":3,"olids":"OL123W","comment":"This is a calendar, not a book"}'

Screenshot

Screencast.from.2025-11-07.23-18-18.webm

Stakeholders

@RayBB @seabelis

@NishantSinghhhhh
Copy link
Author

@RayBB , please review this PR, also do tell me if any more testing is required and

I justed wanted to confirm whether the frontedn changes done by me are acceptable or I should be making some changes in it

@RayBB
Copy link
Collaborator

RayBB commented Nov 7, 2025

@NishantSinghhhhh I'm not looking at the code much yet but first there's an error in the CI that precommit is giving about nested ifs. Please address that (and always check the CI logs on PRs)

Second, please make sure your pull request only has relevant changes. For example, there are some changes to white space at the end of files. That should not be there.

Finally, to make this useful and easy to test please add a UI for requesting deletes to the librarian toolbar. Here's a similar PR for that #7648

Overall, on first glance this looks like it is the right direction so keep it up!

@NishantSinghhhhh
Copy link
Author

@RayBB , I have added the changes, and precommit errors have been removed, I have removed any irrelevant changes, Now sicne last 2 days I am trying to find the librarian toolbar, and I have failed, so can you please tell me at which route or which place I can find the librarian toolbar ??

@RayBB
Copy link
Collaborator

RayBB commented Nov 18, 2025

@NishantSinghhhhh You can find some of the librarian toolbar here #7502

@NishantSinghhhhh
Copy link
Author

@NishantSinghhhhh You can find some of the librarian toolbar here #7502

Thank you, I will add the changes now

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Nov 19, 2025
NishantSinghhhhh and others added 16 commits November 29, 2025 21:37
…emplates

- Introduced new actions for deleting works and authors in SelectionManager.
- Implemented community_deletes class to handle deletion requests.
- Created templates for deleting works and authors, including user feedback.
- Enhanced logging for deletion requests to improve traceability.

Signed-off-by: NishantSinghhhhh <[email protected]>
Signed-off-by: NishantSinghhhhh <[email protected]>
Signed-off-by: NishantSinghhhhh <[email protected]>
…structure; add corresponding LESS files for consistent UI design.

Signed-off-by: NishantSinghhhhh <[email protected]>
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are accessibility issues in these changes.

pre-commit-ci bot and others added 3 commits December 26, 2025 13:06
…r delete actions, and refine approval/decline logic

Signed-off-by: NishantSinghhhhh <[email protected]>
…r delete actions, and refine approval/decline logic

Signed-off-by: NishantSinghhhhh <[email protected]>
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are accessibility issues in these changes.


$if mrid and ctx.user:
<div id="mr-review-panel" data-mrid="$:str(mrid)" class="hidden">
<textarea id="mr-review-comment"></textarea>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are accessibility issues in these changes.


$if mrid and ctx.user:
<div id="mr-review-panel" data-mrid="$:str(mrid)" class="hidden">
<textarea id="mr-review-comment"></textarea>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are accessibility issues in these changes.

Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are accessibility issues in these changes.

NishantSinghhhhh and others added 8 commits December 30, 2025 19:23
…c merge request edits, improve UI for delete actions, and refine approval/decline logic

Signed-off-by: NishantSinghhhhh <[email protected]>
…unnecessary comments, and streamline merge request handling

Signed-off-by: NishantSinghhhhh <[email protected]>
…unnecessary comments, and streamline merge request handling

Signed-off-by: NishantSinghhhhh <[email protected]>
Signed-off-by: NishantSinghhhhh <[email protected]>
@NishantSinghhhhh NishantSinghhhhh marked this pull request as ready for review December 30, 2025 14:51
Signed-off-by: NishantSinghhhhh <[email protected]>
@NishantSinghhhhh
Copy link
Author

Screencast.from.2025-12-30.17-09-52.webm

@jimchamp the Deletion request flow and Request review flow for book is complete .

@NishantSinghhhhh
Copy link
Author

Screencast.from.2025-12-30.19-12-08.webm

@jimchamp

While I am working on the Deletion request flow and Request review for author, I am encountering few errros, can you please help me with this

1- I am able to delete authours having 0 books assigned to them, and the Merge Requests also gets closed

2- when I try to create a deletion request for authors having more than 0 books, it shows the error as [bad request ] and "You have a ValidationException. This Author page cannot be deleted as 1 record(s) still reference this id. Please remove or reassign before trying again.", How should I move forward with this.

@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand Merge Queue: Allow librarians to submit deletion requests

3 participants