Commit 0da7f0a 1 parent 9de5caa commit 0da7f0a Copy full SHA for 0da7f0a
File tree 3 files changed +35
-19
lines changed
components/IncomingMessageList
3 files changed +35
-19
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,31 @@ class MessageList extends Component {
25
25
}
26
26
27
27
render ( ) {
28
+ const messageContainerStyle = {
29
+ flex : "1 1 auto" ,
30
+ height : "0px" ,
31
+ overflowY : "scroll"
32
+ } ;
33
+
34
+ if ( this . props . messages . length === 0 ) {
35
+ return (
36
+ < div style = { messageContainerStyle } >
37
+ < p
38
+ style = { {
39
+ backgroundColor : "#EEEEEE" ,
40
+ margin : "0 60px" ,
41
+ padding : "10px 0" ,
42
+ textAlign : "center"
43
+ } }
44
+ >
45
+ No messages yet
46
+ </ p >
47
+ </ div >
48
+ ) ;
49
+ }
50
+
28
51
return (
29
- < div
30
- ref = "messageWindow"
31
- style = { { flex : "1 1 auto" , height : "0px" , overflowY : "scroll" } }
32
- >
52
+ < div ref = "messageWindow" style = { messageContainerStyle } >
33
53
{ this . props . messages . map ( ( message , index ) => {
34
54
const isFromContact = message . isFromContact ;
35
55
const containerStyle = {
Original file line number Diff line number Diff line change @@ -162,20 +162,15 @@ export class IncomingMessageList extends Component {
162
162
overflow : "scroll" ,
163
163
whiteSpace : "pre-line"
164
164
} ,
165
- render : ( columnKey , row ) => {
166
- if ( row . messages && row . messages . length > 0 ) {
167
- return (
168
- < FlatButton
169
- onClick = { event => {
170
- event . stopPropagation ( ) ;
171
- this . handleOpenConversation ( row . index ) ;
172
- } }
173
- icon = { < ActionOpenInNew /> }
174
- />
175
- ) ;
176
- }
177
- return "" ;
178
- }
165
+ render : ( columnKey , row ) => (
166
+ < FlatButton
167
+ onClick = { event => {
168
+ event . stopPropagation ( ) ;
169
+ this . handleOpenConversation ( row . index ) ;
170
+ } }
171
+ icon = { < ActionOpenInNew /> }
172
+ />
173
+ )
179
174
}
180
175
] ;
181
176
} ;
Original file line number Diff line number Diff line change @@ -288,11 +288,12 @@ export async function getConversations(
288
288
289
289
const conversation = _ . omit ( firstRow , messageFields ) ;
290
290
291
- if ( firstRow ) {
291
+ if ( firstRow . created_at ) {
292
292
conversation . updated_at = firstRow . created_at ;
293
293
}
294
294
295
295
conversation . messages = contactMessages
296
+ . filter ( messageRow => messageRow . mess_id !== null )
296
297
// Sort ASC to display most recent _messages_ last
297
298
. sort ( ( messageA , messageB ) => messageA . created_at - messageB . created_at )
298
299
. map ( message => {
You can’t perform that action at this time.
0 commit comments