From 9ba968ce3354b1a8ab307ecc4cc785bdee16f914 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Wed, 1 Feb 2017 08:57:16 +0900 Subject: Use consistent Display Name sorting code throughout the webapp #5159 (#5213) * Use consistent Display Name sorting code throughout the webapp #5159 * fixed broken sorting of teams and channels --- webapp/components/suggestion/search_channel_provider.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'webapp/components/suggestion/search_channel_provider.jsx') diff --git a/webapp/components/suggestion/search_channel_provider.jsx b/webapp/components/suggestion/search_channel_provider.jsx index 8965e7a76..c0ec06181 100644 --- a/webapp/components/suggestion/search_channel_provider.jsx +++ b/webapp/components/suggestion/search_channel_provider.jsx @@ -10,6 +10,7 @@ import ChannelStore from 'stores/channel_store.jsx'; import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; import {Constants, ActionTypes} from 'utils/constants.jsx'; +import {sortChannelsByDisplayName} from 'utils/channel_utils.jsx'; import React from 'react'; @@ -51,7 +52,7 @@ export default class SearchChannelProvider extends Provider { const publicChannels = data; const localChannels = ChannelStore.getAll(); - const privateChannels = []; + let privateChannels = []; for (const id of Object.keys(localChannels)) { const channel = localChannels[id]; @@ -60,15 +61,15 @@ export default class SearchChannelProvider extends Provider { } } - const filteredPublicChannels = []; + let filteredPublicChannels = []; publicChannels.forEach((item) => { if (item.name.startsWith(channelPrefix)) { filteredPublicChannels.push(item); } }); - privateChannels.sort((a, b) => a.name.localeCompare(b.name)); - filteredPublicChannels.sort((a, b) => a.name.localeCompare(b.name)); + privateChannels = privateChannels.sort(sortChannelsByDisplayName); + filteredPublicChannels = filteredPublicChannels.sort(sortChannelsByDisplayName); const channels = filteredPublicChannels.concat(privateChannels); const channelNames = channels.map((channel) => channel.name); -- cgit v1.2.3-1-g7c22