fix(message-threading): Take non-standard but conventional subject prefixes into account (#605)

This commit is contained in:
Louis Laureys 2024-01-25 08:02:55 +01:00 committed by GitHub
parent 85e09ecc77
commit 816114f655
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1456,12 +1456,13 @@ class MessageHandler {
options = options || {};
subject = subject.replace(/\s+/g, ' ').trim();
// `Re: [EXTERNAL] Re: Fwd: Example subject (fwd)` becomes `Example subject`
if (options.removePrefix) {
let match = true;
while (match) {
match = false;
subject = subject
.replace(/^(re|fwd?)\s*:|\s*\(fwd\)\s*$/gi, () => {
.replace(/^(re|fwd?)\s*:|^\[.+?\](?=\s.+)|\s*\(fwd\)\s*$/gi, () => {
match = true;
return '';
})