DEV: improvement to stripping quote logic

DEV: improvement to stripping quote logic

Followup one afc7830b we needed handling for nested quotes

diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6
index d094917..903d61b 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, "");
     }

GitHub sha: 741d5bf5

1 Like