0
0
Fork 0

Change RSS feeds (#18356)

* Change RSS feeds

- Use date and time for titles instead of ellipsized text
- Use full content in body, even when there is a content warning
- Use media extensions

* Change feed icons and add width and height attributes to custom emojis

* Fix custom emoji animate on hover breaking

* Fix tests
This commit is contained in:
Eugen Rochko 2022-05-09 07:43:08 +02:00 committed by GitHub
parent f17e73da09
commit 2b8dc58b7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 311 additions and 307 deletions

45
app/lib/rss/item.rb Normal file
View file

@ -0,0 +1,45 @@
# frozen_string_literal: true
class RSS::Item < RSS::Element
def initialize
super()
@root = create_element('item')
end
def title(str)
append_element('title', str)
end
def link(str)
append_element('guid', str) do |guid|
guid['isPermaLink'] = 'true'
end
append_element('link', str)
end
def pub_date(date)
append_element('pubDate', date.to_formatted_s(:rfc822))
end
def description(str)
append_element('description', str)
end
def category(str)
append_element('category', str)
end
def enclosure(url, type, size)
append_element('enclosure') do |enclosure|
enclosure['url'] = url
enclosure['length'] = size
enclosure['type'] = type
end
end
def media_content(url, type, size, &block)
@root << RSS::MediaContent.with(url, type, size, &block)
end
end