Page MenuHomePhabricator

Keep notification excerpts compact and meaningful
Closed, ResolvedPublic


Notifications include content excerpts which are expected to be one line of content that provides some context for the user to anticipate what the notification is about. As illustrated below, it seems that currently under some circumstances it can render in multiple lines, making the whole notification taller than needed:

notification-too-high.png (468×502 px, 57 KB)

Some considerations to be supported by the excerpt:

  • We want to keep the excerpt one line long. No more.
  • We want to include as much content as possible in that line. We can ignore carriage returns in the content when displaying it as part of the excerpt.
  • We want to avoid wikitext. A plain text of the rendered content seems good as an overview.

Event Timeline

SBisson triaged this task as High priority.

Change 273284 had a related patch set uploaded (by Sbisson):
Force notification body on a single line

The spec here says:

We want to avoid wikitext. A plain text of the rendered content seems good as an overview.

One thing that means is that if message we're excerpting contains a link, that link should be just plain text (i.e., not a link) in the excerpt. This issue came up in T127249. I'm just noting it down here so we can be sure to test it when this ticket is ready for Q&A.

Change 273284 merged by jenkins-bot:
Force notification body on a single line

Checked in betalabs.

  1. All newlines and white spaces seems to be handled correctly - they are removed and the text excerpt in Notification panel is displayed without them.
  1. The following examples refer to the cases where Reply text consists entirely of the samples. If Reply includes the samples and the text - the correct text excerpt is present.

There are empty text excerpts for the following cases - if the text starts with the samples:

[[Category:1687 deaths]]


<!-- TEST N.1 -->
[[File:Industrial robot.jpg|thumb]]
[[File:Double-O-Arch Arches National Park 2.jpg|thumb]]
  1. The text from links will be displayed as

Mavetuna44 Mavetuna22

  1. Tables text content will be displayed as

Header1 Header2 Header3

{| class="wikitable"
! rowspan="2" colspan="2" |Header 1
!Header 3
!Header 4
| rowspan="2" colspan="2" |
| rowspan="2" |
  1. Templates
{{Infobox person|name = elitre}}
{{Infobox person|name = krinkle dev}}

will be displayed as:
elitre krinkle dev

Note: Let me know if some other cases should be tested.

Checking the cases for tags - from T120291: wikitext in flow titles is parsed (HTML tags like <tt> and templates) on echo notifications - seems quite safe.

Echo flyout text excerpt
<code></code>plain text
<script>alert(1)</script>plain text -alert(1)
<tt>plain text
{{release}}plain text - Template:Release
<!--T:1-->plain text
<translate>plain text
single straight quotation markplain text - also checked with other quotes
<pre>plain text