From 2e29a0857b33f0ac094a2bd68598c4714b339521 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 27 Apr 2018 12:12:01 +0100 Subject: [PATCH] improve stripPlainReply comment and fix leading NewLine Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/elements/ReplyThread.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/views/elements/ReplyThread.js b/src/components/views/elements/ReplyThread.js index 473d6ef201..b2ea8a90a3 100644 --- a/src/components/views/elements/ReplyThread.js +++ b/src/components/views/elements/ReplyThread.js @@ -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'); }