-
Notifications
You must be signed in to change notification settings - Fork 687
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
Re-fix honoring of 'except' when used with 'comment_required' #425
base: main
Are you sure you want to change the base?
Re-fix honoring of 'except' when used with 'comment_required' #425
Conversation
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.
Could you please add a test to make sure this doesn't break again? Thanks!
lib/audited/auditor.rb
Outdated
end | ||
end | ||
|
||
def comment_required_state? | ||
auditing_enabled && |
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.
Wouldn't it be simpler to add here audited_changes.peresent?
ping @jeffdill2, any updates on this? |
@tbrisker Sorry, been a busy couple of weeks. I'll get this addressed today. |
@tbrisker OK, I've got a test in place now to ensure this doesn't break again in the future. 😄 |
@tbrisker Just following up with this one as well. Tests are in place now, so it's ready for review. Thanks! |
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.
I think you missed my previous comment, so I added another one to try and explain what I meant. Additionally, look like the changelog entry is now conflicting with other changes, can you please rebase?
lib/audited/auditor.rb
Outdated
then | ||
false | ||
else | ||
true |
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.
This is quite a confusing check, returning the opposite result to the condition - perhaps you can just reuse the comment_required_state?
function and add the additional condition instead of flipping the entire logic around?
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.
@tbrisker I think it was mainly just the name comment_required_state?
that I wasn't a fan of. To me it seems to indicate whether or not comment_required
is enabled, but what it's really doing is adding additional checks for whether or not audit_comment
should be validated for presence when comment_required
is enabled. I felt that eligible_for_comment_validation?
was clearer about what it's actually checking.
And my though process for flipping the logic around a bit was just so that the conditions would fail earlier – meaning that if auditing isn't enabled, we can immediately return false
instead of having to test any more conditions. But I can definitely understand how it's a bit confusing. And now that I think about it, my logic was complete non-sense anyways – if !auditing_enabled ||
and auditing_enabled &&
will both return false immediately if auditing isn't enabled. So that was just a big derp on my part. 😬
I'll get this fixed today.
@tbrisker OK, should be better now. 😄 |
This is a service we no longer use.
I noticed the 4.7.1 changes were missing from the Changelog.md on master. This PR adds them back.
6599f04
to
34ee9a9
Compare
@tbrisker merge conflict resolved now. |
…oring-of-except-with-comment-required
…hub.com:jeffdill2/audited into re-fix-honoring-of-except-with-comment-required
@tbrisker I've got |
This was originally fixed here: #419
But it was inadvertently broken when this was merged in: #420