summaryrefslogtreecommitdiff
path: root/app/policies/note_policy.rb
blob: 83847466ee23ef3e35ce1b79a31f400961c8efd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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? &&
       @subject.noteable.author == @user
      can! :resolve_note
    end
  end
end