[go: nahoru, domu]

Page MenuHomePhabricator

Clicking Prepare multiple times on Special:PagePreparation results in multiple diffs being appended
Closed, ResolvedPublic

Description

Using Special:PagePreparation on https://www.mediawiki.org/wiki/OAuth/For_Developers results in a page with multiple diffs if you click prepare multiple times...

Screenshot 2023-07-25 at 12.36.45.png (733×1 px, 163 KB)

Screenshot 2023-07-25 at 12.36.52.png (386×1 px, 63 KB)

When the button is clicked, it should probably be disabled/similar until the request has come back...

And/or it shouldn't just append the diff onto the bottom... The latest should win.

			$.when( getPageContent( pageName ) ).done( function ( content ) {
				pageContent = content;
				pageContent = pageContent.trim();
				pageContent = cleanupTags( pageContent );
				pageContent = addLanguageBar( pageContent );
				pageContent = addTranslateTags( pageContent );
				pageContent = addNewLines( pageContent );
				pageContent = fixInternalLinks( pageContent );
				pageContent = doTemplates( pageContent );
				pageContent = doFiles( pageContent );
				pageContent = doCategories( pageContent );
				pageContent = postPreparationCleanup( pageContent );
				pageContent = pageContent.trim();
				getDiff( pageName, pageContent ).done( function ( diff ) {
					if ( diff === undefined ) {
						$messageDiv.text( mw.msg( 'pp-diff-error' ) ).removeClass( 'hide' );
						return;
					}

					$( '.diff tbody' ).append( diff );
					$( '.divDiff' ).removeClass( 'hide' );
					if ( diff !== '' ) {
						$messageDiv.text( mw.msg( 'pp-prepare-message' ) ).removeClass( 'hide' );
						$( '#action-prepare' ).addClass( 'hide' );
						$( '#action-save' ).removeClass( 'hide' );
						$( '#action-cancel' ).removeClass( 'hide' );
					} else {
						$messageDiv.text( mw.msg( 'pp-already-prepared-message' ) ).removeClass( 'hide' );
					}
				} );
			} );

This also seems to show an even more exacerbated version of the issues raised in T342651: Special:PagePreparation should handled pages with translation markup better (or do nothing)/T245811: PagePreparation doesn't detect languages tag already in page.

Event Timeline

Reedy renamed this task from Running Special:PagePreparation on a page already with translation markup results in multiple diffs to Clicking Prepare multiple times on Special:PagePreparation results in multiple diffs.Jul 25 2023, 1:42 PM
Reedy updated the task description. (Show Details)
Reedy renamed this task from Clicking Prepare multiple times on Special:PagePreparation results in multiple diffs to Clicking Prepare multiple times on Special:PagePreparation results in multiple diffs being appended.Jul 25 2023, 4:58 PM

Change 941493 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/Translate@master] ext.translate.special.pagepreparation.js: Disable Prepare button after first click

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

Change 941493 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ext.translate.special.pagepreparation.js: Better handling of Prepare button click

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

Change 941871 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/Translate@REL1_40] ext.translate.special.pagepreparation.js: Better handling of Prepare button click

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

Change 941906 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/Translate@REL1_39] ext.translate.special.pagepreparation.js: Better handling of Prepare button click

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

Change 941906 merged by jenkins-bot:

[mediawiki/extensions/Translate@REL1_39] ext.translate.special.pagepreparation.js: Better handling of Prepare button click

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

Change 941871 merged by jenkins-bot:

[mediawiki/extensions/Translate@REL1_40] ext.translate.special.pagepreparation.js: Better handling of Prepare button click

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