Commit dea6b6a8 authored by Sean McGivern's avatar Sean McGivern

Merge branch '289972-remove-users-show-json-completely' into 'master'

Remove users#show.json completely

See merge request gitlab-org/gitlab!49670
parents ae349032 764a0635
...@@ -33,10 +33,8 @@ class UsersController < ApplicationController ...@@ -33,10 +33,8 @@ class UsersController < ApplicationController
end end
format.json do format.json do
# In 13.8, this endpoint will be removed: msg = "This endpoint is deprecated. Use %s instead." % user_activity_path
# https://gitlab.com/gitlab-org/gitlab/-/issues/289972 render json: { message: msg }, status: :not_found
load_events
pager_json("events/_events", @events.count, events: @events)
end end
end end
end end
......
---
title: Remove users#show.json completely
merge_request: 49670
author: Takuya Noguchi
type: other
...@@ -76,7 +76,7 @@ RSpec.describe UsersController do ...@@ -76,7 +76,7 @@ RSpec.describe UsersController do
end end
end end
context 'json with events' do context 'requested in json format' do
let(:project) { create(:project) } let(:project) { create(:project) }
before do before do
...@@ -86,31 +86,13 @@ RSpec.describe UsersController do ...@@ -86,31 +86,13 @@ RSpec.describe UsersController do
sign_in(user) sign_in(user)
end end
it 'loads events' do it 'returns 404 with deprecation message' do
# Requesting "/username?format=json" instead of "/username.json" # Requesting "/username?format=json" instead of "/username.json"
get user_url user.username, params: { format: :json } get user_url user.username, params: { format: :json }
expect(response).to have_gitlab_http_status(:not_found)
expect(response.media_type).to eq('application/json') expect(response.media_type).to eq('application/json')
expect(Gitlab::Json.parse(response.body)['count']).to eq(1) expect(Gitlab::Json.parse(response.body)['message']).to include('This endpoint is deprecated.')
end
it 'hides events if the user cannot read cross project' do
allow(Ability).to receive(:allowed?).and_call_original
expect(Ability).to receive(:allowed?).with(user, :read_cross_project) { false }
get user_url user.username, params: { format: :json }
expect(response.media_type).to eq('application/json')
expect(Gitlab::Json.parse(response.body)['count']).to eq(0)
end
it 'hides events if the user has a private profile' do
Gitlab::DataBuilder::Push.build_sample(project, private_user)
get user_url private_user.username, params: { format: :json }
expect(response.media_type).to eq('application/json')
expect(Gitlab::Json.parse(response.body)['count']).to eq(0)
end end
end end
end end
...@@ -183,7 +165,7 @@ RSpec.describe UsersController do ...@@ -183,7 +165,7 @@ RSpec.describe UsersController do
end end
end end
context 'json with events' do context 'requested in json format' do
let(:project) { create(:project) } let(:project) { create(:project) }
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment