EditRecovery: Add user preference
Add a user preference to allow the user to enable or disable EditRecovery. Set the default as disabled. Bug: T350653 Change-Id: Ibbb59eb84f1dd0b40f9576e048f2ac76044f9014
This commit is contained in:
parent
37dcd4adf8
commit
2466abb518
8 changed files with 20 additions and 1 deletions
|
|
@ -4766,6 +4766,7 @@ config-schema:
|
|||
disablemail: 0
|
||||
editfont: monospace
|
||||
editondblclick: 0
|
||||
editrecovery: 0
|
||||
editsectiononrightclick: 0
|
||||
email-allow-new-users: 1
|
||||
enotifminoredits: 0
|
||||
|
|
|
|||
|
|
@ -7534,6 +7534,7 @@ class MainConfigSchema {
|
|||
'disablemail' => 0,
|
||||
'editfont' => 'monospace',
|
||||
'editondblclick' => 0,
|
||||
'editrecovery' => 0,
|
||||
'editsectiononrightclick' => 0,
|
||||
'email-allow-new-users' => 1,
|
||||
'enotifminoredits' => 0,
|
||||
|
|
|
|||
|
|
@ -1047,6 +1047,7 @@ return [
|
|||
'disablemail' => 0,
|
||||
'editfont' => 'monospace',
|
||||
'editondblclick' => 0,
|
||||
'editrecovery' => 0,
|
||||
'editsectiononrightclick' => 0,
|
||||
'email-allow-new-users' => 1,
|
||||
'enotifminoredits' => 0,
|
||||
|
|
|
|||
|
|
@ -2759,6 +2759,7 @@ class EditPage implements IEditObject {
|
|||
}
|
||||
|
||||
if ( $this->context->getConfig()->get( MainConfigNames::EnableEditRecovery )
|
||||
&& $this->userOptionsLookup->getOption( $user, 'editrecovery' )
|
||||
&& !$this->isConflict
|
||||
&& !$this->context->getRequest()->getInt( 'undo' )
|
||||
&& !$this->oldid
|
||||
|
|
|
|||
|
|
@ -595,7 +595,9 @@ class Article implements Page {
|
|||
$request->response()->clearCookie( $cookieKey );
|
||||
$outputPage->addJsConfigVars( 'wgPostEdit', $postEdit );
|
||||
$outputPage->addModules( 'mediawiki.action.view.postEdit' ); // FIXME: test this
|
||||
if ( $this->getContext()->getConfig()->get( 'EnableEditRecovery' ) ) {
|
||||
if ( $this->getContext()->getConfig()->get( 'EnableEditRecovery' )
|
||||
&& $this->userOptionsLookup->getOption( $this->getContext()->getUser(), 'editrecovery' )
|
||||
) {
|
||||
$outputPage->addModules( 'mediawiki.editRecovery.postEdit' );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
|
|||
MainConfigNames::DefaultSkin,
|
||||
MainConfigNames::EmailAuthentication,
|
||||
MainConfigNames::EmailConfirmToEdit,
|
||||
MainConfigNames::EnableEditRecovery,
|
||||
MainConfigNames::EnableEmail,
|
||||
MainConfigNames::EnableUserEmail,
|
||||
MainConfigNames::EnableUserEmailMuteList,
|
||||
|
|
@ -1208,6 +1209,16 @@ class DefaultPreferencesFactory implements PreferencesFactory {
|
|||
'section' => 'editing/editor',
|
||||
'label-message' => 'tog-forceeditsummary',
|
||||
];
|
||||
|
||||
// T350653
|
||||
if ( $this->options->get( MainConfigNames::EnableEditRecovery ) ) {
|
||||
$defaultPreferences['editrecovery'] = [
|
||||
'type' => 'toggle',
|
||||
'section' => 'editing/editor',
|
||||
'label-message' => 'tog-editrecovery',
|
||||
];
|
||||
}
|
||||
|
||||
$defaultPreferences['useeditwarning'] = [
|
||||
'type' => 'toggle',
|
||||
'section' => 'editing/editor',
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
"tog-showrollbackconfirmation": "Show a confirmation prompt when clicking on a rollback link",
|
||||
"tog-requireemail": "Send password reset emails only when both email address and username are provided.",
|
||||
"tog-forcesafemode": "Always enable [[mw:Manual:Safemode|safe mode]]",
|
||||
"tog-editrecovery": "Enable the [[Special:EditRecovery|{{int:editrecovery}}]] feature",
|
||||
"underline-always": "Always",
|
||||
"underline-never": "Never",
|
||||
"underline-default": "Skin or browser default",
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@
|
|||
"tog-showrollbackconfirmation": "Toggle option used in [[Special:Preferences]] to enable/disable rollback confirmation prompt. Should be visible only to users with rollback rights.",
|
||||
"tog-requireemail": "Toggle option used in [[Special:Preferences]]. Should be only visible to users who have confirmed their email address.\n\nSee also: {{msg-mw|prefs-help-requireemail}}",
|
||||
"tog-forcesafemode": "Toggle option used in [[Special:Preferences]] to always enable safe mode.",
|
||||
"tog-editrecovery": "Toggle option used in [[Special:Preferences]] to enable/disable the edit recovery feature.",
|
||||
"underline-always": "Used in [[Special:Preferences#mw-prefsection-rendering|Preferences]].\n\nThis option means \"always underline links\", there are also options {{msg-mw|Underline-never}} and {{msg-mw|Underline-default}}.\n\n{{Gender}}\n{{Identical|Always}}",
|
||||
"underline-never": "Used in [[Special:Preferences#mw-prefsection-rendering|Preferences]].\n\nThis option means \"never underline links\", there are also options {{msg-mw|Underline-always}} and {{msg-mw|Underline-default}}.\n\n{{Gender}}\n{{Identical|Never}}",
|
||||
"underline-default": "Used in [[Special:Preferences#mw-prefsection-rendering|Preferences]].\n\nThis option means \"underline links as in your user skin or your browser\", there are also options {{msg-mw|Underline-never}} and {{msg-mw|Underline-always}}.\n\n{{Gender}}\n{{Identical|Browser default}}",
|
||||
|
|
|
|||
Loading…
Reference in a new issue