Prevent award_emoji to notes not visible to user
When the parent noteable is not visible to the user (e.g. confidential) we prevent the user from adding emoji reactions to notes
This commit is contained in:
parent
6c0758f69b
commit
9f67b886b2
3 changed files with 8 additions and 0 deletions
|
@ -18,6 +18,7 @@ class NotePolicy < BasePolicy
|
|||
prevent :read_note
|
||||
prevent :admin_note
|
||||
prevent :resolve_note
|
||||
prevent :award_emoji
|
||||
end
|
||||
|
||||
rule { is_author }.policy do
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Prevent awarding emojis to notes whose parent is not visible to user
|
||||
merge_request:
|
||||
author:
|
||||
type: security
|
|
@ -28,6 +28,7 @@ describe NotePolicy, mdoels: true do
|
|||
expect(policy).to be_disallowed(:admin_note)
|
||||
expect(policy).to be_disallowed(:resolve_note)
|
||||
expect(policy).to be_disallowed(:read_note)
|
||||
expect(policy).to be_disallowed(:award_emoji)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,6 +41,7 @@ describe NotePolicy, mdoels: true do
|
|||
expect(policy).to be_allowed(:admin_note)
|
||||
expect(policy).to be_allowed(:resolve_note)
|
||||
expect(policy).to be_allowed(:read_note)
|
||||
expect(policy).to be_allowed(:award_emoji)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue