Skip to content
Snippets Groups Projects
Unverified Commit 8a16f6f2 authored by Christoph Wurst's avatar Christoph Wurst Committed by GitHub
Browse files

Merge pull request #2179 from nextcloud/fix/reply-quote-new-lines

Fix unnecessary line breaks in quoted reply text
parents 4aef2c01 ee4dd398
No related branches found
No related tags found
No related merge requests found
......@@ -98,12 +98,12 @@ class Html {
$signature = null;
$parts = explode("-- \r\n", $body);
if (count($parts) > 1) {
$signature = nl2br(array_pop($parts));
$signature = array_pop($parts);
$body = implode("-- \r\n", $parts);
}
return [
nl2br($body),
$body,
$signature
];
}
......
<template>
<div>
<div id="mail-content" v-html="body"></div>
<div v-if="signature" class="mail-signature" v-html="signature"></div>
<div id="mail-content" v-html="htmlBody"></div>
<div v-if="signature" class="mail-signature" v-html="htmlSignature"></div>
</div>
</template>
......@@ -18,6 +18,19 @@ export default {
default: () => undefined,
},
},
computed: {
htmlBody() {
return this.nl2br(this.body)
},
htmlSignature() {
return this.nl2br(this.signature)
},
},
methods: {
nl2br(str) {
return str.replace(/(\r\n|\n\r|\n|\r)/g, '<br />')
},
},
}
</script>
......
......@@ -82,7 +82,7 @@ class HtmlTest extends TestCase {
return [
['abc', null, 'abc'],
['abc', 'def', "abc-- \r\ndef"],
["abc-- <br />\r\ndef", 'ghi', "abc-- \r\ndef-- \r\nghi"],
["abc-- \r\ndef", 'ghi', "abc-- \r\ndef-- \r\nghi"],
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment