-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: change request audit logs #2527
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2527 +/- ##
==========================================
- Coverage 95.43% 95.42% -0.01%
==========================================
Files 965 966 +1
Lines 27136 27149 +13
==========================================
+ Hits 25897 25908 +11
- Misses 1239 1241 +2
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with one minor comment.
def get_audit_log_related_object_id(self, history_instance) -> int: | ||
# Change requests can create, update, or delete feature states that may never go live, | ||
# since we already include the change requests in the audit log | ||
# we don't want to create separate audit logs for the associated | ||
# feature states | ||
if self.belongs_to_uncommited_change_request: | ||
return None | ||
return super().get_audit_log_related_object_id(history_instance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're now shifting this logic, I wonder if we should reorder the logic in the create_audit_log_from_historical_record
task function so that we get the related object id first? Just because (I think) in general the log messages require more database queries to generate.
i.e. here: https://github.com/Flagsmith/flagsmith/blob/main/api/audit/tasks.py#L87-L94
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking about doing it
457d458
to
785026a
Compare
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingChanges
How did you test this code?
Tests: https://github.com/Flagsmith/flagsmith-workflows/pull/21/files