mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Merge pull request #1279 from rgarmsen2295/plt-743
PLT-741/743 Adds additional checks when sorting channels/teams by display name
This commit is contained in:
@@ -1104,3 +1104,24 @@ export function openDirectChannelToUser(user, successCb, errorCb) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Use when sorting multiple channels or teams by their `display_name` field
|
||||
export function sortByDisplayName(a, b) {
|
||||
let aDisplayName = '';
|
||||
let bDisplayName = '';
|
||||
|
||||
if (a && a.display_name) {
|
||||
aDisplayName = a.display_name.toLowerCase();
|
||||
}
|
||||
if (b && b.display_name) {
|
||||
bDisplayName = b.display_name.toLowerCase();
|
||||
}
|
||||
|
||||
if (aDisplayName < bDisplayName) {
|
||||
return -1;
|
||||
}
|
||||
if (aDisplayName > bDisplayName) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user