diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-24 03:09:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-24 03:09:05 +0000 |
commit | 07d0374b204881f2bd64ed897e4bbab19f180cc9 (patch) | |
tree | ed7837a31c0edae5e8ec876626b0bf3ecb3db68c /lib | |
parent | 2ed3b0abccc8de391f1a9de2bc5785d3e0f5b018 (diff) | |
download | gitlab-ce-07d0374b204881f2bd64ed897e4bbab19f180cc9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/discussions.rb | 4 | ||||
-rw-r--r-- | lib/api/helpers/notes_helpers.rb | 2 | ||||
-rw-r--r-- | lib/api/lsif_data.rb | 4 | ||||
-rw-r--r-- | lib/api/notes.rb | 2 | ||||
-rw-r--r-- | lib/banzai/filter/issuable_state_filter.rb | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/lib/api/discussions.rb b/lib/api/discussions.rb index 25d38615c7f..a1cec148aeb 100644 --- a/lib/api/discussions.rb +++ b/lib/api/discussions.rb @@ -230,7 +230,7 @@ module API .fresh # Without RendersActions#prepare_notes_for_rendering, - # Note#cross_reference_not_visible_for? will attempt to render + # Note#system_note_with_references_visible_for? will attempt to render # Markdown references mentioned in the note to see whether they # should be redacted. For notes that reference a commit, this # would also incur a Gitaly call to verify the commit exists. @@ -239,7 +239,7 @@ module API # because notes are redacted if they point to projects that # cannot be accessed by the user. notes = prepare_notes_for_rendering(notes) - notes.select { |n| n.visible_for?(current_user) } + notes.select { |n| n.readable_by?(current_user) } end # rubocop: enable CodeReuse/ActiveRecord end diff --git a/lib/api/helpers/notes_helpers.rb b/lib/api/helpers/notes_helpers.rb index 3c453953e37..bed0345a608 100644 --- a/lib/api/helpers/notes_helpers.rb +++ b/lib/api/helpers/notes_helpers.rb @@ -62,7 +62,7 @@ module API def get_note(noteable, note_id) note = noteable.notes.with_metadata.find(note_id) - can_read_note = note.visible_for?(current_user) + can_read_note = note.readable_by?(current_user) if can_read_note present note, with: Entities::Note diff --git a/lib/api/lsif_data.rb b/lib/api/lsif_data.rb index 63e6eb3ab2d..6513973133a 100644 --- a/lib/api/lsif_data.rb +++ b/lib/api/lsif_data.rb @@ -21,9 +21,9 @@ module API authorize! :download_code, user_project artifact = - @project.job_artifacts + Ci::JobArtifact .with_file_types(['lsif']) - .for_sha(params[:commit_id]) + .for_sha(params[:commit_id], @project.id) .last not_found! unless artifact diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 35eda481a4f..7237fa24bab 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -45,7 +45,7 @@ module API # array returned, but this is really a edge-case. notes = paginate(raw_notes) notes = prepare_notes_for_rendering(notes) - notes = notes.select { |note| note.visible_for?(current_user) } + notes = notes.select { |note| note.readable_by?(current_user) } present notes, with: Entities::Note end # rubocop: enable CodeReuse/ActiveRecord diff --git a/lib/banzai/filter/issuable_state_filter.rb b/lib/banzai/filter/issuable_state_filter.rb index f9d8bf8a1fa..a88629ac105 100644 --- a/lib/banzai/filter/issuable_state_filter.rb +++ b/lib/banzai/filter/issuable_state_filter.rb @@ -18,7 +18,7 @@ module Banzai issuables = extractor.extract([doc]) issuables.each do |node, issuable| - next if !can_read_cross_project? && cross_reference?(issuable) + next if !can_read_cross_project? && cross_referenced?(issuable) if VISIBLE_STATES.include?(issuable.state) && issuable_reference?(node.inner_html, issuable) state = moved_issue?(issuable) ? s_("IssuableStatus|moved") : issuable.state @@ -39,7 +39,7 @@ module Banzai CGI.unescapeHTML(text) == issuable.reference_link_text(project || group) end - def cross_reference?(issuable) + def cross_referenced?(issuable) return true if issuable.project != project return true if issuable.respond_to?(:group) && issuable.group != group |