chat: show pending messages again

This commit is contained in:
Tyler Brown Cifu Shuster 2020-09-08 17:06:08 -07:00
parent f24a47f8e9
commit 042cdcf698

View File

@ -232,11 +232,14 @@ export class ChatWindow extends Component<ChatWindowProps, ChatWindowState> {
const debouncedFetch = _.debounce(this.fetchMessages, 500).bind(this); const debouncedFetch = _.debounce(this.fetchMessages, 500).bind(this);
envelopes envelopes
.concat(stationPendingMessages)
.forEach((message) => { .forEach((message) => {
messages[message.number] = message; messages[message.number] = message;
}); });
stationPendingMessages.sort((a, b) => a.when - b.when).forEach((message, index) => {
messages[mailboxSize + index + 1] = message;
});
return ( return (
<Fragment> <Fragment>
<UnreadNotice <UnreadNotice
@ -250,7 +253,7 @@ export class ChatWindow extends Component<ChatWindowProps, ChatWindowState> {
{messages.length ? <VirtualList {messages.length ? <VirtualList
ref={this.virtualList} ref={this.virtualList}
style={{height: '100%', width: '100%', visibility: this.state.initialized ? 'initial' : 'hidden'}} style={{height: '100%', width: '100%', visibility: this.state.initialized ? 'initial' : 'hidden'}}
totalCount={mailboxSize} totalCount={mailboxSize + stationPendingMessages.length}
followOutput={!this.state.idle} followOutput={!this.state.idle}
endReached={this.dismissUnread} endReached={this.dismissUnread}
scrollSeek={{ scrollSeek={{
@ -289,7 +292,7 @@ export class ChatWindow extends Component<ChatWindowProps, ChatWindowState> {
hideAvatars={hideAvatars} hideAvatars={hideAvatars}
hideNicknames={hideNicknames} hideNicknames={hideNicknames}
remoteContentPolicy={remoteContentPolicy} remoteContentPolicy={remoteContentPolicy}
className={number === mailboxSize ? 'pb3' : ''} className={number === mailboxSize + stationPendingMessages.length ? 'pb3' : ''}
/> />
}} }}
/> : <div style={{height: '100%', width: '100%'}}></div>} /> : <div style={{height: '100%', width: '100%'}}></div>}