]> cat aescling's git repositories - mastodon.git/commitdiff
Do not encode HTML entities in initial Web Push payload body (#7592)
authorEugen Rochko <eugen@zeonfederated.com>
Tue, 22 May 2018 16:12:45 +0000 (18:12 +0200)
committerGitHub <noreply@github.com>
Tue, 22 May 2018 16:12:45 +0000 (18:12 +0200)
app/serializers/web/notification_serializer.rb

index f3c4ffc477c85421e8cf3a5f245d9044b11f5f63..43ba4d92a26c2d86ad7429c080875cafa635fce2 100644 (file)
@@ -33,6 +33,7 @@ class Web::NotificationSerializer < ActiveModel::Serializer
   end
 
   def body
-    truncate(strip_tags(object.target_status&.spoiler_text&.presence || object.target_status&.text || object.from_account.note), length: 140)
+    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
   end
 end