Updates reviews to include the state of the review
What does this MR do and why?
This changes the state that gets set on reviewers to be set on the review instead. This means that when you submit a review the action that the user chooses will be set on the review object instead of the reviewer. This gives us a timeline of events that happen as a reviewer as each action gets recorded on their own review object.
Query
SELECT DISTINCT ON ("author_id") * FROM "reviews" WHERE "reviews"."merge_request_id" = 294580704 ORDER BY "reviews"."author_id" ASC, "reviews"."created_at" DESC
https://explain.depesz.com/s/rYc8
Migrations
Up
main: == [advisory_lock_connection] object_id: 119000, pg_backend_pid: 51422
main: == 20231201111622 AddStateToReview: migrating =================================
main: -- add_column(:reviews, :state, :smallint, {:null=>true})
main: -> 0.0014s
main: == 20231201111622 AddStateToReview: migrated (0.0066s) ========================
main: == [advisory_lock_connection] object_id: 119000, pg_backend_pid: 51422
Down
main: == [advisory_lock_connection] object_id: 119020, pg_backend_pid: 50875
main: == 20231201111622 AddStateToReview: reverting =================================
main: -- remove_column(:reviews, :state, :smallint, {:null=>true})
main: -> 0.0020s
main: == 20231201111622 AddStateToReview: reverted (0.0067s) ========================
main: == [advisory_lock_connection] object_id: 119020, pg_backend_pid: 50875
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
- Visit a merge request
- Assign yourself as a reviewer
- Create a new review by using the review feature
- Submit review with requesting changes for example
- Reviewer in sidebar should show the new state
Another feature to test:
- Enable
mr_reviewer_requests_changes
- Visit a merge request
- Assign yourself as a reviewer
- Create a new review by using the review feature
- Submit review with requesting changes
- The merge request widget should be in a blocked state with reviewer requested changes
- It should also still be in this state when you remove yourself as a reviewer
Edited by Phil Hughes