Update app/javascript/dashboard/mixins/uiSettings.js

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Fayaz Ahmed 2022-09-29 17:15:38 +05:30 committed by GitHub
parent 534eb909b7
commit 54076a35ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,20 +18,18 @@ export default {
}),
conversationSidebarItemsOrder() {
const { conversation_sidebar_items_order: itemsOrder } = this.uiSettings;
// If the sidebar order is not set, use the default order.
if (!itemsOrder) {
return DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER;
}
const items = itemsOrder;
if (
DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER.length !== itemsOrder.length
) {
// If the sidebar order doesn't have the new elements, then add them to the list.
DEFAULT_CONVERSATION_SIDEBAR_ITEMS_ORDER.forEach(item => {
if (!itemsOrder.find(i => i.name === item.name)) {
items.push(item);
itemsOrder.push(item);
}
});
}
return items;
return itemsOrder;
},
contactSidebarItemsOrder() {
const { contact_sidebar_items_order: itemsOrder } = this.uiSettings;