Skip to content

A platform for community discussion. Free, open, simple.

DEV: improvement to stripping quote logic

Sam Saffron741d5bf5416b
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, "");
}