mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FEATURE: add noindex header to badges, groups, and /my pages (#9736)
This commit is contained in:
parent
29842e682b
commit
07b728c5e5
@ -2,6 +2,7 @@
|
||||
|
||||
class BadgesController < ApplicationController
|
||||
skip_before_action :check_xhr, only: [:index, :show]
|
||||
after_action :add_noindex_header
|
||||
|
||||
def index
|
||||
raise Discourse::NotFound unless SiteSetting.enable_badges
|
||||
|
@ -15,6 +15,7 @@ class GroupsController < ApplicationController
|
||||
|
||||
skip_before_action :preload_json, :check_xhr, only: [:posts_feed, :mentions_feed]
|
||||
skip_before_action :check_xhr, only: [:show]
|
||||
after_action :add_noindex_header
|
||||
|
||||
TYPE_FILTERS = {
|
||||
my: Proc.new { |groups, user|
|
||||
|
@ -48,7 +48,7 @@ class UsersController < ApplicationController
|
||||
:admin_login,
|
||||
:confirm_admin]
|
||||
|
||||
after_action :add_noindex_header, only: [:show]
|
||||
after_action :add_noindex_header, only: [:show, :my_redirect]
|
||||
|
||||
def index
|
||||
end
|
||||
|
@ -17,6 +17,7 @@ describe BadgesController do
|
||||
expect(response.status).to eq(200)
|
||||
parsed = response.parsed_body
|
||||
expect(parsed["badges"].length).to eq(Badge.enabled.count)
|
||||
expect(response.headers['X-Robots-Tag']).to eq('noindex')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -364,6 +364,7 @@ describe GroupsController do
|
||||
|
||||
expect(body['group']['id']).to eq(group.id)
|
||||
expect(body['extras']["visible_group_names"]).to eq([group.name])
|
||||
expect(response.headers['X-Robots-Tag']).to eq('noindex')
|
||||
end
|
||||
|
||||
context 'as an admin' do
|
||||
|
@ -2433,6 +2433,7 @@ describe UsersController do
|
||||
it "redirects if the user is not logged in" do
|
||||
get "/my/wat.json"
|
||||
expect(response).to be_redirect
|
||||
expect(response.headers['X-Robots-Tag']).to eq('noindex')
|
||||
end
|
||||
|
||||
context "when the user is logged in" do
|
||||
|
Loading…
Reference in New Issue
Block a user