-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(users): validation flashes for batch city and referrer #318
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ec82105
feat(users): validate that referrer exists
wJoenn 3290ed7
feat(users): validate city can't change
wJoenn 5cf2a0a
feat(users): validate batch can't change
wJoenn 3233fff
Merge branch 'main' into feat/users/validation-flashes
wJoenn b296a59
fix(users): rspec
wJoenn 3eeec6b
fix(users): revert refactos
wJoenn d24e518
fix(users) disable Metrics/ClassLength for user model
wJoenn ff2ea49
fix(users): rename cant to cannot
wJoenn 73770ee
fix(users): move referrer param inside params
wJoenn 4663981
feat(users): add explanation for params[:batch_id] = nil if form_para…
wJoenn 541c570
refactor(users): validations params
wJoenn 9f6d5dd
Spacing
pil0u 03e1596
Handle referral_code in a proper update_referrer method (we keep refe…
pil0u daf8cda
Add back the batch validation
pil0u c9154b6
Rename update to assign referrer
pil0u 8bba6d3
Wording
pil0u 2d8ec04
Rename, again
pil0u 2cc40d4
Trigger batch/city validations on update
pil0u 6f7ad13
Rollback to the previous behaviour: referrer cannot be nil after it w…
pil0u ba79750
Test pass, but behaviour is not as expected
pil0u a065fb6
fix(users): add #to_i to referrer_id to trigger change even if user h…
wJoenn 1f97ead
Explicitly use -1 if referrer is not found
pil0u File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
On a pas besoin de ces histoires de
-1
avec les validations dansUser
(faudrait juste rajouterreferral_code
) il me semble. Quelque chose m'échappe ?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.
Si un user ouvre le DevTool et enleve manuellement le disable du bouton pour le batch, rentre la valeur qu'il veut et submit, on veut quand meme pouvoir lui mettre un message d'erreur.
D'ou
Et si un user veut changer son referrer pendant le setup il a besoin de pouvoir rentré un referral_code, d'ou
Sauf que si il rentre un code erroné on veut quand meme pouvoir validé, donc on ajoute
|| -1
si le code est erroné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.
Il se ferait tej par cette validation normalement.
Ça en effet, mais on pourrait mieux le gérer via un
attribute :referrer_code
qui n'existe pas en DB mais sert à ce genre de validations.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.
Non parce que le param est pas permitted.
On trouvais pas ca logiquer de permit un param qu'on va jamais autoriser alors plutot que de l'ajouter dans le
require.permit
on s'est dit que ca faisait plus de sens de le mettre dans l'update .Et du coup quitte a l'assigner a qqch Pilou preferait mettre
-1
pour que ca soit bien clair que c'etait impossibleThere 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.
pas la ref
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.
C'est pas beau, j'ai pas trouvé mieux dans le temps imparti 👀
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.
Pas de soucis. Je verrai bien plus tard si on peut clean ça.