mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-24 06:13:54 +00:00
Drop smart logout handling in favor of core ready.js
MediaWiki core added support of overrideLogoutSelector skin config variable which allows us to define the logout button selector. Thanks to that we do not have to ship our custom/duplicated smart logout handler as we can use the one shipped with ready.js. Depends-On: Id313337c85229a5e8d0aada3a67d722048709597 Bug: T259200 Change-Id: Ie0192a176dfa8be994a544221aa71de75028d502
This commit is contained in:
parent
f31db9edf5
commit
5a2527d71d
|
@ -383,6 +383,7 @@ class MinervaHooks {
|
|||
$config['search'] = false;
|
||||
$config['collapsible'] = false;
|
||||
$config['sortable'] = false;
|
||||
$config['selectorLogoutLink'] = 'a.menu__item--logout';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,37 +268,6 @@ module.exports = function () {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For logout links do the API logout first so system do not show interstitial step,
|
||||
* and then redirect to LogoutPage (when user is already logged out) to show information
|
||||
* about successful logout and information about caching.
|
||||
*
|
||||
* @param {string} selector Logout links selector
|
||||
*/
|
||||
function initSmartLogout( selector ) {
|
||||
// Turn logout to a POST action
|
||||
$( selector ).on( 'click', function ( e ) {
|
||||
mw.notify(
|
||||
mw.message( 'logging-out-notify' ).text(), {
|
||||
tag: 'logout',
|
||||
autoHide: false
|
||||
}
|
||||
);
|
||||
api.postWithToken( 'csrf', {
|
||||
action: 'logout'
|
||||
} ).then(
|
||||
function () {
|
||||
location.reload();
|
||||
},
|
||||
function () {
|
||||
toast.showOnPageReload( mw.message( 'logout-failed' ).text() );
|
||||
location.reload();
|
||||
}
|
||||
);
|
||||
e.preventDefault();
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisation function for registration date on user page
|
||||
*
|
||||
|
@ -453,7 +422,6 @@ module.exports = function () {
|
|||
return !isUserUri( element.href );
|
||||
} )
|
||||
);
|
||||
initSmartLogout( '.menu__item--logout' );
|
||||
initUserRedLinks();
|
||||
} );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue