Skip to content
Snippets Groups Projects
Commit 1cc914f2 authored by Rubén Dávila's avatar Rubén Dávila
Browse files

Show Edit link on sidebar only if current user can update the Issue/MR

parent a697b015
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -12,6 +12,7 @@ v 8.6.0 (unreleased)
- Allow search for logged out users
- Don't show Issues/MRs from archived projects in Groups view
- Increase the notes polling timeout over time (Roberto Dip)
- Fix: Show Edit link on sidebar only if current user can update the Issue/MR
 
v 8.5.4
- Do not cache requests for badges (including builds badge)
Loading
Loading
Loading
Loading
@@ -20,6 +20,12 @@ module IssuablesHelper
base_issuable_scope(issuable).where('iid < ?', issuable.iid).first
end
 
def can_update_issuable?(issuable)
return false unless current_user
can?(current_user, :"update_#{issuable.to_ability_name}", issuable)
end
private
 
def sidebar_gutter_collapsed?
Loading
Loading
Loading
Loading
@@ -30,7 +30,7 @@
.title.hide-collapsed
%label
Assignee
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
- if can_update_issuable?(issuable)
.pull-right
= link_to 'Edit', '#', class: 'edit-link'
.value.hide-collapsed
Loading
Loading
@@ -56,7 +56,7 @@
.title.hide-collapsed
%label
Milestone
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
- if can_update_issuable?(issuable)
.pull-right
= link_to 'Edit', '#', class: 'edit-link'
.value.hide-collapsed
Loading
Loading
@@ -81,7 +81,7 @@
= issuable.labels.count
.title.hide-collapsed
%label Labels
- if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
- if can_update_issuable?(issuable)
.pull-right
= link_to 'Edit', '#', class: 'edit-link'
.value.issuable-show-labels.hide-collapsed
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment