Commit 554d9bf6 authored by Douwe Maan's avatar Douwe Maan Committed by Rémy Coutable

Merge branch 'rs-show-owner-label' into 'master'

Allow `ProjectTeam#human_max_access` to return "Owner"



See merge request !2881
parent 6eacfa99
......@@ -136,7 +136,7 @@ class ProjectTeam
end
def human_max_access(user_id)
Gitlab::Access.options.key max_member_access(user_id)
Gitlab::Access.options_with_owner.key(max_member_access(user_id))
end
# This method assumes project and group members are eager loaded for optimal
......
......@@ -68,14 +68,24 @@ describe ProjectTeam, models: true do
end
describe "#human_max_access" do
it "return master role" do
user = create :user
group = create :group
group.add_users([user.id], GroupMember::MASTER)
project = create(:project, namespace: group)
project.team << [user, :guest]
expect(project.team.human_max_access(user.id)).to eq("Master")
it 'returns Master role' do
user = create(:user)
group = create(:group)
group.add_master(user)
project = build_stubbed(:empty_project, namespace: group)
expect(project.team.human_max_access(user.id)).to eq 'Master'
end
it 'returns Owner role' do
user = create(:user)
group = create(:group)
group.add_owner(user)
project = build_stubbed(:empty_project, namespace: group)
expect(project.team.human_max_access(user.id)).to eq 'Owner'
end
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