mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
Defer preferences update and avoid CAS errors in onUserLoggedIn()
Bug: T143367 Change-Id: I9509f6ef565d9953f9c05b00b02b57098eef9e3a
This commit is contained in:
parent
7660980ab5
commit
5f8dfc4b8f
|
@ -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