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>2023-11-14 11:41:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-14 11:41:52 +0300
commit585826cb22ecea5998a2c2a4675735c94bdeedac (patch)
tree5b05f0b30d33cef48963609e8a18a4dff260eab3 /lib/gitlab/discussions_diff
parentdf221d036e5d0c6c0ee4d55b9c97f481ee05dee8 (diff)
Add latest changes from gitlab-org/gitlab@16-6-stable-eev16.6.0-rc42
Diffstat (limited to 'lib/gitlab/discussions_diff')
-rw-r--r--lib/gitlab/discussions_diff/file_collection.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/gitlab/discussions_diff/file_collection.rb b/lib/gitlab/discussions_diff/file_collection.rb
index 60b3a1738f1..3d1f7ab86b3 100644
--- a/lib/gitlab/discussions_diff/file_collection.rb
+++ b/lib/gitlab/discussions_diff/file_collection.rb
@@ -25,8 +25,9 @@ module Gitlab
#
# - Highlight cache is written just for uncached diff files
# - The cache content is not updated (there's no need to do so)
- def load_highlight
- ids = highlightable_collection_ids
+ # - Load only the related diff note ids
+ def load_highlight(diff_note_ids: nil)
+ ids = highlightable_collection_ids(diff_note_ids)
return if ids.empty?
cached_content = read_cache(ids)
@@ -47,8 +48,13 @@ module Gitlab
private
- def highlightable_collection_ids
- each.with_object([]) { |file, memo| memo << file.id unless file.resolved_at }
+ def highlightable_collection_ids(diff_note_ids)
+ each.with_object([]) do |file, memo|
+ # We ignore if file is resolved, or not part of the highlight requested notes
+ next if file.resolved_at || (diff_note_ids.present? && diff_note_ids.exclude?(file.diff_note_id))
+
+ memo << file.id
+ end
end
def read_cache(ids)