FIX: Add the comment in the correct line of the commit

FIX: Add the comment in the correct line of the commit

diff --git a/lib/discourse_code_review/importer.rb b/lib/discourse_code_review/importer.rb
index 6cea87f..4bffdc2 100644
--- a/lib/discourse_code_review/importer.rb
+++ b/lib/discourse_code_review/importer.rb
@@ -235,13 +235,17 @@ module DiscourseCodeReview
           MD
         end
 
+        custom_fields = { DiscourseCodeReview::GithubId => comment[:id] }
+        custom_fields[DiscourseCodeReview::CommentPath] = comment[:path] if comment[:path].present?
+        custom_fields[DiscourseCodeReview::CommentPosition] = comment[:position] if comment[:position].present?
+
         PostCreator.create!(
           user,
           raw: context + comment[:body],
           skip_validations: true,
           created_at: comment[:created_at],
           topic_id: topic_id,
-          custom_fields: { DiscourseCodeReview::GithubId => comment[:id] }
+          custom_fields: custom_fields
         )
       end
     end
diff --git a/plugin.rb b/plugin.rb
index 57d1a08..8b8f25b 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -77,6 +77,8 @@ after_initialize do
     CommitHash = 'commit hash'
     GithubId = 'github id'
     GithubLogin = 'github login'
+    CommentPath = 'comment path'
+    CommentPosition = 'comment position'
 
     def self.octokit_client
       client = Octokit::Client.new
@@ -113,9 +115,17 @@ after_initialize do
       if !post.custom_fields[DiscourseCodeReview::GithubId] && post.user
         if token = post.user.custom_fields[DiscourseCodeReview::UserToken]
           client = Octokit::Client.new(access_token: token)
+          path, position = begin
+            fields = post.reply_to_post&.custom_fields
+            if fields.present? && fields[DiscourseCodeReview::CommentPath].present? && fields[DiscourseCodeReview::CommentPosition].present?
+              [fields[DiscourseCodeReview::CommentPath], fields[DiscourseCodeReview::CommentPosition]]
+            else
+              [nil, nil]
+            end
+          end
 
           if repo = post.topic.category.custom_fields[DiscourseCodeReview::Importer::GithubRepoName]
-            comment = client.create_commit_comment(repo, hash, post.raw)
+            comment = client.create_commit_comment(repo, hash, post.raw, path, nil, position)
             post.custom_fields[DiscourseCodeReview::GithubId] = comment.id
             post.save_custom_fields
           end

GitHub sha: a1fda019