Merge lp://staging/~macslow/unity-notifications/fix-1335787 into lp://staging/unity-notifications

Proposed by Mirco Müller
Status: Merged
Approved by: Michał Sawicz
Approved revision: 220
Merged at revision: 217
Proposed branch: lp://staging/~macslow/unity-notifications/fix-1335787
Merge into: lp://staging/unity-notifications
Diff against target: 125 lines (+64/-5)
3 files modified
include/Notification.h (+3/-0)
src/Notification.cpp (+14/-5)
test/notificationtest.cpp (+47/-0)
To merge this branch: bzr merge lp://staging/~macslow/unity-notifications/fix-1335787
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+227334@code.staging.launchpad.net

Commit message

Added an internal text-filter to setSummary() and setBody()

It strips or converts HTML and other markup-text, thus no special formatting happens during rendering via QML in the Notification-renderer.

Description of the change

Added an internal text-filter to setSummary() and setBody() (with a corresponding unit-test) which strips or converts HTML and other markup-text, thus no special formatting happens during rendering via QML in the Notification-renderer.

* Are there any related MPs required for this MP to build/function as expected? Please list.
Yes. It works optimal in tandem with lp:~macslow/unity8/fix-1335787

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.

* Did you make sure that your branch does not contain spurious tags?
Yes.

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable.

* If you changed the UI, has there been a design review?
Not applicable.

To post a comment you must log in.
216. By Mirco Müller

Merged with trunk and resolved conflicts.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

I'm really not sure this kind of filtering belongs here :|

Why don't we just require the consumers to send us unescaped strings? UI-side we can ignore tags by using http://qt-project.org/doc/qt-5/qml-qtquick-text.html#textFormat-prop, forcing it to PlainText, which will ignore tags and such.

review: Needs Information
Revision history for this message
Mirco Müller (macslow) wrote :

Using...

textFormat: Text.PlainText

... for the summary- and body-text (in the renderer/unity8) does prevent any inlined formatting tags from being applied or URLs to be highlighted, it does not strip any of the tags-text. The only issue I see with using the Text.PlainText approach, is that no single app (neither core nor 3rd-party) knows about this and probably sends "tag-polluted" text to the notifications. Thus it will make notifications look bad and easily exceed the new two-line limit Design wants to see enforced for body-text.

Regarding special HTML-characters like...

< < < > > > & & ' &

... I'm not sure how and where to make use of the C++-class QTextDocument. I would like to leave that within the responsibility of the sending app too, since we already demand tag-free text with the Text.PlainText approach.

Revision history for this message
Mirco Müller (macslow) wrote :

Of the initial 33 text-filter tests these 7 fail when using QTextDocument...

"<img src=\"foobar.png\" />Nothing to see" -> "Nothing to see"
"><", -> "><"
"<>", -> "<>"
"< this is not a tag >" -> "< this is not a tag >"
"14 < 42" -> "14 < 42"
"First line <br dumb> \r \n Second line" -> "First line\nSecond line"
"First line\n<br /> <br>\n2nd line\r\n3rd line" -> "First line\n2nd line\n3rd line"

217. By Mirco Müller

Updated the text-filter to only use QTextDocument, thus had to skip 7 of the initial 33 test-cases.

218. By Mirco Müller

Use the data-driven approach for the text-filter test.

219. By Mirco Müller

Oops.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

See inline

220. By Mirco Müller

Use tag-names for text-filter unit-tests.

Revision history for this message
Michał Sawicz (saviq) wrote :

Yup.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: