diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-08-05 02:00:23 +0800 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-08-04 11:00:23 -0700 |
commit | 2c8a5ffd971f00648e7bc5f48993fc187f3179f2 (patch) | |
tree | 2376bd6ae34e9e21cdf57e240e62ad67492df654 /webapp/components/file_attachment_list | |
parent | c973608ccb47373b60b333617f04bde8a3978521 (diff) | |
download | chat-2c8a5ffd971f00648e7bc5f48993fc187f3179f2.tar.gz chat-2c8a5ffd971f00648e7bc5f48993fc187f3179f2.tar.bz2 chat-2c8a5ffd971f00648e7bc5f48993fc187f3179f2.zip |
[PLT-2407] Improve ordering of uploaded attachments (#7022)
* improve ordering of uploaded attachments
* use LocalizationStore.getLocale() when comparing file names
Diffstat (limited to 'webapp/components/file_attachment_list')
-rw-r--r-- | webapp/components/file_attachment_list/file_attachment_list.jsx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/webapp/components/file_attachment_list/file_attachment_list.jsx b/webapp/components/file_attachment_list/file_attachment_list.jsx index 31b1ac424..a497a0004 100644 --- a/webapp/components/file_attachment_list/file_attachment_list.jsx +++ b/webapp/components/file_attachment_list/file_attachment_list.jsx @@ -61,14 +61,16 @@ export default class FileAttachmentList extends React.Component { render() { const postFiles = []; + let fileInfos = []; if (this.props.fileInfos && this.props.fileInfos.length > 0) { - for (let i = 0; i < Math.min(this.props.fileInfos.length, Constants.MAX_DISPLAY_FILES); i++) { - const fileInfo = this.props.fileInfos[i]; + fileInfos = this.props.fileInfos.sort((a, b) => a.create_at - b.create_at); + for (let i = 0; i < Math.min(fileInfos.length, Constants.MAX_DISPLAY_FILES); i++) { + const fileInfo = fileInfos[i]; postFiles.push( <FileAttachment key={fileInfo.id} - fileInfo={this.props.fileInfos[i]} + fileInfo={fileInfos[i]} index={i} handleImageClick={this.handleImageClick} compactDisplay={this.props.compactDisplay} @@ -96,7 +98,7 @@ export default class FileAttachmentList extends React.Component { show={this.state.showPreviewModal} onModalDismissed={() => this.setState({showPreviewModal: false})} startId={this.state.startImgIndex} - fileInfos={this.props.fileInfos} + fileInfos={fileInfos} /> </div> ); |