X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fsrc%2Fmediawiki.page.ready.js;h=0e59da624bbe052c353c01ac42388e8a96f2afc7;hb=568631af97fdde99d1b218776c94b298c0fb171e;hp=630e3a6465137c6517b9ddcbe0a10a7f805f4007;hpb=6b3b17ea5a421b53598654b4c4fbf39992125a8c;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.page.ready.js b/resources/src/mediawiki.page.ready.js index 630e3a6465..0e59da624b 100644 --- a/resources/src/mediawiki.page.ready.js +++ b/resources/src/mediawiki.page.ready.js @@ -56,24 +56,25 @@ // Turn logout to a POST action $( '#pt-logout a' ).on( 'click', function ( e ) { - var api = new mw.Api(), returnUrl; - returnUrl = $( '#pt-logout a' ).attr( 'href' ); + var api = new mw.Api(), + returnUrl = $( '#pt-logout a' ).attr( 'href' ); mw.notify( mw.message( 'logging-out-notify' ), { tag: 'logout', autoHide: false } ); api.postWithToken( 'csrf', { action: 'logout' - } ).done( function () { - // Horrible hack until deprecation of logoutToken in GET is done - returnUrl = returnUrl.replace( /logoutToken=.+?($|&)/g, 'logoutToken=%2B%5C' ); - window.location = returnUrl; - } ).fail( function ( e ) { - mw.notify( - mw.message( 'logout-failed', e ), - { type: 'error', tag: 'logout', autoHide: false } - ); - } ); + } ).then( + function () { + location.href = returnUrl; + }, + function ( e ) { + mw.notify( + mw.message( 'logout-failed', e ), + { type: 'error', tag: 'logout', autoHide: false } + ); + } + ); e.preventDefault(); } ); } );