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.
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
GH-2258: Preserve user onboarding settings #681
GH-2258: Preserve user onboarding settings #681
Changes from 1 commit
c53210c45caa11ccfb5dca3c31a11cadc4604e734806aa58eebbab47fe4c852ae7fdeeFile filter
Jump to
Preserve onboarding selections on back
wlycdgrFeb 9, 2021
Member
Let's use the constants from
shared-hub\constants\BlockingPolicyConstantshere (and anywhere else where we are using these string values)wlycdgrFeb 9, 2021
Member
Better yet, can we make do without doing these conversions in the first place? I think we are asking for trouble if
kindsOfTrackerscan sometimes be a string and sometimes a number. What if we just always use the string values? That's whatbackground.jsexpects so no conversion would be necessary - only a modification to what values we are testing against in the checkbox rendering code (unless I'm missing somethin'?)wlycdgrFeb 9, 2021
Member
Also, while we're digging around in this file, could you factor out rendering of the
BlockSettingsView_questionlis to a helper like therenderAnswerBlockhelper I made? It would be a nice bit of cleanup since they are all the same except for a couple stringsleuryrFeb 23, 2021
Author
Contributor
While it looks like we still need the number representation for when we send over the
setup_numberstring from onboarding, using the constants everywhere else would mean that we only need to convert to a number for that case in particular, so all the other code can be removed/refactored. Was able to drop quite a few lines with this change.wlycdgrMar 8, 2021
Member
Sweet!
wlycdgrFeb 9, 2021
Member
You can simplify to
const isOther = searchChoices.includes(defaultSearch)(Also I think your version will always return
false? Sinceaccumis initialized tofalseand so the condition in line 93 is always satisfied. Bigger picture, with the simplerincludesversion it's much easier to be confident that the code does what you intend)leuryrFeb 23, 2021
Author
Contributor
Yea, you're right. Definitely messed up on the logic here, and
.includes()is a much simpler implementation. I changed the check toconst isOther = !searchChoices.includes(defaultSearch)as.includes(defaultSearch)returningtruewould mean thatisOthershould befalse.wlycdgrMar 8, 2021
Member
Great, thanks man!
wlycdgrFeb 9, 2021
Member
This will set
otherSearchSelectedtoSEARCH_OTHERifprevChosenSearchisSEARCH_OTHER. That's not quite right:otherSearchSelectedshould store which specific other search is selected, whenchosenSearchisSEARCH_OTHER(e.g.,SEARCH_GIBIRU, etc)leuryrFeb 23, 2021
Author
Contributor
Yep messed up here as well. This should be setting
otherSearchSelectedas thedefaultSearchvalue ifisOtheris true, which would carry the specific other search that the user had selected.wlycdgrMar 8, 2021
Member
Woot woot, ty ty
wlycdgrFeb 9, 2021
Member
I am realizing I have a strong suspicion we don't need the extra
antiSuiteandsetupLifecyclewrappers at all after all, and that the code would be better and simpler without them....but I can fix that up at the end, don't worry about it unless you want towlycdgrMar 8, 2021
Member
(Based on our convo, you're right, let's leave it as is)