From 4ea0bdcb8583a83176b69687c2ffbf842b165e0c Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 5 Oct 2016 13:52:02 +0300 Subject: [PATCH] Fix message display for new DB structure, show message flags --- MessageList.js | 17 ++++++++++++----- MessageView.js | 25 ++++++++++++++++++------- Util.js | 2 +- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/MessageList.js b/MessageList.js index 57bd438..71b10af 100644 --- a/MessageList.js +++ b/MessageList.js @@ -6,20 +6,27 @@ const StoreListener = require('./StoreListener.js'); const Util = require('./Util.js'); var MessageInList = React.createClass({ - msgClasses: [ 'unread', 'unseen', 'replied', 'pinned', 'sent', 'unloaded' ], + msgClasses: { unread: 'unread', unseen: 'unseen', answered: 'replied', flagged: 'pinned', sent: 'sent' }, render: function() { var msg = this.props.msg; - return
(msg[c] ? ' '+c : '')).join(''))+ - (this.props.selected ? ' selected' : '')+(msg.thread && this.props.threads ? ' thread0' : '')} onMouseDown={this.props.onClick}> + return
(this.msgClasses[c] ? ' '+this.msgClasses[c] : '')).join(''))+ + (this.props.selected ? ' selected' : '')+ + (msg.thread && this.props.threads ? ' thread0' : '')} onMouseDown={this.props.onClick}> +
{msg.subject}
{msg.thread && this.props.threads ?
: null}
-
{(msg.sent || msg.outgoing ? 'To '+(msg.to_name||msg.to_email) : (msg.from_name||msg.from_email))}
+
+ {(msg.props.sent ? 'To '+(msg.props.to[0][0]||msg.props.to[0][1]) : (msg.props.from ? msg.props.from[0]||msg.props.from[1] : ''))} +
{Util.formatBytes(msg.size||0)}
-
+
{Util.formatDate(msg.time)}
+
} }); diff --git a/MessageView.js b/MessageView.js index 17fe999..c7158e8 100644 --- a/MessageView.js +++ b/MessageView.js @@ -53,6 +53,7 @@ var MessageView = React.createClass({ }); } } + // TODO list attachments return
@@ -82,24 +83,34 @@ var MessageView = React.createClass({
To
- +
+ {msg.props.to.map(a => ' : a[1]}>{a[0] || a[1]})} +
- {msg.cc_list ? + {msg.props.cc.length ?
Cc
- {[ msg.cc_list ].map(cc => {cc})} + {msg.props.cc.map(a => ' : a[1]}>{a[0] || a[1]})}
: null} - {msg.replyto_email ? + {msg.props.bcc.length ? +
+
Bcc
+
+ {msg.props.bcc.map(a => ' : a[1]}>{a[0] || a[1]})} +
+
+ : null} + {msg.props.replyto ? : null}
@@ -108,7 +119,7 @@ var MessageView = React.createClass({ ?
This message contains blocked images. Load Images - + {(msg.props.from ? : null)}
: null), (html diff --git a/Util.js b/Util.js index b891017..2422467 100644 --- a/Util.js +++ b/Util.js @@ -25,7 +25,7 @@ module.exports.formatDate = function(dt) { var d = dt.getDate(); var m = dt.getMonth()+1; - return (d < 10 ? '0' : '')+d+' '+(m < 10 ? '0' : '')+m+' '+dt.getFullYear(); + return (d < 10 ? '0' : '')+d+'.'+(m < 10 ? '0' : '')+m+'.'+dt.getFullYear(); } else if (dt.getTime() < tod.getTime()) {