Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 00:09:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-18 00:09:16 +0300
commit154b9bae142ba15fec753f44327654595094b879 (patch)
tree027f8ae024961778d5b00c77a72fe302f985d4f3 /app/policies/note_policy.rb
parent2c156e3c7bbade01c36eee18327f1ced6eebea79 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies/note_policy.rb')
-rw-r--r--app/policies/note_policy.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/policies/note_policy.rb b/app/policies/note_policy.rb
index 32be89439ba..82ebf6ba6a5 100644
--- a/app/policies/note_policy.rb
+++ b/app/policies/note_policy.rb
@@ -12,6 +12,7 @@ class NotePolicy < BasePolicy
condition(:editable, scope: :subject) { @subject.editable? }
condition(:can_read_noteable) { can?(:"read_#{@subject.noteable_ability_name}") }
+ condition(:commit_is_deleted) { @subject.for_commit? && @subject.noteable.blank? }
condition(:is_visible) { @subject.system_note_with_references_visible_for?(@user) }
@@ -25,12 +26,16 @@ class NotePolicy < BasePolicy
# If user can't read the issue/MR/etc then they should not be allowed to do anything to their own notes
rule { ~can_read_noteable }.policy do
- prevent :read_note
prevent :admin_note
prevent :resolve_note
prevent :award_emoji
end
+ # Special rule for deleted commits
+ rule { ~(can_read_noteable | commit_is_deleted) }.policy do
+ prevent :read_note
+ end
+
rule { is_author }.policy do
enable :read_note
enable :admin_note