From 63556a904a52423b5b55dccda6080331763eb0aa Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 22 Jan 2015 22:34:35 +0530 Subject: [PATCH] FIX: full user names were showing up in crawlers and rss feeds in spite enables_names setting being disabled --- app/views/list/list.rss.erb | 4 ++-- app/views/topics/plain.html.erb | 2 +- app/views/topics/show.html.erb | 2 +- app/views/topics/show.rss.erb | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/list/list.rss.erb b/app/views/list/list.rss.erb index afeed83e0..2e48d6737 100644 --- a/app/views/list/list.rss.erb +++ b/app/views/list/list.rss.erb @@ -14,10 +14,10 @@ <% topic_url = Discourse.base_url + topic.relative_url -%> <%= topic.title %> - <%= "no-reply@example.com (@#{topic.user.username}#{" #{topic.user.name}" if topic.user.name.present?})" -%> + <%= "no-reply@example.com (@#{topic.user.username}#{" #{topic.user.name}" if (topic.user.name.present? && SiteSetting.enable_names?)})" -%> <%= topic.category.name %> <%= t('author_wrote', author: link_to(topic.user.name, user_url(topic.user.username_lower))).html_safe %>

+

<%= t('author_wrote', author: link_to("@#{topic.user.username}", user_url(topic.user.username_lower))).html_safe %>

<%= topic.posts.first.cooked.html_safe %>
diff --git a/app/views/topics/plain.html.erb b/app/views/topics/plain.html.erb index 7c852a3b6..88385ff7d 100644 --- a/app/views/topics/plain.html.erb +++ b/app/views/topics/plain.html.erb @@ -11,7 +11,7 @@ <% @topic_view.posts.each do |post| %> <% if post.user %>
- <%= post.user.username %> <%= "(#{post.user.name})" if SiteSetting.display_name_on_posts %> at <%= post.created_at.to_formatted_s(:long_ordinal) %> — #<%= post.post_number %> + <%= post.user.username %> <%= "(#{post.user.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names?) %> at <%= post.created_at.to_formatted_s(:long_ordinal) %> — #<%= post.post_number %>
<% if post.hidden %> diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 42421fb7b..846bdc38c 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -10,7 +10,7 @@ <% if post.user %>
<%= post.user.username %> - <%= "(#{post.user.name})" if SiteSetting.display_name_on_posts %> — + <%= "(#{post.user.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names?) %> — <%= post.created_at.to_formatted_s(:iso8601) %> — #<%= post.post_number %>
diff --git a/app/views/topics/show.rss.erb b/app/views/topics/show.rss.erb index 2e1271b4b..be903c7a2 100644 --- a/app/views/topics/show.rss.erb +++ b/app/views/topics/show.rss.erb @@ -15,10 +15,10 @@ <% next unless post.user %> <%= @topic_view.title %> - <%= "no-reply@example.com (@#{post.user.username}#{" #{post.user.name}" if post.user.name.present?})" -%> + <%= "no-reply@example.com (@#{post.user.username}#{" #{post.user.name}" if (post.user.name.present? && SiteSetting.enable_names?)})" -%> -

<%= t('author_wrote', author: link_to(post.user.name, user_url(post.user.username_lower))).html_safe %>

+

<%= t('author_wrote', author: link_to("@#{post.user.username}", user_url(post.user.username_lower))).html_safe %>

<% if post.hidden %> <%= t('flagging.user_must_edit').html_safe %>