Prevent exceptions for methods like ProjectTeam#developer? if no membership exists
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
c283fba3b7
commit
a89c590ffe
1 changed files with 4 additions and 4 deletions
|
@ -118,19 +118,19 @@ class ProjectTeam
|
|||
end
|
||||
|
||||
def guest?(user)
|
||||
find_tm(user.id).access_field == Gitlab::Access::GUEST
|
||||
find_tm(user.id).try(:access_field) == Gitlab::Access::GUEST
|
||||
end
|
||||
|
||||
def reporter?(user)
|
||||
find_tm(user.id).access_field == Gitlab::Access::REPORTER
|
||||
find_tm(user.id).try(:access_field) == Gitlab::Access::REPORTER
|
||||
end
|
||||
|
||||
def developer?(user)
|
||||
find_tm(user.id).access_field == Gitlab::Access::DEVELOPER
|
||||
find_tm(user.id).try(:access_field) == Gitlab::Access::DEVELOPER
|
||||
end
|
||||
|
||||
def master?(user)
|
||||
find_tm(user.id).access_field == Gitlab::Access::MASTER
|
||||
find_tm(user.id).try(:access_field) == Gitlab::Access::MASTER
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue