Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/225051

Change subject: Hooks: Support auto-enabling for auto-created accounts
......................................................................

Hooks: Support auto-enabling for auto-created accounts

Change-Id: Ibe1ba94e4478a637367b303b479586f45e85cfa4
---
M VisualEditor.hooks.php
M extension.json
2 files changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/51/225051/1

diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 8f5ecb9..e8974c1 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -721,4 +721,23 @@
                }
                return true;
        }
+
+       /**
+        * Sets user preference to enable the VisualEditor account for new auto-
+        * created ('auth') accounts, if $wgVisualEditorAutoAccountEnable is 
set.
+        *
+        * To be removed once no longer needed.
+        */
+       public static function onAuthPluginAutoCreate( $user ) {
+               if (
+                       RequestContext::getMain()->getConfig()->get( 
'VisualEditorAutoAccountEnable' ) &&
+                       $user->isLoggedin()
+               ) {
+                       $user->setOption( 'visualeditor-enable', 1 );
+                       $user->saveSettings();
+               }
+               return true;
+       }
+
+
 }
diff --git a/extension.json b/extension.json
index 07cb25c..645aadd 100644
--- a/extension.json
+++ b/extension.json
@@ -96,6 +96,7 @@
                "VisualEditorParsoidURL": "http://localhost:8000";,
                "VisualEditorEnableSplitTest": false,
                "VisualEditorEnableTocWidget": false,
+               "VisualEditorAutoAccountEnable": false,
                "VisualEditorNamespaces": [],
                "VisualEditorParsoidTimeout": 100
        },
@@ -170,6 +171,9 @@
                ],
                "AddNewAccount": [
                        "VisualEditorHooks::onAddNewAccount"
+               ],
+               "AuthPluginAutoCreate": [
+                       "VisualEditorHooks::onAuthPluginAutoCreate"
                ]
        },
        "ResourceModules": {

-- 
To view, visit https://gerrit.wikimedia.org/r/225051
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe1ba94e4478a637367b303b479586f45e85cfa4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to