diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-06-16 12:54:53 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-06-17 21:13:51 +0300 |
commit | 4a1b42b0c05e27062c9068948971c249ea18c4d4 (patch) | |
tree | d46f262c4dbc7333c8e3680f5c8d7c41e67d484d /app/views/shared/members | |
parent | 30c202632727baea409527fa05df6e9458ce6427 (diff) |
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/members')
-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 |