summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-08-05 16:34:32 -0300
committerAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-08-05 16:34:44 -0300
commit85f663fdb0d02827b7ab1a8d501ab9caa3fcaf49 (patch)
treed44276defb2e2cc1a2de05dd2d314fc3ef41527b /web-ui
parent67fbe0205e4b6561950d232e564c289f87c3aca3 (diff)
Remove commented code and always sanitize mail being displayed
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/helpers/view_helper.js27
1 files changed, 5 insertions, 22 deletions
diff --git a/web-ui/app/js/helpers/view_helper.js b/web-ui/app/js/helpers/view_helper.js
index 3fa9edc1..02067005 100644
--- a/web-ui/app/js/helpers/view_helper.js
+++ b/web-ui/app/js/helpers/view_helper.js
@@ -21,7 +21,9 @@ define(
}
function isQuotedPrintableBodyPart (bodyPart) {
- return bodyPart.headers['Content-Transfer-Encoding'] && bodyPart.headers['Content-Transfer-Encoding'] === 'quoted-printable';
+ return bodyPart.headers &&
+ bodyPart.headers['Content-Transfer-Encoding'] &&
+ bodyPart.headers['Content-Transfer-Encoding'] === 'quoted-printable';
}
function getHtmlContentType (mail) {
@@ -52,29 +54,10 @@ define(
return $(getSanitizedAndDecodedMailBody(mail.getMailPartByContentType(htmlContentType)));
}
- return $(addParagraphsToPlainText(mail.getMailMultiParts[0]));
+ return $(getSanitizedAndDecodedMailBody(addParagraphsToPlainText(mail.getMailMultiParts[0])));
}
- return $(addParagraphsToPlainText(mail.body));
-
- /*
- var body;
- // probably parse MIME parts and ugliness here
- // content_type: "multipart/alternative; boundary="----=_Part_1115_17865397.1370312509342""
- var mediaType = new contentType.MediaType(mail.header.content_type);
- if(mediaType.type === 'multipart/alternative') {
- var parsedBodyParts = getMailMultiParts(mail.body, mediaType);
- var selectedBodyPart = getHtmlMailPart(parsedBodyParts) || getPlainTextMailPart(parsedBodyParts) || parsedBodyParts[0];
- body = selectedBodyPart.body;
-
- if (isQuotedPrintableBodyPart(selectedBodyPart)) {
- body = quotedPrintable.decode(body);
- }
- } else {
- body = addParagraphsToPlainText(mail.body);
- }
- return $(htmlWhitelister.sanitize(body, htmlWhitelister.tagPolicy));
- */
+ return $(getSanitizedAndDecodedMailBody(addParagraphsToPlainText(mail.body)));
}
function moveCaretToEnd(el) {