]> cat aescling's git repositories - mastodon.git/commitdiff
Do not hide NSFW media/CW'd text in OpenGraph tags (#6479)
authorEugen Rochko <eugen@zeonfederated.com>
Fri, 16 Feb 2018 03:40:53 +0000 (04:40 +0100)
committerGitHub <noreply@github.com>
Fri, 16 Feb 2018 03:40:53 +0000 (04:40 +0100)
Reasoning: HTML title tag affects everyone. But OpenGraph only affects
when somebody is deliberately sharing the content, usually in an
environment where such content is expected. Hiding the content in
OpenGraph tags results in deceitful previews which inhibit the
shareability of the post.

Example: Somebody writes a clever post about politics but kindly
puts a "uspol" content warning on it. Mastodon users are thankful,
but sharing this post on another platform results in non-Mastodon
users believing the entire contents of the post is "uspol" and not
clicking through/reading and re-sharing.

app/views/stream_entries/_og_description.html.haml
app/views/stream_entries/_og_image.html.haml

index d2fa99e63e581bab48056ba2937cfd9ace14aac1..9c24e0a61b85d39cfb72791a8403d129edfd8164 100644 (file)
@@ -1,4 +1 @@
-- if activity.is_a?(Status) && activity.spoiler_text?
-  = opengraph 'og:description', activity.spoiler_text
-- else
-  = opengraph 'og:description', activity.content
+= opengraph 'og:description', [activity.spoiler_text, activity.text].reject(&:blank?).join("\n\n")
index 1056c174444e0265b86fd33284348836fc4cdb38..bd14ef701e44b28ab066cdf6b69887172aaf415e 100644 (file)
@@ -1,4 +1,4 @@
-- if activity.is_a?(Status) && activity.non_sensitive_with_media?
+- if activity.is_a?(Status) && activity.media_attachments.any?
   - activity.media_attachments.each do |media|
     - if media.image?
       = opengraph 'og:image', full_asset_url(media.file.url(:original))