Use <summary> to encode content warnings instead
This commit is contained in:
		
							parent
							
								
									0430f7c0fa
								
							
						
					
					
						commit
						3beb24ad55
					
				
					 4 changed files with 5 additions and 8 deletions
				
			
		|  | @ -42,9 +42,8 @@ module AtomBuilderHelper | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def content(xml, content, warning = nil) |   def content(xml, content, warning = nil) | ||||||
|     extra = { type: 'html' } |     xml.summary(warning) unless warning.blank? | ||||||
|     extra[:warning] = warning unless warning.blank? |     xml.content({ type: 'html' }, content) unless content.blank? | ||||||
|     xml.content(extra, content) unless content.blank? |  | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   def title(xml, title) |   def title(xml, title) | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ class PostStatusService < BaseService | ||||||
|     status = account.statuses.create!(text: text, |     status = account.statuses.create!(text: text, | ||||||
|                                       thread: in_reply_to, |                                       thread: in_reply_to, | ||||||
|                                       sensitive: options[:sensitive], |                                       sensitive: options[:sensitive], | ||||||
|                                       spoiler_text: options[:spoiler_text], |                                       spoiler_text: options[:spoiler_text] || '', | ||||||
|                                       visibility: options[:visibility], |                                       visibility: options[:visibility], | ||||||
|                                       application: options[:application]) |                                       application: options[:application]) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -225,7 +225,7 @@ class ProcessFeedService < BaseService | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def content_warning(xml = @xml) |     def content_warning(xml = @xml) | ||||||
|       xml.at_xpath('./xmlns:content', xmlns: TagManager::XMLNS)['warning'] |       xml.at_xpath('./xmlns:summary', xmlns: TagManager::XMLNS)&.content || '' | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     def published(xml = @xml) |     def published(xml = @xml) | ||||||
|  |  | ||||||
|  | @ -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 `<category term="nsfw" />` on the Atom entry | 2. Statuses can be marked as containing sensitive (or not safe for work) media. This is symbolized by a `<category term="nsfw" />` 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 `<content />` tag of the Atom entry, e.g. `<content type="html" warning="This post talks about the ending to 6th sense">Lorem ipsum dolor sit amet</content>` | 3. Statuses that are intended to be listed publicly on e.g. "whole known network" or "public" timelines contain a `<link rel="mentioned" href="http://activityschema.org/collection/public" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection"/>`. Conversely, statuses which do not contain that, are intended to be low key, unlisted | ||||||
| 
 |  | ||||||
| 4. Statuses that are intended to be listed publicly on e.g. "whole known network" or "public" timelines contain a `<link rel="mentioned" href="http://activityschema.org/collection/public" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection"/>`. Conversely, statuses which do not contain that, are intended to be low key, unlisted |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue