Added html2text convert for desktop notifications.

This commit is contained in:
Martin Edenhofer 2016-02-23 15:46:48 +01:00
parent 320fdc1679
commit 84894944a7
2 changed files with 6 additions and 1 deletions

View file

@ -154,7 +154,7 @@ class App.OnlineNotificationWidget extends App.Controller
title = item.objectNative.activityMessage(item)
else
title = "Need objectNative in item #{item.object}.find(#{item.o_id})"
title = title.replace(/<.+?>/g, '"')
title = App.Utils.html2text(title.replace(/<.+?>/g, '"'))
@notifyDesktop(
url: item.link
title: title

View file

@ -84,6 +84,11 @@ test("html2text", function() {
result = App.Utils.html2text(source)
equal(result, should, source)
source = "<div>Some &amp; &lt;Value&gt;</div>"
should = "Some & <Value>"
result = App.Utils.html2text(source)
equal(result, should, source)
source = "<div>Some</div><div>&lt;b&gt;Value&lt;/b&gt;</div>"
should = "Some\n<b>Value</b>"
result = App.Utils.html2text(source)