diff options
Diffstat (limited to 'lib/gitlab/github_import/representation/diff_note.rb')
-rw-r--r-- | lib/gitlab/github_import/representation/diff_note.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/gitlab/github_import/representation/diff_note.rb b/lib/gitlab/github_import/representation/diff_note.rb index 04f53accfeb..883abef9bdb 100644 --- a/lib/gitlab/github_import/representation/diff_note.rb +++ b/lib/gitlab/github_import/representation/diff_note.rb @@ -129,17 +129,7 @@ module Gitlab def discussion_id strong_memoize(:discussion_id) do - if in_reply_to_id.present? - current_discussion_id - else - Discussion.discussion_id( - Struct - .new(:noteable_id, :noteable_type) - .new(merge_request.id, NOTEABLE_TYPE) - ).tap do |discussion_id| - cache_discussion_id(discussion_id) - end - end + (in_reply_to_id.present? && current_discussion_id) || generate_discussion_id end end @@ -160,6 +150,16 @@ module Gitlab side == 'RIGHT' end + def generate_discussion_id + Discussion.discussion_id( + Struct + .new(:noteable_id, :noteable_type) + .new(merge_request.id, NOTEABLE_TYPE) + ).tap do |discussion_id| + cache_discussion_id(discussion_id) + end + end + def cache_discussion_id(discussion_id) Gitlab::Cache::Import::Caching.write(discussion_id_cache_key(note_id), discussion_id) end |