summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorBruno Tavares <bruno.exz@gmail.com>2015-04-08 21:39:22 -0300
committerBruno Tavares <bruno.exz@gmail.com>2015-04-08 21:40:59 -0300
commitd3c86f867d29b79eec1d280389975c920a7ec196 (patch)
treebe1fd333eff3b4b615b1146a1be872fce369a4c3 /web-ui
parented8fd002c53800b966fc1ef6115c2ff53fa042b1 (diff)
Prepend mail quoting with the sender information #66
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/helpers/view_helper.js11
-rw-r--r--web-ui/test/spec/helpers/view_helper.spec.js8
2 files changed, 15 insertions, 4 deletions
diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js
index cf4406bb..a682ae5e 100644
--- a/web-ui/app/js/helpers/view_helper.js
+++ b/web-ui/app/js/helpers/view_helper.js
@@ -109,12 +109,15 @@ define(
}, 1);
}
- function quoteMail(mail) {
- return '\n\n' + mail.textPlainBody.replace(/^/mg, '> ');
+ function prependFrom(mail) {
+ return i18n(
+ 'On __date__, <__from__> wrote:\n',
+ {'date': new Date(mail.header.date).toString(), 'from': mail.header.from}
+ );
}
- function i18n(text) {
- return i18n_lib.get(text);
+ function quoteMail(mail) {
+ return '\n\n' + prependFrom(mail) + mail.textPlainBody.replace(/^/mg, '> ');
}
return {
diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js
index 7b5b960b..888c6cda 100644
--- a/web-ui/test/spec/helpers/view_helper.spec.js
+++ b/web-ui/test/spec/helpers/view_helper.spec.js
@@ -15,6 +15,14 @@ define(['helpers/view_helper'], function (viewHelper) {
expect(quotedMail).toContain('> First Line\n> Second Line');
});
+
+ it('should add the mail sender information', function() {
+ testData.rawMail.mail.textPlainBody = 'First Line\nSecond Line';
+
+ var quotedMail = viewHelper.quoteMail(testData.rawMail.mail);
+
+ expect(quotedMail).toContain('On Wed Jun 04 2014 17:41:13 GMT+0000 (UTC), <laurel@hamill.info> wrote');
+ });
});
describe('getFormmattedDate', function() {