Skip to content

4653: Permit :date_range filter param in DistributionsController#index#4776

Merged
dorner merged 5 commits intorubyforgood:mainfrom
coalest:4653-fix-unpermitted-param-error-in-distributions-controller
Nov 27, 2024
Merged

4653: Permit :date_range filter param in DistributionsController#index#4776
dorner merged 5 commits intorubyforgood:mainfrom
coalest:4653-fix-unpermitted-param-error-in-distributions-controller

Conversation

@coalest
Copy link
Copy Markdown
Collaborator

@coalest coalest commented Nov 12, 2024

Resolves #4653

Description

This "unpermitted parameter" warning was logged because we were permitting other filter params but not the date_range param. This parameter is needed for date filtering, so I added it to the permitted params list.

Type of change

Minor change in logging.

How Has This Been Tested?

Added a spec to test permitted filter params.
And manually noticed that the "unpermitted_parameter" warning was no longer being logged.

@cielf cielf requested a review from dorner November 15, 2024 19:37
@cielf
Copy link
Copy Markdown
Collaborator

cielf commented Nov 15, 2024

Looks good from a functional pov -- Over to @dorner for technical comments

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can this be handled by a request test? Controller tests are kind of missing some of the extra validations and coverage that request tests give us.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I can change it to a request spec. I had figured that this permit shoulda-matcher on the controller was enough, but I guess with a request spec I could also ensure no "unpermitted params" messages are being logged.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Change the controller spec to a request spec. Let me know if this is the kind of implementation you had in mind.

@coalest coalest requested a review from dorner November 19, 2024 13:56
Copy link
Copy Markdown
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Sorry, I don't think I was looking closely enough. My apologies. I don't think we need a spec just to test that a particular log is or isn't written. If this isn't affecting actual application behavior, I'd rather not have a spec at all.

@coalest coalest requested a review from dorner November 25, 2024 10:46
@coalest
Copy link
Copy Markdown
Collaborator Author

coalest commented Nov 25, 2024

Sorry, I don't think I was looking closely enough. My apologies. I don't think we need a spec just to test that a particular log is or isn't written. If this isn't affecting actual application behavior, I'd rather not have a spec at all.

Removed the spec. Yea, I was a little confused when writing it :)

@dorner dorner merged commit 47b887e into rubyforgood:main Nov 27, 2024
@dorner
Copy link
Copy Markdown
Collaborator

dorner commented Nov 27, 2024

Looks good, thanks!

Sukhpreet-s pushed a commit to Sukhpreet-s/human-essentials that referenced this pull request Nov 29, 2024
rubyforgood#4776)

* 4653: Permit :date_range filter param in DistributionsController#index

* Move controller spec to request spec

* Remove unneeded specs
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 1, 2024

@coalest: Your PR 4653: Permit :date_range filter param in DistributionsController#index is part of today's Human Essentials production release: 2024.12.01.
Thank you very much for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Investigation+] Address "unpermitted parameter" log entries when doing "export distributions"

3 participants