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]>
@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Dec 31, 2025
@jimchamp
Copy link
Collaborator

jimchamp commented Jan 8, 2026

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.

This is expected, and prevents data loss. A reviewer would decline such a request.

@NishantSinghhhhh
Copy link
Author

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.

This is expected, and prevents data loss. A reviewer would decline such a request.

Okay understood

mrid = None

if mrid_raw is not None:
# Handle if it's a list (some frameworks return lists)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Explain this to me.

Copy link
Author

Choose a reason for hiding this comment

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

I added this change because the mrid value was not being preserved when navigating via the Edit button on the Book or Author page.

The intended flow is:

Merge page → Book/Author page → Edit page → Request Deletion

However, during the transition from the Book/Author page to the Edit page, the mrid query parameter was being dropped. As a result, the Edit page no longer had the merge-request context, which is required to submit a delete request and subsequently close the merge request.

To fix this, I updated databarView.html

@jimchamp
Copy link
Collaborator

jimchamp commented Jan 9, 2026

@NishantSinghhhhh, I really need you to revert all unrelated changes.

Your MergeRequestEditPage.js code is failing our eslint checks. You can see exactly what's wrong by search for error on this page.

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
Copy link
Author

@jimchamp , I have made changes in this PR and I have reverted all unrelated changes.

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