Page MenuHomePhabricator

Flow: Topic Titles trimmed to 200 characters when editing
Open, NormalPublic

Description

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:


Version: unspecified
Severity: normal

Details

Reference
bz71584

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz71584.
bzimport added a subscriber: Unknown Object (MLST).
Quiddity created this task.Oct 3 2014, 1:22 AM

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

Quiddity removed a subscriber: Maryana.Dec 19 2014, 1:41 AM
EBernhardson triaged this task as Normal priority.Feb 19 2015, 6:50 PM

we should double check, but this is probably fixed. I have seen something related but different that arbitrarily cuts strings to 200 chars( in handlebars.js)

Leaving open until that is also resolved.

EBernhardson set Security to None.

Tested at http://en.wikipedia.beta.wmflabs.org/wiki/Topic:Sc42mtgxr73cuk4r
Started with a 256 character title. It let me add 4 characters, and saved successfully with all 260 characters.

So, the bug-aspect is fixed.
BUT, the 2 side-notes in the description are still unresolved. Should they be split into 1 or 2 new bugs, or solved as part of this one?

The titles should be limited to 255 bytes (Not the current 260 bytes). Possibly there's a global variable we can share?)

Is this really worth "fixing" if everything is working fine with 260?

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&section=new

I've split this out to T90521: Limit number of bytes on client-side with jQuery.bytelimit.

In T73584#1061208, @Mattflaschen wrote:

The titles should be limited to 255 bytes (Not the current 260 bytes). Possibly there's a global variable we can share?)

Is this really worth "fixing" if everything is working fine with 260?

I'm not sure. I'd lean towards yes, for A) Consistency, and B) in case it is documented anywhere, then we don't have to add an exception for Flow... Hmm, I can't see it mentioned in https://meta.wikimedia.org/wiki/Help:Talk_page - perhaps it's fine as is...

Change 192498 had a related patch set uploaded (by Mattflaschen):
Don't trim plaintextSnippet

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

Patch-For-Review

Change 192498 merged by jenkins-bot:
Eliminate plaintextSnippet

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

Restricted Application added a project: Growth-Team. · View Herald TranscriptJul 18 2018, 7:05 PM
SBisson moved this task from Inbox to Triaged but Future on the Growth-Team board.Jul 20 2018, 5:57 PM