FIX: Update node_id after mirroring comment

FIX: Update node_id after mirroring comment

diff --git a/lib/discourse_code_review/github_pr_syncer.rb b/lib/discourse_code_review/github_pr_syncer.rb
index ce2dc67..a26beea 100644
--- a/lib/discourse_code_review/github_pr_syncer.rb
+++ b/lib/discourse_code_review/github_pr_syncer.rb
@@ -285,20 +285,24 @@ module DiscourseCodeReview
             post.raw
           ].join("\n")
 
-          if thread_id
-            @pr_service.create_review_comment(
-              repo_name,
-              issue_number,
-              github_post_contents,
-              thread_id
-            )
-          else
-            @pr_service.create_issue_comment(
-              repo_name,
-              issue_number,
-              github_post_contents
-            )
-          end
+          response =
+            if thread_id
+              @pr_service.create_review_comment(
+                repo_name,
+                issue_number,
+                github_post_contents,
+                thread_id
+              )
+            else
+              @pr_service.create_issue_comment(
+                repo_name,
+                issue_number,
+                github_post_contents
+              )
+            end
+
+          post.custom_fields[GITHUB_NODE_ID] = response[:node_id]
+          post.save_custom_fields
         end
       end
     end

GitHub sha: 6513e377

This needs a test too

1 Like

DEV: Added tests for mirroring PR posts to github as comments