Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

fetch user on tutorial complete #579

Open
gr- opened this issue Mar 17, 2016 · 1 comment
Open

fetch user on tutorial complete #579

gr- opened this issue Mar 17, 2016 · 1 comment

Comments

@gr-
Copy link

gr- commented Mar 17, 2016

I noticed a misbehavior when introductory tutorial is completed : the login material just disappears. Actually, I was expecting it takes into account the new guest user (if not previously logged in) and propose to log in with the many options (Facebook, google, etc.) depending on the project settings.

As far as I understand, the Coffeescript @state cannot capture the new registered guest user after the line request = $.post "/tutorial_complete" in function setTutorialComplete from apps.cjx. I guess a sort of @fetchUser to refresh the state should be ok, but it doesn't work. It may be the processor is away after the post request since users_controller#tutorial_complete asks for rendering a new page ?! Help is welcome to fix this minor issue.

@gr-
Copy link
Author

gr- commented Mar 18, 2016

I answer to myself!

If I replace in app/assets/javascripts/components/app.cjsx this line

@setState user: $.extend(@state.user ? {}, tutorial_complete: true)

by those lines

@setState user: $.extend(@state.user ? {}, tutorial_complete: true) if @state.user?
@setState user: $.extend(@state.user ? {}, tutorial_complete: true, guest: true) if not @state.user?

then the login material behaves the right way (thanks to the guest flag). Note that you have to match the user state (guest: true statement) with the render conditions in the login.cjsx script.

Not totally sure about all the side effects...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant