diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-06-16 09:54:53 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-06-16 09:54:53 +0000 |
commit | 077e32740c150cb4216f5ecf74229df159dceea0 (patch) | |
tree | 5b4c2bccda21fb1847c304371634e9e11760917c /app/views/shared | |
parent | 5b4e99387a055b196fc89cb96b6c08e9d90e8404 (diff) | |
parent | b21980bff48de425a3994cb3914650d06d48e486 (diff) | |
download | gitlab-ce-077e32740c150cb4216f5ecf74229df159dceea0.tar.gz |
Merge branch 'backport-view-condition-improvement-from-ee-460' into 'master'
Fix permission checks in member row (backport from gitlab-org/gitlab-ee!460)
## What does this MR do?
It improves the check we use to display or not the members' access and controls in the members list.
## Are there points in the code the reviewer needs to double check?
No, I replaced an helper with just a permission check so I think it's a better solution.
## Why was this MR needed?
There were a spec failure in gitlab-org/gitlab-ee!460 because of the refactor done in the "request access" MR.
## What are the relevant issue numbers?
None.
## Does this MR meet the acceptance criteria?
- No CHANGELOG needed
- [x] Tests
- [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !4670
Diffstat (limited to 'app/views/shared')
-rw-r--r-- | app/views/shared/members/_member.html.haml | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/views/shared/members/_member.html.haml b/app/views/shared/members/_member.html.haml index c69d4cbfbe3..0191814849a 100644 --- a/app/views/shared/members/_member.html.haml +++ b/app/views/shared/members/_member.html.haml @@ -1,4 +1,5 @@ -- show_roles = local_assigns.fetch(:show_roles, true) +- default_show_roles = can?(current_user, action_member_permission(:update, member), member) || can?(current_user, action_member_permission(:destroy, member), member) +- show_roles = local_assigns.fetch(:show_roles, default_show_roles) - show_controls = local_assigns.fetch(:show_controls, true) - user = member.user @@ -36,7 +37,7 @@ method: :post, class: 'btn-xs btn' - - if show_roles && can_see_member_roles?(source: member.source, user: current_user) + - if show_roles %span.pull-right %strong= member.human_access - if show_controls |