Added html2text convert for desktop notifications.
This commit is contained in:
parent
320fdc1679
commit
84894944a7
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -84,6 +84,11 @@ test("html2text", function() {
|
|||
result = App.Utils.html2text(source)
|
||||
equal(result, should, source)
|
||||
|
||||
source = "<div>Some & <Value></div>"
|
||||
should = "Some & <Value>"
|
||||
result = App.Utils.html2text(source)
|
||||
equal(result, should, source)
|
||||
|
||||
source = "<div>Some</div><div><b>Value</b></div>"
|
||||
should = "Some\n<b>Value</b>"
|
||||
result = App.Utils.html2text(source)
|
||||
|
|
Loading…
Reference in a new issue