[Refactor] Activity morph: first phase (#1075)
* Add company and person on update and create * Enable reading with error management on commentable ID * [CHECKPOINT] backward-compatible * Migrate data for activity targets * Revert "Migrate data for activity targets" This reverts commit f89bc30689655c83cd5370331fec41b59d03fdb9. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -6,6 +6,7 @@ import { GET_PEOPLE } from '@/people/queries';
|
||||
import {
|
||||
Activity,
|
||||
ActivityTarget,
|
||||
CommentableType,
|
||||
useAddActivityTargetsOnActivityMutation,
|
||||
useRemoveActivityTargetsOnActivityMutation,
|
||||
} from '~/generated/graphql';
|
||||
@ -65,6 +66,10 @@ export function useHandleCheckableActivityTargetChange({
|
||||
createdAt: new Date().toISOString(),
|
||||
commentableType: entity.entityType,
|
||||
commentableId: entity.id,
|
||||
companyId:
|
||||
entity.entityType === CommentableType.Company ? entity.id : null,
|
||||
personId:
|
||||
entity.entityType === CommentableType.Person ? entity.id : null,
|
||||
})),
|
||||
},
|
||||
});
|
||||
|
||||
@ -9,7 +9,11 @@ import { useRightDrawer } from '@/ui/right-drawer/hooks/useRightDrawer';
|
||||
import { RightDrawerHotkeyScope } from '@/ui/right-drawer/types/RightDrawerHotkeyScope';
|
||||
import { RightDrawerPages } from '@/ui/right-drawer/types/RightDrawerPages';
|
||||
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
|
||||
import { ActivityType, useCreateActivityMutation } from '~/generated/graphql';
|
||||
import {
|
||||
ActivityType,
|
||||
CommentableType,
|
||||
useCreateActivityMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
import {
|
||||
GET_ACTIVITIES,
|
||||
@ -53,6 +57,14 @@ export function useOpenCreateActivityDrawer() {
|
||||
{
|
||||
commentableId: entity.id,
|
||||
commentableType: entity.type,
|
||||
companyId:
|
||||
entity.type === CommentableType.Company
|
||||
? entity.id
|
||||
: null,
|
||||
personId:
|
||||
entity.type === CommentableType.Person
|
||||
? entity.id
|
||||
: null,
|
||||
id: v4(),
|
||||
createdAt: now,
|
||||
},
|
||||
|
||||
@ -61,6 +61,10 @@ export function useOpenCreateActivityDrawerForSelectedRowIds() {
|
||||
commentableType: entity.type,
|
||||
id: v4(),
|
||||
createdAt: new Date().toISOString(),
|
||||
companyId:
|
||||
entity.type === CommentableType.Company ? entity.id : null,
|
||||
personId:
|
||||
entity.type === CommentableType.Person ? entity.id : null,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user