-
Notifications
You must be signed in to change notification settings - Fork 452
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
Validate all preferences when reading global_prefs and global_prefs_override #5050
base: master
Are you sure you want to change the base?
Conversation
@AenBleidd, @davidpanderson, I need to do a more thorough review of my work, but the overall intent of what I would like to do is here. Could you take a quick look and let me know if you feel I'm on the right track? Some questions and things I need to complete before I mark this as ready for a complete review:
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #5050 +/- ##
============================================
- Coverage 10.86% 10.86% -0.01%
Complexity 1068 1068
============================================
Files 279 279
Lines 36073 36094 +21
Branches 8339 8328 -11
============================================
Hits 3920 3920
- Misses 31759 31780 +21
Partials 394 394
|
Hey, @Vulpine05, any plans to continue working on this PR? |
@AenBleidd, maybe. This is related to my comment here. |
@Vulpine05, from my point of view the behavior should be next:
In this way we should eliminate the case when the same preferences are checked for the correct logic when read from the different sources. I hope I've answered your question. If no - don't hesitate to ping me again. |
@AenBleidd that answers my question, thank you. I think I can wrap this up as I have time. I do have one more noob question. I plan on having the alert message code look like this: Is it okay to hard code in the variable name in as text? The reason I ask is I don't know if that would accidentally be translated with Transifex. It seems easier write the alert message as above than taking the variable name, converting it to text, and then writing the alert message, such as: |
@Vulpine05, in order to get the text translated, you need to use the special macro:
In you particular case I suggest doing like that:
|
Got it, thanks for the tip. I think "setting is" and "Setting changed to" are going to be used quite a bit, so I think I'll just create two strings at the beginning of the function and use those. |
Add an upper limit for doubles, add day-of-week validation, revises method for printing alerts.
To note where validation occurs in cs_prefs.
@AenBleidd, this PR is ready for review. |
Text shown to users shouldn't include variable names like 'suspend_cpu_usage'. These names are pretty much consistent between the web prefs interface |
Are some of these checks not also made in the preferences dialog? If so, they should also be done there and the dialog should refuse to be saved until they are corrected. It does make sense to also do the checks here when reading from the prefs files, since the user could manually edit them. |
The intent is to alert the user that their is a mistake in the global_prefs(_override) file. Although the preference can be fixed via the Manager, I decided to list the preference name from the xml so it could be easily referenced there. I think this isn't too different when the Manager notifies the user of an error in a app_config file for a project. Additionally, I am not sure how to easily describe when variable to fix via the Manager without being verbose. |
For example, if you accidentally type -1 for suspend when computer is in use in global_prefs, then work will be suspended indefinitely. |
Fixes #4916
Description of the Change
Provides a separate function to check values passed from global_prefs and global_prefs_override. Some values were checked in prefs.cpp, but not all. This provides a space in the Client to check all values, and removes the checks in prefs.cpp.
Alternate Designs
My original intent was to keep all checks in prefs.cpp, but as discussed here, it was requested to be in cs_prefs.cpp.
Release Notes
[client] Added validation to all variables from global preferences.