summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-08-05 02:00:23 +0800
committerChristopher Speller <crspeller@gmail.com>2017-08-04 11:00:23 -0700
commit2c8a5ffd971f00648e7bc5f48993fc187f3179f2 (patch)
tree2376bd6ae34e9e21cdf57e240e62ad67492df654 /webapp/utils
parentc973608ccb47373b60b333617f04bde8a3978521 (diff)
downloadchat-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/utils')
-rw-r--r--webapp/utils/utils.jsx5
1 files changed, 5 insertions, 0 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index f12fcefba..89e031a3c 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -475,6 +475,11 @@ export function splitFileLocation(fileLocation) {
return {ext, name: filename, path: filePath};
}
+export function sortFilesByName(files) {
+ const locale = LocalizationStore.getLocale();
+ return Array.from(files).sort((a, b) => a.name.localeCompare(b.name, locale, {numeric: true}));
+}
+
export function toTitleCase(str) {
function doTitleCase(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();