Commit 97e6c9b4 authored by Valery Sizov's avatar Valery Sizov

Wrong access level badge on MR comments

parent c867c225
...@@ -26,6 +26,7 @@ v 8.1.0 (unreleased) ...@@ -26,6 +26,7 @@ v 8.1.0 (unreleased)
- Show additions/deletions stats on merge request diff - Show additions/deletions stats on merge request diff
- Remove footer text in emails (Zeger-Jan van de Weg) - Remove footer text in emails (Zeger-Jan van de Weg)
- Ensure code blocks are properly highlighted after a note is updated - Ensure code blocks are properly highlighted after a note is updated
- Fix wrong access level badge on MR comments
v 8.0.3 v 8.0.3
- Fix URL shown in Slack notifications - Fix URL shown in Slack notifications
......
...@@ -135,6 +135,10 @@ class ProjectTeam ...@@ -135,6 +135,10 @@ class ProjectTeam
!!find_member(user_id) !!find_member(user_id)
end end
def human_max_access(user_id)
Gitlab::Access.options.key max_member_access(user_id)
end
def max_member_access(user_id) def max_member_access(user_id)
access = [] access = []
access << project.project_members.find_by(user_id: user_id).try(:access_field) access << project.project_members.find_by(user_id: user_id).try(:access_field)
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
= icon('trash-o') = icon('trash-o')
- unless note.system - unless note.system
- member = note.project.team.find_member(note.author.id) - access = note.project.team.human_max_access(note.author.id)
- if member - if access
%span.note-role.label %span.note-role.label
= member.human_access = access
= link_to_member(note.project, note.author, avatar: false) = link_to_member(note.project, note.author, avatar: false)
......
...@@ -66,4 +66,16 @@ describe ProjectTeam do ...@@ -66,4 +66,16 @@ describe ProjectTeam do
it { expect(project.team.member?(guest)).to be_truthy } it { expect(project.team.member?(guest)).to be_truthy }
end end
end 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")
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