From 741d5bf5416b6382a57a683ac2aec72747a7c561 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Thu, 22 Aug 2019 12:09:32 +1000 Subject: [PATCH] DEV: improvement to stripping quote logic Followup one afc7830b we needed handling for nested quotes --- app/assets/javascripts/discourse/models/composer.js.es6 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6 index d0949175a2e..903d61b5210 100644 --- a/app/assets/javascripts/discourse/models/composer.js.es6 +++ b/app/assets/javascripts/discourse/models/composer.js.es6 @@ -451,8 +451,9 @@ const Composer = RestModel.extend({ return reply.length; } - if (Quote.REGEXP.test(reply)) { - // make it global so we can strip all quotes at once + while (Quote.REGEXP.test(reply)) { + // make it global so we can strip as many quotes at once + // keep in mind nested quotes mean we still need a loop here const regex = new RegExp(Quote.REGEXP.source, "img"); reply = reply.replace(regex, ""); }