Last modified: 2014-11-13 03:58:25 UTC
If I make a new topic, with 256 characters in the title, e.g. http://ee-flow.wmflabs.org/wiki/Topic:S3goq6o2pw8xejcw as soon as I click "Edit title", only 200 characters are in the text-field. Expected: All 256 characters are in the text-field. (Sidenotes, possibly worth splitting into a new bug: * The titles should be limited to 255 bytes (Not the current 260 bytes). Possibly there's a global variable we can share?) * The text-fields should not accept more content than the character/byte limit - currently it extends infinitely, but gives warnings if we try to save with more than 260 bytes. - Compare this with a wikitext page: https://www.mediawiki.org/w/index.php?title=User_talk:Quiddity_%28WMF%29/sandbox&action=edit§ion=new
https://trello.com/c/3jmb9Ucx/
There is a library for this, jquery.byteLimit. Unlike maxlength, it is a byte limit, not a character limit, which probably fits the situation here.
(In reply to Matthew Flaschen from comment #2) > There is a library for this, jquery.byteLimit. This is in core.
In Firebug, a long title has a data-title attribute on the h2 class that is max 200 characters or 199 characters ending with "...". flow-board.js' editTopicTitle() function passes 'content': $title.data( 'title' ) to the flow_edit_topic_title form template, so this truncated title is what is shown in the form, hence this bug. I think Flow uses this data-title rather than directly using the h2 contents to avoid bugs with improper escaping. The data-title attribute is only 199-200 characters because handlebars/flow_topic_titlebar_content.handlebars template has <h2 class="flow-topic-title" data-title="{{plaintextSnippet content.format content.content}} and the plainTextSnippet() helper function truncates. We should be using constants for this, even sending them to JS using ResourceLoaderConfigVars. BTW there are two places where substr( 0, 200 ) appears in flow-board.js. The server-imposed length limit comes from PostRevision::MAX_TOPIC_LENGTH = 260. MediaWiki's 255-character title length is discussed in https://www.mediawiki.org/wiki/Page_title_size_limitations and it might be worth matching it for consistency, but a topic title is not the same as a page title. If we do want Flow titles to play by the same rules then we could feed them into a MediaWikiTitleCodec for validation.
Change 166559 had a related patch set uploaded by Matthias Mullie: (bug 71584) Fetch title content from API https://gerrit.wikimedia.org/r/166559
Change 166559 merged by jenkins-bot: (bug 71584) Fetch title content from API https://gerrit.wikimedia.org/r/166559
Is this fixed?