DEV: improvement to stripping quote logic

Followup one afc7830b we needed handling for nested quotes
This commit is contained in:
Sam Saffron 2019-08-22 12:09:32 +10:00
parent afc7830be5
commit 741d5bf541
1 changed files with 3 additions and 2 deletions

View File

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