FIX: add noindex header to user summary page.

This commit is contained in:
Vinoth Kannan 2020-07-16 02:32:55 +05:30
parent 24b3996f45
commit 4f4d8d683f
2 changed files with 3 additions and 0 deletions

View File

@ -349,6 +349,8 @@ class UsersController < ApplicationController
@user = fetch_user_from_params(include_inactive: current_user.try(:staff?) || (current_user && SiteSetting.show_inactive_accounts))
raise Discourse::NotFound unless guardian.can_see_profile?(@user)
response.headers['X-Robots-Tag'] = 'noindex'
respond_to do |format|
format.html do
@restrict_fields = guardian.restrict_user_fields?(@user)

View File

@ -2816,6 +2816,7 @@ describe UsersController do
create_post(user: user)
get "/u/#{user.username_lower}/summary.json"
expect(response.headers['X-Robots-Tag']).to eq('noindex')
expect(response.status).to eq(200)
json = response.parsed_body