FIX: Don't mirror PR if the post is from a PM (#24)

FIX: Don’t mirror PR if the post is from a PM (#24)

diff --git a/lib/discourse_code_review/github_pr_syncer.rb b/lib/discourse_code_review/github_pr_syncer.rb
index da578bc..d2b2edc 100644
--- a/lib/discourse_code_review/github_pr_syncer.rb
+++ b/lib/discourse_code_review/github_pr_syncer.rb
@@ -121,6 +121,7 @@ module DiscourseCodeReview
       user = post.user
 
       conditions = [
+        topic.regular?,
         post.post_number > 1,
         post.post_type == Post.types[:regular],
         post.custom_fields[GITHUB_NODE_ID].nil?
diff --git a/spec/lib/github_pr_syncer_spec.rb b/spec/lib/github_pr_syncer_spec.rb
new file mode 100644
index 0000000..3aa3ab9
--- /dev/null
+++ b/spec/lib/github_pr_syncer_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe DiscourseCodeReview::GithubPRSyncer do
+  it 'does nothing if the topic is a PM' do
+    pm_post = Fabricate(:post, post_number: 2, topic: Fabricate(:private_message_topic))
+
+    syncer = described_class.new(nil, nil)
+
+    expect(syncer.mirror_pr_post(pm_post)).to be_nil
+  end
+end

GitHub sha: 0a0ea9ef

This commit appears in #24 which was approved by eviltrout. It was merged by romanrizzi.