Commit 152f5743 authored by Serena Fang's avatar Serena Fang

Revert "Merge branch 'sfang-do-not-show-token-name' into 'master'"

This reverts merge request !54022
parent cbd41c03
---
title: Do not expose user name if user is project bot
merge_request: 54022
author:
type: changed
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
module API module API
module Entities module Entities
class UserSafe < Grape::Entity class UserSafe < Grape::Entity
expose :id, :username expose :id, :name, :username
expose :name, unless: ->(user) { user.project_bot? && !options[:current_user].admin?}
end end
end end
end end
...@@ -127,7 +127,7 @@ RSpec.describe 'Project members list' do ...@@ -127,7 +127,7 @@ RSpec.describe 'Project members list' do
it 'does not show form used to change roles and "Expiration date" or the remove user button' do it 'does not show form used to change roles and "Expiration date" or the remove user button' do
visit_members_page visit_members_page
page.within find_username_row(project_bot) do page.within find_member_row(project_bot) do
expect(page).not_to have_button('Maintainer') expect(page).not_to have_button('Maintainer')
expect(page).to have_field('Expiration date', disabled: true) expect(page).to have_field('Expiration date', disabled: true)
expect(page).not_to have_button('Remove member') expect(page).not_to have_button('Remove member')
......
...@@ -35,22 +35,4 @@ RSpec.describe API::Entities::User do ...@@ -35,22 +35,4 @@ RSpec.describe API::Entities::User do
expect(subject[:bot]).to eq(true) expect(subject[:bot]).to eq(true)
end end
end end
context 'with project bot user' do
let(:user) { create(:user, :project_bot) }
context 'when the requester is not an admin' do
it 'does not expose project bot user name' do
expect(subject).not_to include(:name)
end
end
context 'when the requester is an admin' do
let(:current_user) { create(:user, :admin) }
it 'exposes project bot user name' do
expect(subject).to include(:name)
end
end
end
end end
...@@ -41,10 +41,6 @@ module Spec ...@@ -41,10 +41,6 @@ module Spec
find_row(user.name) find_row(user.name)
end end
def find_username_row(user)
find_row(user.username)
end
def find_invited_member_row(email) def find_invited_member_row(email)
find_row(email) find_row(email)
end end
......
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