summaryrefslogtreecommitdiff
path: root/app/models/project_team.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-04 12:56:03 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-04 12:56:03 +0300
commita89c590ffef54c9ff4c790b5d91a8afe68b1ee42 (patch)
treec563f7f007268c45bc88a6c32416ec176e6b0f15 /app/models/project_team.rb
parentc283fba3b7e9fb89ae2ed77597adee2700982718 (diff)
downloadgitlab-ce-a89c590ffef54c9ff4c790b5d91a8afe68b1ee42.tar.gz
Prevent exceptions for methods like ProjectTeam#developer? if no membership exists
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/project_team.rb')
-rw-r--r--app/models/project_team.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/project_team.rb b/app/models/project_team.rb
index 639f78dcd3f..cc8bb60aac4 100644
--- a/app/models/project_team.rb
+++ b/app/models/project_team.rb
@@ -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