From 4840060568e8066ed19ed35eb81fb4bfb97fea88 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 7 Nov 2024 23:51:17 +0900 Subject: [PATCH] DEV: fix flakey by duplicating constant (#29636) This is because rules is pointing to the same array MARKDOWN_IT_RULES, which is modified directly. Modifying rules with << changes the original MARKDOWN_IT_RULES array, so every call to something works with the altered array state from previous calls. --- plugins/chat/app/models/chat/message.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/chat/app/models/chat/message.rb b/plugins/chat/app/models/chat/message.rb index e50c794fa4f..7e642fe30b9 100644 --- a/plugins/chat/app/models/chat/message.rb +++ b/plugins/chat/app/models/chat/message.rb @@ -223,7 +223,7 @@ module Chat ] def self.cook(message, opts = {}) - rules = MARKDOWN_IT_RULES + rules = MARKDOWN_IT_RULES.dup rules << "heading" if opts[:user_id] && opts[:user_id].negative? # A rule in our Markdown pipeline may have Guardian checks that require a