FIX: do not show spoiler content in RSS (#14277)

This commit updates the RSS post content to use email formatting. Many
plugins are using the `reduce_cooked` method to format content that is
not displayed outside of Discourse application. Using email formatting
also strips the secure media and various other things that is only meant
for Discourse client side application.
This commit is contained in:
Arpit Jalan 2021-09-08 20:19:43 +05:30 committed by GitHub
parent 95b15acb1e
commit 01341f33e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@
<category><%= topic.category.name %></category>
<description><![CDATA[
<%- if first_post = topic.ordered_posts.first %>
<%= first_post.cooked.html_safe %>
<%= PrettyText.format_for_email(first_post.cooked, first_post).html_safe %>
<%- end %>
<p><small><%= t 'rss_num_posts', count: topic.posts_count %> - <%= t 'rss_num_participants', count: topic.participant_count %></small></p>
<p><%= link_to t('read_full_topic'), topic_url %></p>

View File

@ -11,7 +11,7 @@
<item>
<title><%= post.topic.title %></title>
<dc:creator><![CDATA[<%= "@#{post.user.username}#{" #{post.user.name}" if (post.user.name.present? && SiteSetting.enable_names?)}" -%>]]></dc:creator>
<description><![CDATA[ <%= post.cooked.html_safe %> ]]></description>
<description><![CDATA[ <%= PrettyText.format_for_email(post.cooked, post).html_safe %> ]]></description>
<link><%= Discourse.base_url + post.url %></link>
<pubDate><%= post.created_at.rfc2822 %></pubDate>
<guid isPermaLink="false"><%= Discourse.current_hostname %>-post-<%= post.id %></guid>

View File

@ -21,7 +21,7 @@
<% if post.hidden %>
<%= t('flagging.user_must_edit').html_safe %>
<% else %>
<%= post.cooked.html_safe %>
<%= PrettyText.format_for_email(post.cooked, post).html_safe %>
<% end %>
<p><%= link_to t('read_full_topic'), post_url %></p>
]]></description>