From 8482ecc1b10306f86e999f38d2cc7938e059084d Mon Sep 17 00:00:00 2001 From: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com> Date: Thu, 7 Apr 2022 10:01:08 +0530 Subject: [PATCH] Feat - Sort inboxes alphabetically (#4383) --- .../layout/sidebarComponents/Secondary.vue | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/javascript/dashboard/components/layout/sidebarComponents/Secondary.vue b/app/javascript/dashboard/components/layout/sidebarComponents/Secondary.vue index 1f98305a1..8d486a454 100644 --- a/app/javascript/dashboard/components/layout/sidebarComponents/Secondary.vue +++ b/app/javascript/dashboard/components/layout/sidebarComponents/Secondary.vue @@ -85,14 +85,20 @@ export default { toState: frontendURL(`accounts/${this.accountId}/settings/inboxes/new`), toStateName: 'settings_inbox_new', newLinkRouteName: 'settings_inbox_new', - children: this.inboxes.map(inbox => ({ - id: inbox.id, - label: inbox.name, - truncateLabel: true, - toState: frontendURL(`accounts/${this.accountId}/inbox/${inbox.id}`), - type: inbox.channel_type, - phoneNumber: inbox.phone_number, - })), + children: this.inboxes + .map(inbox => ({ + id: inbox.id, + label: inbox.name, + truncateLabel: true, + toState: frontendURL( + `accounts/${this.accountId}/inbox/${inbox.id}` + ), + type: inbox.channel_type, + phoneNumber: inbox.phone_number, + })) + .sort((a, b) => + a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1 + ), }; }, labelSection() {