summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 03:09:05 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-24 03:09:05 +0000
commit07d0374b204881f2bd64ed897e4bbab19f180cc9 (patch)
treeed7837a31c0edae5e8ec876626b0bf3ecb3db68c /lib/api
parent2ed3b0abccc8de391f1a9de2bc5785d3e0f5b018 (diff)
downloadgitlab-ce-07d0374b204881f2bd64ed897e4bbab19f180cc9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/discussions.rb4
-rw-r--r--lib/api/helpers/notes_helpers.rb2
-rw-r--r--lib/api/lsif_data.rb4
-rw-r--r--lib/api/notes.rb2
4 files changed, 6 insertions, 6 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