2016-09-29 09:46:39 +05:30
|
|
|
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? &&
|
2017-08-17 22:00:37 +05:30
|
|
|
@subject.noteable.author == @user
|
2016-09-29 09:46:39 +05:30
|
|
|
can! :resolve_note
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|