Page MenuHomePhabricator

Following link to donate fails to return user to previous page upon completion
Closed, ResolvedPublic


Per a comment from an anon IP that you can read in this permalink, -- Clicking the donation banner does not return the user to their previous location upon completion of the process. I agree that it probably should.

Version: wmf-deployment
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:24 AM
bzimport set Reference to bz58506.
bzimport added a subscriber: Unknown Object (MLST).

Now that we moved the thank you pages to, this should be possible at least for banners. Here's the plan:

When someone clicks through a banner to donate, before going to payments they get a cookie fundraising_returnTo with the URL of the page they were on. This is for domain and has a short life (5 minutes). Example banner which sets this cookie

mw.loader.using( 'mediawiki.cookie' ).then( function () {
        window.location.origin + window.location.pathname,
        { expires: 300, prefix: '', domain: '', secure: true }

Then the Thank You page checks to see if a user has that cookie, and if so it shows a "Return to Wikipedia" link with the correct URL. It then clears the cookie. Example TY page (this will always show the link, just for demonstration purposes)

mw.loader.using( 'mediawiki.cookie' ).then( function () {
    var returnToUrl = mw.cookie.get( 'fundraising_returnTo', '' );
    if ( returnToUrl ) {
        $( '.ty-return a' ).attr( 'href', returnToUrl );
        $( '.ty-return' ).show();
        mw.cookie.set( 'fundraising_returnTo', null, { prefix: '', domain: '' } );

@DStrine Can someone from fr-tech take a look at this approach and confirm it seems sensible?

Wow this is ancient. I've moved it to triage to discuss on Monday.

Hi @Pcoombe! Overall this seems quite sane! (Caveat: I haven't tested it or anything.) Initially I was concerned that cookies are a performance draw, since they're sent back and forth on every HTTP request, however, with the short expiry time, that seems fine. Normally we would actually prefer LocalStorage to cookies, but I think you can't share that among subdomains easily. Also, LocalStorage has no build-in expiry mechanism (important for cases where the user doesn't make it to the TY page). So it seems cookies would indeed be the way to go.

Do we need to maybe double-check with Legal or anyone else about creating this cookie?


Thanks @AndyRussG! Yes I did look at LocalStorage first, but you're right that it can't work across subdomains, so I think it has to be a cookie.

I've emailed Stephen in Legal to get his input.

Pcoombe claimed this task.

Okay, this is live! After donating from a banner, a user will see a "Return to Wikipedia" button at the bottom of the English Thank You page, which will take them back to the page where they saw the banner.

The cookies are set for other languages too, but we don't yet have the button on those thank you pages. Will tackle this after the English fundraiser: T268693: Add "Return to Wikipedia" button/link on non-English Thank You pages

Also made T268694: Donations from sidebar links: return user to original page after completion to look into doing the same for sidebar donations. But that's complicated and there's far fewer of them than banner donations, so it's quite a low priority