Revert "Edit Recovery: Add Special:EditRecovery link to personal menu"

This reverts commit 613cbaa0b1.

Reason for revert: T351781#9392499

Bug: T351781
Change-Id: I6acf3ede9d34651827619ef5ac55ad91120cdb7e
This commit is contained in:
Samtar 2023-12-08 11:27:22 +00:00
parent 613cbaa0b1
commit a557776751
10 changed files with 14 additions and 76 deletions

View file

@ -598,6 +598,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' ) ) {
$outputPage->addModules( 'mediawiki.editRecovery.postEdit' );
}
}
}

View file

@ -510,13 +510,6 @@ abstract class Skin extends ContextSource {
$modules['user'][] = 'mediawiki.tempUserBanner';
$modules['styles']['user'][] = 'mediawiki.tempUserBanner.styles';
}
// Add the Edit Recovery module to delete data on logout and control the display of the Special:EditRecovery
// link in the personal menu. T341845, T351781.
if ( $this->getConfig()->get( MainConfigNames::EnableEditRecovery ) ) {
$modules['user'][] = 'mediawiki.editRecovery.hooks';
}
return $modules;
}

View file

@ -517,25 +517,6 @@ class SkinTemplate extends Skin {
}
}
// Add the 'Edit Recovery' link after 'Contributions'.
if ( $this->getConfig()->get( MainConfigNames::EnableEditRecovery ) ) {
$editRecoveryItem = [
'text' => $this->msg( 'editrecovery' )->text(),
'href' => SkinComponentUtils::makeSpecialUrl( 'EditRecovery' ),
'active' => $title->isSpecial( 'EditRecovery' ),
'icon' => 'history',
];
$personal_urls = wfArrayInsertAfter(
$personal_urls,
[ 'editrecovery' => $editRecoveryItem ],
$this->loggedin ? 'mycontris' : 'anoncontribs'
);
// If there's no contribs link, fall back to adding at the end.
if ( !isset( $personal_urls['editrecovery'] ) ) {
$personal_urls['editrecovery'] = $editRecoveryItem;
}
}
return $personal_urls;
}

View file

@ -658,8 +658,6 @@
"edit-recovery-loaded-message": "Your unsaved changes have been automatically recovered.",
"edit-recovery-loaded-show": "Show changes",
"edit-recovery-loaded-discard": "Discard changes",
"edit-recovery-link-tooltip-no-data": "You currently have no Edit Recovery data saved",
"edit-recovery-link-tooltip-with-data": "You currently have Edit Recovery data saved for $1 {{PLURAL:$1|page|pages}}",
"summary": "Summary:",
"subject": "Subject:",
"minoredit": "This is a minor edit",

View file

@ -913,8 +913,6 @@
"edit-recovery-loaded-message": "Message shown in a notification toast popup when an in-progress edit is recovered.",
"edit-recovery-loaded-show": "Button text in a notification toast popup shown when an in-progress edit is recovered, used to show changes.",
"edit-recovery-loaded-discard": "Button text in a notification toast popup shown when an in-progress edit is recovered, used to cancel the recovery and delete the data.",
"edit-recovery-link-tooltip-no-data": "Tooltip shown on the link to Special:EditRecovery when there is no stored data.",
"edit-recovery-link-tooltip-with-data": "Tooltip shown on the link to Special:EditRecovery when there is any stored data.\n\nParameters:\n\n* $1 — The number of stored items.",
"summary": "The Summary text beside the edit summary field\n\nSee also:\n* {{msg-mw|Subject}}\nSee also:\n* {{msg-mw|Accesskey-summary}}\n* {{msg-mw|Tooltip-summary}}\n{{Identical|Summary}}",
"subject": "Used as label for the section title input box when adding a new section on a talk page.\n\nSee also:\n* {{msg-mw|Summary}}\n{{Identical|Subject}}",
"minoredit": "Text above Save page button in editor\n\nSee also:\n* {{msg-mw|Minoredit}}\n* {{msg-mw|Accesskey-minoredit}}\n* {{msg-mw|Tooltip-minoredit}}",

View file

@ -1338,20 +1338,13 @@ return [
'dependencies' => 'mediawiki.action.view.filepage',
],
'mediawiki.editRecovery.hooks' => [
'mediawiki.editRecovery.postEdit' => [
'localBasePath' => MW_INSTALL_PATH . '/resources/src/mediawiki.editRecovery',
'remoteBasePath' => "$wgResourceBasePath/resources/src/mediawiki.editRecovery",
'packageFiles' => [
'hooks.js',
'postEdit.js',
'storage.js',
],
'styles' => [
'styles.less',
],
'messages' => [
'edit-recovery-link-tooltip-no-data',
'edit-recovery-link-tooltip-with-data',
]
],
'mediawiki.editRecovery.edit' => [
'localBasePath' => MW_INSTALL_PATH . '/resources/src/mediawiki.editRecovery',

View file

@ -5,7 +5,6 @@
const storage = require( './storage.js' );
const LoadNotification = require( './LoadNotification.js' );
const specialPageLink = document.getElementById( 'pt-editrecovery' );
const inputFields = {};
const fieldNamePrefix = 'field_';
@ -159,10 +158,6 @@ function saveFormData() {
storage.deleteData( pageName, section );
} else {
storage.saveData( pageName, section, pageData );
// Re-show the link to Special:EditRecovery (it migth've been hidden in ./hooks.js).
if ( specialPageLink ) {
specialPageLink.classList.remove( 'oo-ui-element-hidden' );
}
}
}

View file

@ -1,28 +0,0 @@
'use strict';
mw.hook( 'postEdit' ).add( function () {
const storage = require( './storage.js' );
storage.openDatabase().then( function () {
storage.deleteData( mw.config.get( 'wgPageName' ) );
storage.closeDatabase();
} );
} );
// Hide the link to Special:EditRecovery if there's no data to recovery.
const editRecoveryLink = document.getElementById( 'pt-editrecovery' );
if ( editRecoveryLink ) {
mw.hook( 'wikipage.content' ).add( function () {
const storage = require( './storage.js' );
storage.openDatabase().then( function () {
storage.loadAllData().then( function ( data ) {
if ( data.length === 0 ) {
editRecoveryLink.classList.add( 'mw-editrecovery-no-data' );
editRecoveryLink.title = mw.msg( 'edit-recovery-link-tooltip-no-data' );
} else {
editRecoveryLink.classList.remove( 'mw-editrecovery-no-data' );
editRecoveryLink.title = mw.msg( 'edit-recovery-link-tooltip-with-data', data.length );
}
} );
} );
} );
}

View file

@ -0,0 +1,9 @@
'use strict';
mw.hook( 'postEdit' ).add( function () {
const storage = require( './storage.js' );
storage.openDatabase().then( function () {
storage.deleteData( mw.config.get( 'wgPageName' ) );
storage.closeDatabase();
} );
} );

View file

@ -17,7 +17,3 @@
margin: @size-50 auto 0 auto;
}
}
#pt-editrecovery.mw-editrecovery-no-data a {
color: @color-disabled;
}