From 8205f655732d46603ab46f89c2843c2b10e7b0e0 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 6589239be3..d5d7419f08 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 %>
<% if post.hidden %>
diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb
index 0dd0088e60..3a5d447970 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 2e1271b4b9..be903c7a29 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 %>