mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
fix: Update contact details page errors (#10536)
Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
@@ -16,10 +16,7 @@ const { t } = useI18n();
|
||||
|
||||
const searchQuery = ref('');
|
||||
|
||||
const contactAttributes = computed(() => {
|
||||
const attributes = useMapGetter('attributes/getAttributesByModelType');
|
||||
return attributes.value('contact_attribute') || [];
|
||||
});
|
||||
const contactAttributes = useMapGetter('attributes/getContactAttributes') || [];
|
||||
|
||||
const hasContactAttributes = computed(
|
||||
() => contactAttributes.value?.length > 0
|
||||
|
||||
@@ -23,16 +23,3 @@ export function useSnakeCase(payload) {
|
||||
const unrefPayload = unref(payload);
|
||||
return snakecaseKeys(unrefPayload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string from snake_case to camelCase
|
||||
* @param {string} str - String to convert (can contain letters, numbers, or both)
|
||||
* Examples: 'hello_world', 'user_123', 'checkbox_2', 'test_string_99'
|
||||
* @returns {string} Converted string in camelCase
|
||||
* Examples: 'helloWorld', 'user123', 'checkbox2', 'testString99'
|
||||
*/
|
||||
export function toCamelCase(str) {
|
||||
return str
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z0-9])/g, (_, char) => char.toUpperCase());
|
||||
}
|
||||
|
||||
@@ -35,12 +35,6 @@ export const getters = {
|
||||
record => record.attribute_model === attributeModel
|
||||
);
|
||||
},
|
||||
getAttributesByModelType: _state => attributeModel => {
|
||||
const records = _state.records.filter(
|
||||
record => record.attribute_model === attributeModel
|
||||
);
|
||||
return camelcaseKeys(records, { deep: true });
|
||||
},
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
|
||||
@@ -93,7 +93,7 @@ export const actions = {
|
||||
update: async ({ commit }, { id, isFormData = false, ...contactParams }) => {
|
||||
const { avatar, customAttributes, ...paramsToDecamelize } = contactParams;
|
||||
const decamelizedContactParams = {
|
||||
...snakecaseKeys(paramsToDecamelize),
|
||||
...snakecaseKeys(paramsToDecamelize, { deep: true }),
|
||||
...(customAttributes && { custom_attributes: customAttributes }),
|
||||
...(avatar && { avatar }),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user