Commit c58a02e8 authored by Douwe Maan's avatar Douwe Maan

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

Allow `ProjectTeam#human_max_access` to return "Owner"



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