Page MenuHomePhabricator

Usernames invisible in Echo notification text
Closed, ResolvedPublic


I just got a notification because someone tagged me and a bunch of other usernames, and the notification text did not show those other usernames. The edit text contained (in Hebrew, alas) "I tagged [[User:Foo|Foo]], [[User:Bar|Bar]], [[User:Baz|Baz]], and [[User:Xyzzy|xyzzy]], ...", but the notification text looked like "I tagged , , , , ...."

See screenshot:


Related Gerrit Patches:
mediawiki/extensions/Echo : masterUnconvolute DiscussionParser::getTextSnippet()

Event Timeline

Ijon created this task.Mar 10 2016, 6:43 PM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptMar 10 2016, 6:43 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Ijon added a comment.Mar 10 2016, 6:47 PM

Correction: the edit text used the Hebrew equivalent of the {{Ping}} template:

This is the diff:

So it looks like EchoDiscussionParser::getTextSnippet() just strips all templates. I don't really understand why it works the way it does. For snippets of Flow discussions, we take the HTML version and strip it down. For wikitext discussions, we start with wikitext, strip tags, strip templates, THEN parse it, replace   with spaces, decode, strip tags AGAIN, remove { and } (why?!), then truncate.

Change 276687 had a related patch set uploaded (by Catrope):
Unconvolute DiscussionParser::getTextSnippet()

Other weird behavior in the old implementation:

  • Anything wrapped in / produced by a template was stripped. As the bug report says, this includes {{ping|Username}}, and it's very unhelpful to strip these
  • Including odd entities in comments (e.g. ὣ which is ὣ) caused no snippet to be shown at all
  • I have reason to believe { and } got removed wherever they appeared

These apply to wikitext mentions and edit-user-talk notifications; for Flow notifications, snippet behavior is much more sane. My patch basically takes the Flow logic and applies it to wikitext notifs.

  1. {{ping|Username}} produces - notice the added colon @Username:

{{FlowMention|Username}} will display @Username

{{ {{{|safesubst:}}}#time:i}} will display e.g. 06

{{CURRENTTIME}} will display e.g. 22:06

  1. ὣ will be displayed as ὣ

Note: Currently, wikitext User talk pages do not display text excerpts (except when a user was mentioned).

The test case to check after the fix:

-on a wikitext User talk page create a new section with a title: ὣ

  • in the body of that section Mention a user
  • the mentioned user receives broken notification

The rendered section looks like - also, View changes page:

Change 276687 merged by jenkins-bot:
Unconvolute DiscussionParser::getTextSnippet()

Etonkovidova added a comment.EditedMar 22 2016, 10:25 PM

Checked in betalabs - a tricky topic title e.g. ὣ in Notifications is displayed properly.

However, @Catrope - an extra ὣ is added to the text excerpt. Also, it's displayed in the screenshot above - the first symbol of the text excerpt.
The following

was rendered as

jmatazzoni closed this task as Resolved.Mar 23 2016, 6:45 PM
jmatazzoni claimed this task.