Last modified: 2014-11-19 19:26:46 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T73249, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71249 - VisualEditor: TitleInputWidget should validate inputs
VisualEditor: TitleInputWidget should validate inputs
Status: VERIFIED FIXED
Product: VisualEditor
Classification: Unclassified
Editing Tools (Other open bugs)
unspecified
All All
: High normal
: VE-deploy-2014-11-05 (1.25wmf7)
Assigned To: Sucheta Ghoshal
:
Depends on:
Blocks: 72468
  Show dependency treegraph
 
Reported: 2014-09-24 19:19 UTC by James Forrester
Modified: 2014-11-19 19:26 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description James Forrester 2014-09-24 19:19:56 UTC
We have isValid() functions for similar inputs, but not this one, so it's possible to try to create a redirect to "|" (which Parsoid turns into MediaWiki:Badtitle).
Comment 1 Alex Monk 2014-09-24 23:49:49 UTC
Currently the redirect section of the page settings dialog and the template placeholder page use MWTitleInputWidget.

The template placeholder page can be fixed with a simple change from value === '' to !mw.Title.newFromText( value ) in MWTemplatePlaceholderPage#onTemplateInputChange. It will no longer allow you to add a template with an invalid name. No need for isValid here.

As for the redirect settings, that seems more difficult. I don't think we should just silently ignore the value if it was set to an invalid title... And I don't think we should disable the apply button either.
Comment 2 Alex Monk 2014-10-07 21:50:16 UTC
Bump.
Comment 3 James Forrester 2014-10-08 21:27:44 UTC
(In reply to Alex Monk from comment #1)
> Currently the redirect section of the page settings dialog and the template
> placeholder page use MWTitleInputWidget.
> 
> The template placeholder page can be fixed with a simple change from value
> === '' to !mw.Title.newFromText( value ) in
> MWTemplatePlaceholderPage#onTemplateInputChange. It will no longer allow you
> to add a template with an invalid name. No need for isValid here.

What happens when you use a parser function or a magic word?

> As for the redirect settings, that seems more difficult. I don't think we
> should just silently ignore the value if it was set to an invalid title...
> And I don't think we should disable the apply button either.

We show "invalid title" for link searches; presumably that's evaluated server-side?
Comment 4 Alex Monk 2014-10-14 20:07:14 UTC
(In reply to James Forrester from comment #3)
> (In reply to Alex Monk from comment #1)
> > Currently the redirect section of the page settings dialog and the template
> > placeholder page use MWTitleInputWidget.
> > 
> > The template placeholder page can be fixed with a simple change from value
> > === '' to !mw.Title.newFromText( value ) in
> > MWTemplatePlaceholderPage#onTemplateInputChange. It will no longer allow you
> > to add a template with an invalid name. No need for isValid here.
> 
> What happens when you use a parser function or a magic word?

I imagine it would break. So let's not do that.

> > As for the redirect settings, that seems more difficult. I don't think we
> > should just silently ignore the value if it was set to an invalid title...
> > And I don't think we should disable the apply button either.
> 
> We show "invalid title" for link searches; presumably that's evaluated
> server-side?

That is shown when the page does not seem to exist (based on the search results) and we get a false-y value from mw.Title.newFromText on the given title.
Comment 5 Roan Kattouw 2014-10-24 01:51:03 UTC
This is scarily close to what I filed bug 72468 about. While filing it I was thinking that an isValid() implementation should also be provided. I'll add that to that bug.
Comment 6 Gerrit Notification Bot 2014-10-28 23:41:29 UTC
Change 169623 had a related patch set uploaded by SuchetaG:
Introducing isValid() in MWTitileInputWidget

https://gerrit.wikimedia.org/r/169623
Comment 7 Gerrit Notification Bot 2014-10-29 18:15:26 UTC
Change 169623 merged by jenkins-bot:
Introducing isValid() in MWTitileInputWidget

https://gerrit.wikimedia.org/r/169623
Comment 8 etonkovidova 2014-11-05 23:22:02 UTC
test2 has the same validation that is in betalabs: 

- cannot add Talk: as a template - 'Add template' is disabled
- cannot add a template or a  category with |(a pipe), < and > chars
- if 'Page settings' redirection has aforementioned  symbols - MediaWiki:Badtitletext is displayed.  Does it need some improvement?
Comment 9 James Forrester 2014-11-05 23:22:44 UTC
(In reply to etonkovidova from comment #8)
> test2 has the same validation that is in betalabs: 
> 
> - cannot add Talk: as a template - 'Add template' is disabled
> - cannot add a template or a  category with |(a pipe), < and > chars
> - if 'Page settings' redirection has aforementioned  symbols -
> MediaWiki:Badtitletext is displayed.  Does it need some improvement?

That sounds like it covers all our needs.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links