about summary refs log tree commit diff
path: root/app/serializers
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-23 21:44:27 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-08-23 21:44:27 +0200
commit7786e1357bbe456243679c91f88679cdd260fa8f (patch)
tree5bb13cc75a41978fb4209c7ddd748454d1d67887 /app/serializers
parentf9b23a5d6247445ea5b70b431c934a4bb99213bc (diff)
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
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/web/notification_serializer.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/serializers/web/notification_serializer.rb b/app/serializers/web/notification_serializer.rb
index 43ba4d92a..ee83ec8b2 100644
--- a/app/serializers/web/notification_serializer.rb
+++ b/app/serializers/web/notification_serializer.rb
@@ -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