Commit 764a0635 authored by Takuya Noguchi's avatar Takuya Noguchi

Remove users#show.json completely

See also the previous merge request 48712:
7https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48712Signed-off-by: default avatarTakuya Noguchi <takninnovationresearch@gmail.com>
parent 3eeafcdf
......@@ -33,10 +33,8 @@ class UsersController < ApplicationController
end
format.json do
# In 13.8, this endpoint will be removed:
# https://gitlab.com/gitlab-org/gitlab/-/issues/289972
load_events
pager_json("events/_events", @events.count, events: @events)
msg = "This endpoint is deprecated. Use %s instead." % user_activity_path
render json: { message: msg }, status: :not_found
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
end
end
context 'json with events' do
context 'requested in json format' do
let(:project) { create(:project) }
before do
......@@ -86,31 +86,13 @@ RSpec.describe UsersController do
sign_in(user)
end
it 'loads events' do
it 'returns 404 with deprecation message' do
# Requesting "/username?format=json" instead of "/username.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(Gitlab::Json.parse(response.body)['count']).to eq(1)
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)
expect(Gitlab::Json.parse(response.body)['message']).to include('This endpoint is deprecated.')
end
end
end
......@@ -183,7 +165,7 @@ RSpec.describe UsersController do
end
end
context 'json with events' do
context 'requested in json format' do
let(:project) { create(:project) }
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