diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-08 00:10:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-08 00:10:08 +0300 |
commit | 3a966afb3ea2ef7a98bdc389e0dc906ef4bf0273 (patch) | |
tree | e22ca72e41a6d2eaca58ac9cc1390e5f8114ac1f /app/presenters | |
parent | 39d41e02dca2139d0bbd88165affd818c9c82fb6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/user_presenter.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb index f201b36346f..0028e6d9ef0 100644 --- a/app/presenters/user_presenter.rb +++ b/app/presenters/user_presenter.rb @@ -2,4 +2,18 @@ class UserPresenter < Gitlab::View::Presenter::Delegated presents :user + + def group_memberships + should_be_private? ? GroupMember.none : user.group_members + end + + def project_memberships + should_be_private? ? ProjectMember.none : user.project_members + end + + private + + def should_be_private? + !can?(current_user, :read_user_profile, user) + end end |