Page MenuHomePhabricator

Messages mwe-upwiz-error-too-short and mwe-upwiz-error-too-long are reused, sometimes passed wrong parameters
Closed, ResolvedPublic

Description

Messages 'mwe-upwiz-error-too-short' and 'mwe-upwiz-error-too-long':

	"mwe-upwiz-error-too-long": "This entry is too long.\nPlease make this entry shorter than $1 {{PLURAL:$1|character|characters}}.",
	"mwe-upwiz-error-too-short": "This entry is too short.\nPlease make this entry longer than $1 {{PLURAL:$1|character|characters}}.",

They are used as error messages in two places, and while the text is correct in one of them, it should actually be "at most" / "at least" ("shorter or equal to" / "longer or equal to") in the other:

/resources/mw.UploadWizardDescription.js
			return this.input.rules( 'add', {
				minlength: mw.UploadWizard.config.minDescriptionLength,
				maxlength: mw.UploadWizard.config.maxDescriptionLength,
				required: required,
				messages: {
					required: mw.message( 'mwe-upwiz-error-blank' ).escaped(),
					minlength: mw.message( 'mwe-upwiz-error-too-short', mw.UploadWizard.config.minDescriptionLength - 1 ).escaped(),
					maxlength: mw.message( 'mwe-upwiz-error-too-long', mw.UploadWizard.config.maxDescriptionLength + 1 ).escaped()
				}
			} );
/resources/mw.UploadWizardDeed.js
					rules: {
						source: {
							required: true,
							minlength: config.minSourceLength,
							maxlength: config.maxSourceLength
						},
						author: {
							required: true,
							minlength: config.minAuthorLength,
							maxlength: config.maxAuthorLength
						}
					},
					messages: {
						source: {
							required: mw.message( 'mwe-upwiz-error-blank' ).escaped(),
							minlength: mw.message( 'mwe-upwiz-error-too-short', config.minSourceLength ).escaped(),
							maxlength: mw.message( 'mwe-upwiz-error-too-long', config.maxSourceLength ).escaped()
						},
						author: {
							required: mw.message( 'mwe-upwiz-error-blank' ).escaped(),
							minlength: mw.message( 'mwe-upwiz-error-too-short', config.minAuthorLength ).escaped(),
							maxlength: mw.message( 'mwe-upwiz-error-too-long', config.maxAuthorLength ).escaped()
						}
					}

I tracked this down to change b50287a66674e98e56d3c76d084f1bc572898fc9 (https://gerrit.wikimedia.org/r/#/c/148410/), which changed the code to match the messages in one place, but forgot the other.

As the configuration settings defining the lengths are usually nice round numbers, I think it would be best to undo that change and instead update the messages. (This was even pointed out in post-merge review, heh.)

Event Timeline

matmarex created this task.Nov 17 2015, 9:07 PM
matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added projects: UploadWizard, I18n.
matmarex added a subscriber: matmarex.
Restricted Application added a project: Multimedia. · View Herald TranscriptNov 17 2015, 9:07 PM
Restricted Application added subscribers: StudiesWorld, Steinsplitter, Aklapper. · View Herald Transcript
MarkTraceur triaged this task as Normal priority.Nov 24 2015, 8:10 PM
MarkTraceur added a subscriber: MarkTraceur.
Restricted Application added a subscriber: Matanya. · View Herald TranscriptNov 24 2015, 8:10 PM
matmarex updated the task description. (Show Details)Dec 8 2015, 3:36 PM
matmarex added a project: Google-Code-In-2015.
matmarex set Security to None.

Change 263185 had a related patch set uploaded (by Ananay):
Messages mwe-upwiz-error-too-short and mwe-upwiz-error-too-long are reused, sometimes passed wrong parameters

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

matmarex closed this task as Resolved.Jan 10 2016, 11:08 PM
matmarex removed a project: Patch-For-Review.

Change 263185 merged by jenkins-bot:
Pass correct parameters to mwe-upwiz-error-too-short and mwe-upwiz-error-too-long

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