batches: Add query to determine available bulk operations
Created by: BolajiOlajide
Description
This pull request moves the logic of determining what Bulk Operations
apply to a number of selected changesets to the backend.
Test plan
- Navigate to a batch change page. Example https://sourcegraph.test:3443/users/bolaji/batch-changes/all-drafts-all-the-time?visible=2.
- Ensure the batch change contains a number of changesets.
- Select a number of changesets, and the bulk operation option should be shown
- The option displayed should match bulk operations that can be performed on the selected changesets depending on their statuses.
Logic Breakdown
-
Changesets belonging to an archived batch change have the following bulk operations available:
COMMENT
DETACH
-
Changesets with a
FAILED
reconciler state have the following bulk operations available:REENQUEUE
-
Changesets in an
UNPUBLISHED
state have the following bulk operations available:PUBLISH
-
Changesets in a
DRAFT
state have the following bulk operations available:COMMENT
CLOSE
PUBLISH
-
Changesets that are in an
OPEN
state have the following bulk operations available:COMMENT
CLOSE
PUBLISH
MERGE
-
Changesets in a
CLOSED
state have the following bulk operations available:COMMENT
-
MERGED
changesets have the following bulk operations availableCOMMENT
CLOSE
Closes #21185