Page MenuHomePhabricator

ProcessDialog warnings are displayed as errors
Closed, ResolvedPublic

Assigned To
Authored By
Samwilson
Apr 10 2025, 3:52 AM
Referenced Files
F59029268: image.png
Apr 10 2025, 3:59 AM
F59029245: image.png
Apr 10 2025, 3:52 AM
F59029236: image.png
Apr 10 2025, 3:52 AM

Description

An OOUI ProcessDialog Process can be an 'error' or 'warning', depending on the config of the Error returned in getActionProcess():

CodeCurrentSuggested
new OO.ui.Error( 'This is an error.', { warning: false } );
image.png (362×513 px, 15 KB)
new OO.ui.Error( 'This is a warning.', { warning: true } );
image.png (365×520 px, 16 KB)
image.png (366×522 px, 16 KB)

The latter should use a warning icon and be orange.

SSCE for demoing this:

	function WarningDialog() {
		WarningDialog.super.call( this );
	}
	OO.inheritClass( WarningDialog, OO.ui.ProcessDialog );
	WarningDialog.static.name = 'WarningDialog';
	WarningDialog.static.title = 'Warning dialog';
	WarningDialog.static.actions = [ { action: 'cancel', label: 'Cancel', flags: 'safe' } ];
	WarningDialog.prototype.getActionProcess = function ( action ) {
		return WarningDialog.super.prototype.getActionProcess.call( this, action )
			.next( () => {
				return new OO.ui.Error( 'This is a warning.', { warning: true } );
			} );
	};
	WarningDialog.prototype.getBodyHeight = function () {
		return 300;
	};
	const windowManager = OO.ui.getWindowManager();
	windowManager.addWindows( [ new WarningDialog() ] );
	windowManager.openWindow( 'WarningDialog' );

Event Timeline

Change #1135531 had a related patch set uploaded (by Samwilson; author: Samwilson):

[oojs/ui@master] Use MessageWidget 'warning' for ProcessDialog warnings

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

Change #1135531 merged by jenkins-bot:

[oojs/ui@master] Use MessageWidget 'warning' for ProcessDialog warnings

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

This will affect some other users of OOUI, e.g. VisualEditor (https://codesearch.wmcloud.org/deployed/?q=showSaveError), but I agree it's a good change. It's weird that we've never distinguished them here.

Change #1156368 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update OOUI to v0.52.0

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

Change #1156368 merged by jenkins-bot:

[mediawiki/core@master] Update OOUI to v0.52.0

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