Plots2: Detect subscriptions in signup `return_to` param and correctly subscribe new users in one step

Created on 5 Feb 2019  Â·  9Comments  Â·  Source: publiclab/plots2

Currently, people can be directed to the signup form with the following format:

https://stable.publiclab.org/signup?return_to=/subscribe/multiple/tag/arduino,games (for example)

That means they should get signed up in that form (and it works the same in the modal signup), and then upon making an account, get redirected to /subscribe/multiple/tag/arduino,games, which will subscribe them to the 2 tags arduino and games and then AGAIN redirect them to /subscriptions.

But this doesn't happen - you just get directed to the /dashboard page and you see the standard welcome page, though you do get shown an option (in the long welcome alert) to "pick up where you left off" with a link:

https://github.com/publiclab/plots2/blob/a3918357e87f01149aaf35251adc6899e0ee2c84/app/controllers/users_controller.rb#L28-L32

Let's think about how we want people to be signed up. New users shouldn't be dropped off on the subscriptions page; that makes sense.

Maybe we should... detect the return_to=/subscribe/multiple/tag/arduino,games format, or the params[:return_to] and parse it to see if there are subscriptions in there?

Could we match /subscribe/multiple/tag/arduino,games and actually parse out the tagnames to subscribe them automatically?

Other ideas? What's best here?

Ruby help wanted

Most helpful comment

@jywarren I think the following could work well,

  1. The user goes to the link
  2. He needs to signup (We have his current link in params[:return_to]
  3. After signup, we process the link to get the tag names out and subscribe the user to those tags (With no redirection to /subscriptions ?)
  4. The user lands on the dashboard page, gets a popup saying welcome to public labs, etc.
  5. After that we show him another flash saying you are subscribed to those tags.

Any other ideas?

All 9 comments

I am really sorry for these behaviours. I have to check where there is an error. Probably two controller actions are conflicting with each other, create action for the user and the multiple_tag_subscription action. We need to make it happen in sequential order I guess. Checking the code.

no problem! I think there's an issue where it actually ignores your
return_to but shows it to you in the alert offering to "pick back up
where you were" in a link. I understand this because we want to show people
the welcome message. But we should try to intercept subscriptions to make
sure they still happen automatically even though you are rerouted to the
dashboard for the welcome message.

On Fri, Mar 1, 2019 at 7:52 AM Sidharth Bansal notifications@github.com
wrote:

I am really sorry for these behaviours. When I created it in January,
these were working fine. I have to check where there is an error. Probably
two controller actions are conflicting with each other.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/4759#issuecomment-468654892,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJzAxEGVI3NykCDqgwGbjcPX00sHOks5vSSJagaJpZM4aiVQ4
.

@jywarren I think the following could work well,

  1. The user goes to the link
  2. He needs to signup (We have his current link in params[:return_to]
  3. After signup, we process the link to get the tag names out and subscribe the user to those tags (With no redirection to /subscriptions ?)
  4. The user lands on the dashboard page, gets a popup saying welcome to public labs, etc.
  5. After that we show him another flash saying you are subscribed to those tags.

Any other ideas?

@shubhscoder this sounds PERFECT!!!

Sorry for the delay @jywarren ! I will make a PR for this asap! Thank you! :)

@shubhscoder is there any update on this? I really loved your sequence. In case you have opened up a PR then please link it here so that we can review and help you better.

I think @shubhscoder is busy with some work. So, I have started working on it.

I have completed working on the changes. Submitting test for it now. Thanks @shubhscoder for giving it a direction.

This issue has three sub issues

  1. User has signup through OAuth provider and does not have pl account
  2. User has signup through OAuth provider & has PL account
  3. Signup through signup form
    All three are rectified in the pr.
Was this page helpful?
0 / 5 - 0 ratings