2016-08-16 16:08:14 -04:00
|
|
|
class NotePolicy < BasePolicy
|
|
|
|
def rules
|
|
|
|
delegate! @subject.project
|
|
|
|
|
|
|
|
return unless @user
|
|
|
|
|
|
|
|
if @subject.author == @user
|
|
|
|
can! :read_note
|
|
|
|
can! :update_note
|
|
|
|
can! :admin_note
|
|
|
|
can! :resolve_note
|
|
|
|
end
|
|
|
|
|
|
|
|
if @subject.for_merge_request? &&
|
2016-12-15 17:14:20 -05:00
|
|
|
@subject.noteable.author == @user
|
2016-08-16 16:08:14 -04:00
|
|
|
can! :resolve_note
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|