mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 06:46:26 +00:00
Merge "Defer preferences update and avoid CAS errors in onUserLoggedIn()"
This commit is contained in:
commit
dce96deee1
|
@ -1009,9 +1009,17 @@ class VisualEditorHooks {
|
||||||
public static function onUserLoggedIn( $user ) {
|
public static function onUserLoggedIn( $user ) {
|
||||||
$cookie = RequestContext::getMain()->getRequest()->getCookie( 'VEE', '' );
|
$cookie = RequestContext::getMain()->getRequest()->getCookie( 'VEE', '' );
|
||||||
if ( $cookie === 'visualeditor' || $cookie === 'wikitext' ) {
|
if ( $cookie === 'visualeditor' || $cookie === 'wikitext' ) {
|
||||||
$user->setOption( 'visualeditor-editor', $cookie );
|
DeferredUpdates::addUpdate( new AtomicSectionUpdate(
|
||||||
$user->saveSettings();
|
wfGetDB( DB_MASTER ),
|
||||||
|
__METHOD__,
|
||||||
|
function () use ( $user, $cookie ) {
|
||||||
|
$uLatest = $user->getInstanceForUpdate();
|
||||||
|
$uLatest->setOption( 'visualeditor-editor', $cookie );
|
||||||
|
$uLatest->saveSettings();
|
||||||
|
}
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue