0
0
Fork 0

Only display web push notifications after API call (fixes #7902) (#8396)

* Only display web push notifications after API call (fixes #7902)

* Decode then truncate instead of truncating then decoding in webpush serializer
This commit is contained in:
ThibG 2018-08-23 21:44:27 +02:00 committed by Eugen Rochko
parent f9b23a5d62
commit 7786e1357b
2 changed files with 13 additions and 11 deletions

View file

@ -33,7 +33,7 @@ class Web::NotificationSerializer < ActiveModel::Serializer
end
def body
str = truncate(strip_tags(object.target_status&.spoiler_text&.presence || object.target_status&.text || object.from_account.note), length: 140)
HTMLEntities.new.decode(str.to_str) # Do not encode entities, since this value will not be used in HTML
str = strip_tags(object.target_status&.spoiler_text&.presence || object.target_status&.text || object.from_account.note)
truncate(HTMLEntities.new.decode(str.to_str), length: 140) # Do not encode entities, since this value will not be used in HTML
end
end