Skip to content
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

Do not show thank donors interstitial when asking for school info #36360

Merged
merged 4 commits into from
Aug 20, 2020

Conversation

bencodeorg
Copy link
Contributor

@bencodeorg bencodeorg commented Aug 19, 2020

@bethanyaconnor saw this one coming -- if a teacher signs up and a) did not provide school information, b) logged in once and c) never logs out, they can see both the school info and the thank donors interstitials at the same time:

image

My change is to pref the school info dialog over thanking donors.

Testing story

Added new unit tests to cover this change. Also created a new account and confirmed I see the dialog without error, and also logged in with an older account confirm I don't see the dialog.

@bencodeorg
Copy link
Contributor Author

@dju90 FYI

@@ -8,6 +8,8 @@ def self.show?(user, request)
return false if user.age.nil? # Age dialog
return false if user && user.teacher? && !user.accepted_latest_terms? # Terms of Service dialog
return false if GdprDialogHelper.show?(user, request)
return false if SchoolInfoInterstitialHelper.show?(user)
return false if SchoolInfoInterstitialHelper.show_confirmation_dialog?(user)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach looks good but these method have side effects 😭

So we'd either have to refactor those (which tbh we probably should, I'm pretty anti these methods using the ? syntax and having side effects, but that might not be necessary for this PR) or we could move this logic to index.html.haml. I wonder if there's a way to enforce that we only show one dialog in that file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, I obviously did not look closely at that, thank you for catching!

I think I was sort of envisioning we move towards a world where every dialog has a show? helper (Elijah suggested these should actually be "policy objects", but I think that's the same idea) -- I refactored the GDPR logic in the donor dialog work to have a helper, and obviously added one for whether to show the donor dialog. Then we have some central place that prefs which to show (maybe index.html.haml, or another helper)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I move the user update to index.html.haml (instead of in the show? method)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave it a shot, LMK what you think!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new update looks good to me! I'd be surprised (and disappointed) if this doesn't end up breaking tests, so those might need to be modified

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did check the helper test file and didn't see anything that looked like it would fail :|

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this passes Drone. That's disappointing :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we once had a test for this but I can't figure out when it was removed...

@bencodeorg bencodeorg merged commit 35131e6 into staging Aug 20, 2020
@bencodeorg bencodeorg deleted the donor-dialog-school-info-conflict branch August 20, 2020 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants