Page MenuHomePhabricator

Define story text max length
Closed, ResolvedPublic

Description

Define maximum story text length (and maybe minimum) and consider its impact on

  • Story viewer: make sure it renders well
  • Story builder: when editing text manually
  • Article view: when picking text from an article

Event Timeline

SBisson renamed this task from Define story text length (min, max) to Define story text max length.May 12 2022, 3:50 PM
SBisson added a subscriber: EUdoh-WMF.

Change 791409 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/Wikistories@master] Make text length

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

SBisson triaged this task as Medium priority.
SBisson moved this task from Ready for Dev to Code Review on the Inuka-Team (Kanban) board.

Current max text length in the patch is 1000. Can be changed.

Change 791409 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] Max text length

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

Testing:

  1. Only 1000 characters makes its way unto the text space for each picture frame.
  2. If the user tries to input more letters, this is blocked at some point.

Improvement:
I believe there should be a notification on each story frame that lets the user know the character limit. It would improve the user experience.

Should I create a different ticket for this @SBisson?

[...]
Improvement:
I believe there should be a notification on each story frame that lets the user know the character limit. It would improve the user experience.

Should I create a different ticket for this @SBisson?

It sounds like a very valid improvement. Feel free to file it as such.

I encountered a strange issue just now: I selected a big paragraph from the article, it presumably transferred only the first 1000 characters from the article view to the story view. The text was visibly truncated. When I tried to save, it errored out with a message saying a frame had too much text (1002 characters).

This is the text: After the Homo erectus possibly using watercrafts more than a million years ago crossing straits between landmasses, boats have served as transportation far into the pre-historic. Circumstantial evidence, such as the early settlement of Australia over 40,000 years ago, findings in Crete dated 130,000 years ago, and in Flores dated to 900,000 years ago, suggest that boats have been used since prehistoric times. The earliest boats are thought to have been dugouts, and the oldest boats found by archaeological excavation date from around 7,000–10,000 years ago. The oldest recovered boat in the world, the Pesse canoe, found in the Netherlands, is a dugout made from the hollowed tree trunk of a Pinus sylvestris that was constructed somewhere between 8200 and 7600 BC. This canoe is exhibited in the Drents Museum in Assen, Netherlands. Other very old dugout boats have also been recovered. Rafts have operated for at least 8,000 years. A 7,000-year-old seagoing reed boat has been found at site H

Javascript reports that it is 1000 characters and it fits perfectly in the text input with maxlength=1000 but somehow php reports it at 1002 characters.

I tried the same scenario with a different long text and it worked just fine.

It turns out, this part: 7,000–10,000 years ago is using the long dash, which is a 3-byte character. PHP's strlen report it at 3 whereas PHP's mb_strlen reports it at 1.

I think the best solution for the user is that whatever the limit we set, it correspond to visible characters they can use. So if we say it's 1000, then they can write 1000 visible characters as frame text, no matter which characters they use (single or multi bytes).

I'll take this back to dev for a fix.

Change 793513 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/Wikistories@master] Use number of visible character to validate text length

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

Change 793513 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] Use number of visible character to validate text length

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

Change 793874 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/Wikistories@master] Add text max length to no-js story editor

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

Change 793874 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] Add text max length to no-js story editor

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

Testing:

This works. The task to inform the user about the character limit will come later.