BigW Consortium Gitlab

note_policy.rb 357 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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? &&
15
        @subject.noteable.author == @user
16 17 18 19
      can! :resolve_note
    end
  end
end