Page MenuHomePhabricator

VisualEditor: Stop users from deleting parameters in the template dialog if they're marked as "required" in TemplateData
Closed, ResolvedPublic

Description

Screenshot attached

Steps to reproduce:

1.Open a page with VE
2.Go to Insert>Transclusion
3.Search for the template Cite Web
4.Observe that the required parameters are now marked with * symbol
5.Delete the required parameters

Observed Result:

The required parameters gets deleted

See the screenshot attached.


Version: unspecified
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=50747

Attached:

Screen_Shot_2014-01-22_at_4.10.45_PM.png (461×816 px, 54 KB)

Details

Reference
bz60358

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:57 AM
bzimport set Reference to bz60358.

Change 154133 had a related patch set uploaded by Alex Monk:
Don't add delete button to required parameters in template dialog

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

Change 154133 merged by jenkins-bot:
Remove delete button from required parameters in template dialog

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

VisualEditor should only make edits easier, not restrict the users' capabilities.
As long as the wikitext editor allows removing required fields from templates (and it should, indeed), VE should too.
Sometimes the TemplateData information may be incorrect, or a set of fields may be mutually exclusive (and yet one of them would be required). Sometimes a user may want to remove a wrong value, and a template may show a warning for missing arguments (always better than wrong data).
Instead, a warning should be shown when a required parameter is going to be removed.

(In reply to Ricordisamoa from comment #5)

VisualEditor should only make edits easier,

I agree.

not restrict the users' capabilities.

I think this is a false dichotomy.

As long as the wikitext editor allows removing required fields from
templates (and it should, indeed), VE should too.

The wikitext editor lets you do lots of things that are stupid. VisualEditor's job is to make it easy to make good content, not easy to make broken pages. :-)

Sometimes the TemplateData information may be incorrect,

Then the TemplateData should be fixed.

or a set of fields may be mutually exclusive (and yet one of them would
be required).

That doesn't make sense. "Required" means "the template will die horribly if you don't include this". It is *not* a "we'd like you to fill this in" – that's what "suggested" is for. Most templates will have no 'required' fields.

Sometimes a user may want to remove a wrong value, and a template may
show a warning for missing arguments (always better than wrong data).

If the template outputs an error, that's probably a required parameter.

Instead, a warning should be shown when a required parameter is going to be
removed.

I disagree, for the reasons above.

(In reply to James Forrester from comment #6)

The wikitext editor lets you do lots of things that are stupid.

I do 'stupid' things all the time.
Now I understand that VE will always be a toy for newbies, and never a valid replacement for the wikitext editor.

(In reply to Ricordisamoa from comment #5)

...a set of fields
may be mutually exclusive (and yet one of them would be required).

(In reply to James Forrester from comment #6)

or a set of fields may be mutually exclusive (and yet one of them would
be required).

That doesn't make sense. "Required" means "the template will die horribly if
you don't include this". It is *not* a "we'd like you to fill this in" –
that's what "suggested" is for. Most templates will have no 'required'
fields.

It seems perfectly valid for a template to require that "either A or B be provided" and the user should be able to delete one of them if it is not needed.

(In reply to Helder from comment #8)

(In reply to James Forrester from comment #6)

(In reply to Ricordisamoa from comment #5)

or a set of fields may be mutually exclusive (and yet one of them would
be required).

That doesn't make sense. "Required" means "the template will die horribly if
you don't include this". It is *not* a "we'd like you to fill this in" –
that's what "suggested" is for. Most templates will have no 'required'
fields.

It seems perfectly valid for a template to require that "either A or B be
provided" and the user should be able to delete one of them if it is not
needed.

This feels like a pretty edge case (and suggests that we should consider whether the template should be re-written to be less anti-human); maybe file a TemplateData bug to ask for a way to express this relationship?

This kind of relationship between parameters was requested on bug 50407.

Verified the fix in production