3889 activate settingsaccountsemailsinboxsettings (#3962)

* update email visibility in settings

* improve styling

* Add contact auto creation toggle to inbox settings

* re
move soonpill

* update Icon

* create job

* Add logic to create contacts and companies for message participants without personId and workspaceMemberId

* add listener

* wip

* wip

* refactoring

* improve structure

* Add isContactAutoCreationEnabled method to MessageChannelService

* wip

* wip

* clean

* add job

* fix bug

* contact creation is working

* wip

* working

* improve code

* improve typing

* resolve conflicts

* fix

* create company repository

* move util

* wip

* fix
This commit is contained in:
bosiraphael
2024-02-14 17:30:17 +01:00
committed by GitHub
parent 0b2ffb0ee6
commit 94ad0e33ec
27 changed files with 607 additions and 164 deletions

View File

@ -4,6 +4,7 @@ import { useNavigate, useParams } from 'react-router-dom';
import { MessageChannel } from '@/accounts/types/MessageChannel';
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
import { SettingsAccountsInboxSettingsContactAutoCreateSection } from '@/settings/accounts/components/SettingsAccountsInboxSettingsContactAutoCreationSection';
import {
InboxSettingsVisibilityValue,
SettingsAccountsInboxSettingsVisibilitySection,
@ -36,6 +37,15 @@ export const SettingsAccountsEmailsInboxSettings = () => {
});
};
const handleContactAutoCreationToggle = (value: boolean) => {
updateOneRecord({
idToUpdate: messageChannelId,
updateOneRecordInput: {
isContactAutoCreationEnabled: value,
},
});
};
useEffect(() => {
if (!loading && !messageChannel) navigate(AppPath.NotFound);
}, [loading, messageChannel, navigate]);
@ -61,11 +71,10 @@ export const SettingsAccountsEmailsInboxSettings = () => {
value={messageChannel?.visibility}
onChange={handleVisibilityChange}
/>
{/* TODO : Add this section when the backend will be ready to auto create contacts */}
{/* <SettingsAccountsInboxSettingsContactAutoCreateSection
<SettingsAccountsInboxSettingsContactAutoCreateSection
messageChannel={messageChannel}
onToggle={handleContactAutoCreationToggle}
/> */}
/>
</SettingsPageContainer>
</SubMenuTopBarContainer>
);