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

Clever takeover bugfixes #18460

Merged
merged 4 commits into from
Oct 19, 2017
Merged

Clever takeover bugfixes #18460

merged 4 commits into from
Oct 19, 2017

Conversation

ewjordan
Copy link
Contributor

@ewjordan ewjordan commented Oct 18, 2017

  1. Show interstitial on course and script pages as well (not just homepage)
    Turns out this is not doable, because some of those pages are cached. Solved by redirecting to home page instead if the interstitial should be shown.

  2. Remove “x” from dialog (light dismiss should also not work, but I think you get that for free when you remove the “x”)

  3. Interrupting takeover flow leaves cookies in place, and shows dialog next time
    Session variables are now cleared if the current_user is not set when hitting the homepage, which mostly resolves this problem.

  4. Shouldn’t show the dialog after the user has made a choice to create a new account (Right now, if you choose to create a new account, you’ll keep getting the dialog when you reload the homepage until you sign out and sign back in again)
    This is also solved by clearing the session variables, this time when the dialog is dismissed (via an XHR request to a SessionsController#clever_modal_dismissed)

@@ -93,7 +93,7 @@ export default class LinkCleverAccountModal extends React.Component {
fixedWidth={600}
fixedHeight={310}
isOpen={this.props.isOpen}
handleClose={this.cancel}
uncloseable
Copy link
Contributor Author

@ewjordan ewjordan Oct 18, 2017

Choose a reason for hiding this comment

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

Bug 2

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 I can confirm that uncloseable doesn't just remove the 'x' button, it also removes the ability to close by clicking outside the dialog or pressing the Esc key.

@@ -39,12 +40,13 @@ def health_check
# Signed out: redirect to /courses
def index
if current_user
if current_user.student? && current_user.primary_script
if current_user.student? && current_user.primary_script && !session['clever_link_flag']
Copy link
Contributor Author

@ewjordan ewjordan Oct 18, 2017

Choose a reason for hiding this comment

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

Bug 1 (skip redirect if coming in for the first time via Clever, in which case the link flag should be set)

redirect_to script_path(current_user.primary_script)
else
redirect_to '/home'
end
else
clear_clever_session_variables
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug 3

@@ -195,6 +195,7 @@ window.CleverTakeoverManager = function (options) {

function onCancelModal() {
$("#user_user_type").val("student");
$.get("/users/clever_modal_dismissed");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bug 4

Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Why GET instead of POST here? I can see arguments either way, and I'm curious what you had in mind.

My first instinct is POST because we're changing state, and we don't necessarily want this route to be cached, bookmarked, or navigated to manually. But when I went looking for guidelines, GET also seems reasonable here because the operation is idempotent and therefore "safe," and apparently GET is preferred for AJAX because it's a faster operation (news to me).

Second question: should we ensure this request is successful, or are we cool with fire-and-forget here? What's the negative user impact if we return a 500 here?

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'm not really sure re: GET vs POST, since it is changing state it actually may make more sense for it to be a POST. I think because no data goes along with it I picked GET (also I wanted to test the method manually in the browser), but I may actually change this because you're right, POST makes more sense re: caching and whatnot.

The user impact if this fails is pretty minimal, it just means that the dialog will show up again if they navigate back to the home page during the same session. That's a minor annoyance, so I opted to ignore errors rather than surfacing or retrying.

Copy link
Contributor

@Erin007 Erin007 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

Changes look good! One question for discussion, nonblocking.

@ewjordan ewjordan merged commit a62fa05 into staging Oct 19, 2017
@ewjordan ewjordan deleted the clever-takeover-bugfixes branch October 19, 2017 18:38
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.

None yet

3 participants