Skip to content

feat: add has_approvals() helper to ChangeRequest model#7241

Merged
gagantrivedi merged 1 commit intomainfrom
fix/7056-add-has-approvals-model-method
Apr 15, 2026
Merged

feat: add has_approvals() helper to ChangeRequest model#7241
gagantrivedi merged 1 commit intomainfrom
fix/7056-add-has-approvals-model-method

Conversation

@gagantrivedi
Copy link
Copy Markdown
Member

@gagantrivedi gagantrivedi commented Apr 15, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #7056

Adds a has_approvals() helper on the ChangeRequest model. Returns True if at least one reviewer has approved the CR (i.e. there is a ChangeRequestApproval row with approved_at IS NOT NULL).

The helper sits next to is_approved() and uses the same approved_at__isnull=False filter pattern. No behaviour change on its own — it is a prerequisite for the serializer-level guard in flagsmith-workflows that 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:

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).
@gagantrivedi gagantrivedi requested a review from a team as a code owner April 15, 2026 09:37
@gagantrivedi gagantrivedi requested review from emyller and removed request for a team April 15, 2026 09:37
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

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.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Apr 15, 2026 9:37am
flagsmith-frontend-preview Ignored Ignored Apr 15, 2026 9:37am
flagsmith-frontend-staging Ignored Ignored Apr 15, 2026 9:37am

Request Review

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7241 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7241 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-7241 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7241 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7241 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7241 Finished ✅ Results

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (1cd16ea) to head (046006a).
⚠️ Report is 7 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  0.8 seconds
commit  046006a
info  🔄 Run: #16052 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  1.3 seconds
commit  046006a
info  🔄 Run: #16052 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  55.1 seconds
commit  046006a
info  🔄 Run: #16052 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 9 seconds
commit  046006a
info  🔄 Run: #16052 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

Visual Regression

16 screenshots compared. See report for details.
View full report

@gagantrivedi gagantrivedi merged commit 32449e9 into main Apr 15, 2026
36 checks passed
@gagantrivedi gagantrivedi deleted the fix/7056-add-has-approvals-model-method branch April 15, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants