Use configured locales when building path-based rate limits#10636
Merged
mitchellhenke merged 2 commits intomainfrom May 16, 2024
Merged
Conversation
changelog: Internal, Rate Limiting, Use configured locales when building path-based rate limits
aduth
approved these changes
May 16, 2024
Comment on lines
+11
to
+18
| EMAIL_REGISTRATION_PATHS = | ||
| IdentityConfig.store.available_locales.reduce(['/sign_up/enter_email']) do |paths, locale| | ||
| paths << "/#{locale}/sign_up/enter_email" | ||
| end.freeze | ||
|
|
||
| SIGN_IN_PATHS = IdentityConfig.store.available_locales.reduce(['/']) do |paths, locale| | ||
| paths << "/#{locale}" | ||
| end.freeze |
Contributor
There was a problem hiding this comment.
Weighing whether something like [nil, *IdentityConfig.store.available_locales].map could work with including the unprefixed default (to avoid reduce and repeated path string), but can't think of an especially elegant implementation that'd be better than what you came up with here.
Contributor
Author
There was a problem hiding this comment.
I have a soft spot for reduce, but I'm definitely not committed to it. If your suggestion is clearer, I will switch to that.
Contributor
There was a problem hiding this comment.
Not a blocker, I don't have any real alternative to propose 👍
aduth
reviewed
May 16, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 Summary of changes
Does what it says on the tin. This is a late follow up to @aduth's #10472 (comment)