-
Notifications
You must be signed in to change notification settings - Fork 632
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
Introduce constants for 'magic strings' in ManageController. #611
Conversation
… constant for email subjects. HTBox#340
Update from upstream
I ❤️ small PRs |
This is a great start, but I think you could take string abstraction a little further in |
Okay, something like creating a constant for every string, similar to Or something more robust for things like Controller names? Keep in mind Otherwise, I can list all the strings throughout |
I was thinking a constant for each string |
Sure thing! Thanks for the feedback and I'll get back to implementing it now. |
…hoot deployment to azure.
…troubleshoot deployment to azure." This reverts commit 7c54456.
@mheggeseth each string has been constant-fied. Please let me know what you think. |
Once @mheggeseth does a review I can merge it in. thx |
private const string EMAIL_CONFIRMATION_SUBJECT = "Confirm your allReady account"; | ||
private const string NEW_EMAIL_CONFIRM = | ||
"Please confirm your new email address for your allReady account by clicking this link: <a href={0}>link</a>. Note that once confirmed your original email address will cease to be valid as your username."; | ||
private const string RESEND_EMAIL_CONFIRM = "Please confirm your allReady account by clicking this link: <a href={0}>link</a>"; |
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.
You should wrap the href values in literal quotes (at least to be consistent with what was there before): <a href=\"{0}\">link</a>
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.
Sure, thanks for catching that.
@mheggeseth literal quotes added as per your feedback. |
Looks good |
@mheggeseth @tonysurma @BillWagner Why are we changing strings to constants in files that only use the constant once? IMO, it's easier on the eyes to "read a human readable string" then a BUNCH_OF_CONSTANT_NAMES in a file.. I can see where a constant comes in handy when it's used more than once in a given file, but if it's used ONLY once, what's the benefit? I understood Issue #340 to be related to getting rid of magic strings for things like using the new Unless I'm missing something |
@mgmccarthy I don't feel strongly about it. Personally, I probably wouldn't have made constants for the single-use strings. Having to jump to another place in the file to read the string value is a little annoying but having a constant for every string serves as a good reminder to consider refactoring strings. It also makes it easier to do so when a single-use string becomes multi-use. |
Forgive me if this is an insignificant number of changes for a single pull-request. Lot of firsts for me here: contributing to an open source project, using git and github, so I just wanted to make sure I get the workflow down before I start making bigger changes.
Please let me know if I should come back with a different pull-request when there is more to review.
#340