-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
skip registering ActiveAdmin::Comment if namespace.comments is false #8710
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
base: master
Are you sure you want to change the base?
skip registering ActiveAdmin::Comment if namespace.comments is false #8710
Conversation
|
Hello, thanks for this PR Any chance to add a spec to cover this scenario? |
|
@tagliala yes, but which file should I add a spec into? |
|
This looks like a Asking @javierjulio for confirmation |
|
@tagliala I'm not sure actually. @FeLvi-zzz let's give that a try please and we'll go from there. |
|
@tagliala @javierjulio |
375a190 to
34d50b3
Compare
|
@mgrunberg @tagliala what do you think of the this approach and the tests? I think it would help to have as if the feature is not used then the routes should not exist and this seems to handle the case where it's only enabled for a specific namespace or resource. Any improvements or concerns? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8710 +/- ##
=======================================
Coverage 99.08% 99.08%
=======================================
Files 139 139
Lines 4046 4047 +1
=======================================
+ Hits 4009 4010 +1
Misses 37 37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Sorry, I'm not familiar with the comments implementation. I can see there is a global switch and a per-resource switch, so this is why it is not checking for I also assume that the global config can be override at namespace / model level, so you can have I do not have suggestions for the specs |
|
I'm not very familiar with the comments code either, but in a quick review, I'm ok with the approach and specs. I'm just wondering if it's possible to reduce the usage of stubs/doubles. It's not a strong opinion. It's just that the spec has Namespace & Resource creation examples. I'm aware that we are trying to call a hook and the setup for that could not be easy. |
|
I reduced excessive stubs (thanks to @mgrunberg !). Could anyone run tests? |
|
Oops, tests which I created look flaky... |
|
Hello, this is still failing. Can you also please rabse on master? |
cb979b8 to
d81db47
Compare
| # Manually trigger the before_load, after_load event | ||
| ActiveSupport::Notifications.instrument ActiveAdmin::Application::BeforeLoadEvent, { active_admin_application: application } | ||
| ActiveSupport::Notifications.instrument ActiveAdmin::Application::AfterLoadEvent, { active_admin_application: application } |
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.
can't review here, I can'tell if this has side effects
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 don't have any other ideas how to test this behavior without too many stubs, do you have the other better one?
If there is no way, many stubs or less ones, which is better?
ref. #8710 (comment)
resolve #5117
resolve #5311
background
we disable comments, but routes are still drawn.
what to do