improve stripPlainReply comment and fix leading NewLine

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2018-04-27 12:12:01 +01:00
parent 68dd57f56e
commit 2e29a0857b
No known key found for this signature in database
GPG Key ID: 3F879DA5AD802A5E
1 changed files with 3 additions and 0 deletions

View File

@ -158,8 +158,11 @@ export default class ReplyThread extends React.Component {
// Part of Replies fallback support
static stripPlainReply(body) {
// Removes lines beginning with `> ` until you reach one that doesn't.
const lines = body.split('\n');
while (lines.length && lines[0].startsWith('> ')) lines.shift();
// Reply fallback has a blank line after it, so remove it to prevent leading newline
if (lines[0] === '') lines.shift();
return lines.join('\n');
}