]> cat aescling's git repositories - mastodon.git/commitdiff
Fix #537 - opengraph description should display spoiler text when present
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 26 Jan 2017 02:45:14 +0000 (03:45 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 26 Jan 2017 02:45:14 +0000 (03:45 +0100)
app/views/stream_entries/show.html.haml

index d106173d2e553c8e3183880808a73fb586fbbae7..6bad457051b7633d29cfc9dcd1291d4c7ee9c9b1 100644 (file)
@@ -5,7 +5,11 @@
   %meta{ property: 'og:site_name', content: 'Mastodon' }/
   %meta{ property: 'og:type', content: 'article' }/
   %meta{ property: 'og:title', content: "#{@account.username} on #{Rails.configuration.x.local_domain}" }/
-  %meta{ property: 'og:description', content: @stream_entry.activity.content }/
+
+  - if @stream_entry.activity.is_a?(Status) && !@stream_entry.activity.spoiler_text.blank?
+    %meta{ property: 'og:description', content: @stream_entry.activity.spoiler_text }/
+  - else
+    %meta{ property: 'og:description', content: @stream_entry.activity.content }/
 
   - if @stream_entry.activity.is_a?(Status) && @stream_entry.activity.media_attachments.size > 0
     %meta{ property: 'og:image', content: full_asset_url(@stream_entry.activity.media_attachments.first.file.url(:small)) }/