From 3beb24ad5544723348d1e23a99c2b5ab1e26ae1f Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 25 Jan 2017 16:53:30 +0100 Subject: [PATCH] Use to encode content warnings instead --- app/helpers/atom_builder_helper.rb | 5 ++--- app/services/post_status_service.rb | 2 +- app/services/process_feed_service.rb | 2 +- docs/Extensions.md | 4 +--- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/helpers/atom_builder_helper.rb b/app/helpers/atom_builder_helper.rb index f17b4cc72f..c08d80ea0e 100644 --- a/app/helpers/atom_builder_helper.rb +++ b/app/helpers/atom_builder_helper.rb @@ -42,9 +42,8 @@ module AtomBuilderHelper end def content(xml, content, warning = nil) - extra = { type: 'html' } - extra[:warning] = warning unless warning.blank? - xml.content(extra, content) unless content.blank? + xml.summary(warning) unless warning.blank? + xml.content({ type: 'html' }, content) unless content.blank? end def title(xml, title) diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 91b654603a..979941c84c 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -16,7 +16,7 @@ class PostStatusService < BaseService status = account.statuses.create!(text: text, thread: in_reply_to, sensitive: options[:sensitive], - spoiler_text: options[:spoiler_text], + spoiler_text: options[:spoiler_text] || '', visibility: options[:visibility], application: options[:application]) diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb index 4576b43214..6265341767 100644 --- a/app/services/process_feed_service.rb +++ b/app/services/process_feed_service.rb @@ -225,7 +225,7 @@ class ProcessFeedService < BaseService end def content_warning(xml = @xml) - xml.at_xpath('./xmlns:content', xmlns: TagManager::XMLNS)['warning'] + xml.at_xpath('./xmlns:summary', xmlns: TagManager::XMLNS)&.content || '' end def published(xml = @xml) diff --git a/docs/Extensions.md b/docs/Extensions.md index a082a777d2..a3d64ebf1c 100644 --- a/docs/Extensions.md +++ b/docs/Extensions.md @@ -12,6 +12,4 @@ Some functionality in Mastodon required some additions to the protocols to enabl 2. Statuses can be marked as containing sensitive (or not safe for work) media. This is symbolized by a `` on the Atom entry -3. Statuses can have a content warning (used e.g. for warning about spoilers in the text). It is stored in the `warning` attribute on the `` tag of the Atom entry, e.g. `Lorem ipsum dolor sit amet` - -4. Statuses that are intended to be listed publicly on e.g. "whole known network" or "public" timelines contain a ``. Conversely, statuses which do not contain that, are intended to be low key, unlisted +3. Statuses that are intended to be listed publicly on e.g. "whole known network" or "public" timelines contain a ``. Conversely, statuses which do not contain that, are intended to be low key, unlisted