Skip to content
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

Update filters disabled error to include specific action #6195

Conversation

javawizard
Copy link
Contributor

ActiveAdmin::Filters::Disabled is raised both when attempting add a filter and when attempting to remove a filter when filters are disabled. Change the message to suit both use cases.

@javawizard
Copy link
Contributor Author

Is this change significant enough to warrant an entry in CHANGELOG.md? If so, is it a bugfix or an enhancement?

@deivid-rodriguez
Copy link
Member

Hi! Sorry for the delay, I'd go with considering this a bug fix!

@@ -3,7 +3,7 @@ module Filters

class Disabled < RuntimeError
def initialize
super "Can't remove a filter when filters are disabled. Enable filters with 'config.filters = true'"
super "Can't add or remove a filter when filters are disabled. Enable filters with 'config.filters = true'"
Copy link
Member

Choose a reason for hiding this comment

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

I was thinking we could stop overriding initialize, and do class Disabled < RuntimeError; end, and then pass the correct message for each of the cases instead?

@javierjulio
Copy link
Member

That's a worthwhile suggestion so at least the message is specific to the action taking place. @javawizard I'd accept that change if you still want to get this in. Thank you.

javawizard and others added 2 commits May 11, 2023 00:43
ActiveAdmin::Filters::Disabled is raised both when attempting add a filter and
when attempting to remove a filter when filters are disabled. Change the
message to suit both use cases.
@javierjulio javierjulio force-pushed the filters-disabled-message-add-or-remove branch from d6a32fa to 653ab2f Compare May 11, 2023 04:54
@javierjulio javierjulio changed the title Change filters disabled message to "add or remove" Update filters disabled error to include specific action May 11, 2023
@javierjulio javierjulio self-assigned this May 11, 2023
@javierjulio javierjulio self-requested a review May 11, 2023 04:58
@codecov
Copy link

codecov bot commented May 11, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (fc6fd8b) 98.94% compared to head (653ab2f) 98.94%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6195   +/-   ##
=======================================
  Coverage   98.94%   98.94%           
=======================================
  Files         197      197           
  Lines        4950     4950           
=======================================
  Hits         4898     4898           
  Misses         52       52           
Impacted Files Coverage Δ
lib/active_admin/filters/resource_extension.rb 97.40% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@javierjulio javierjulio merged commit cecfcf5 into activeadmin:master May 11, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants