feat: add has_approvals() helper to ChangeRequest model#7241
feat: add has_approvals() helper to ChangeRequest model#7241gagantrivedi merged 1 commit intomainfrom
Conversation
Returns True if at least one reviewer has approved the CR. Prerequisite for the serializer-level guard in flagsmith-workflows that will block post-approval edits of a Change Request's content (#7056).
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, reopen this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Docker builds report
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7241 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 1351 1351
Lines 50747 50759 +12
=======================================
+ Hits 49880 49892 +12
Misses 867 867 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Visual Regression16 screenshots compared. See report for details. |
docs/if required so people know about the feature.Changes
Contributes to #7056
Adds a
has_approvals()helper on theChangeRequestmodel. ReturnsTrueif at least one reviewer has approved the CR (i.e. there is aChangeRequestApprovalrow withapproved_at IS NOT NULL).The helper sits next to
is_approved()and uses the sameapproved_at__isnull=Falsefilter pattern. No behaviour change on its own — it is a prerequisite for the serializer-level guard inflagsmith-workflowsthat will block post-approval edits to a Change Request's content, plus a small frontend UI change in this repo to hide the Edit button once a CR has any approval. Both follow-ups will land in separate PRs.How did you test this code?
Two unit tests in
api/tests/unit/features/workflows/core/test_unit_workflows_models.py: