FIX: Narrative bot should ignore action on deleted post

FIX: Narrative bot should ignore action on deleted post
diff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rb
index c321a28..b51e318 100644
--- a/plugins/discourse-narrative-bot/plugin.rb
+++ b/plugins/discourse-narrative-bot/plugin.rb
@@ -204,7 +204,7 @@ after_initialize do
   end
 
   self.add_model_callback(PostAction, :after_commit, on: :create) do
-    if self.user.enqueue_narrative_bot_job?
+    if self.post && self.user.enqueue_narrative_bot_job?
       input =
         case self.post_action_type_id
         when *PostActionType.flag_types_without_custom.values

GitHub
sha: fbd92916

1 Like