Skip to content

Commit

Permalink
Merge branch 'main' into fix/context-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasbordeau authored Jan 2, 2025
2 parents bd86af7 + 0674388 commit b876240
Show file tree
Hide file tree
Showing 120 changed files with 1,949 additions and 766 deletions.
63 changes: 53 additions & 10 deletions packages/twenty-front/src/generated-metadata/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ export type ActivateWorkspaceInput = {
displayName?: InputMaybe<Scalars['String']['input']>;
};

export type ActivateWorkspaceOutput = {
__typename?: 'ActivateWorkspaceOutput';
loginToken: AuthToken;
workspace: Workspace;
};

export type Analytics = {
__typename?: 'Analytics';
/** Boolean that confirms query was dispatched */
Expand Down Expand Up @@ -128,6 +122,12 @@ export type Billing = {
isBillingEnabled: Scalars['Boolean']['output'];
};

/** The different billing plans available */
export enum BillingPlanKey {
Enterprise = 'ENTERPRISE',
Pro = 'PRO'
}

export type BillingSubscription = {
__typename?: 'BillingSubscription';
id: Scalars['UUID']['output'];
Expand Down Expand Up @@ -371,7 +371,7 @@ export type ExecuteServerlessFunctionInput = {
export type FeatureFlag = {
__typename?: 'FeatureFlag';
id: Scalars['UUID']['output'];
key: Scalars['String']['output'];
key: FeatureFlagKey;
value: Scalars['Boolean']['output'];
workspaceId: Scalars['String']['output'];
};
Expand All @@ -382,6 +382,28 @@ export type FeatureFlagFilter = {
or?: InputMaybe<Array<FeatureFlagFilter>>;
};

export enum FeatureFlagKey {
IsAdvancedFiltersEnabled = 'IsAdvancedFiltersEnabled',
IsAggregateQueryEnabled = 'IsAggregateQueryEnabled',
IsAirtableIntegrationEnabled = 'IsAirtableIntegrationEnabled',
IsAnalyticsV2Enabled = 'IsAnalyticsV2Enabled',
IsCopilotEnabled = 'IsCopilotEnabled',
IsCrmMigrationEnabled = 'IsCrmMigrationEnabled',
IsEventObjectEnabled = 'IsEventObjectEnabled',
IsFreeAccessEnabled = 'IsFreeAccessEnabled',
IsFunctionSettingsEnabled = 'IsFunctionSettingsEnabled',
IsGmailSendEmailScopeEnabled = 'IsGmailSendEmailScopeEnabled',
IsJsonFilterEnabled = 'IsJsonFilterEnabled',
IsMicrosoftSyncEnabled = 'IsMicrosoftSyncEnabled',
IsPageHeaderV2Enabled = 'IsPageHeaderV2Enabled',
IsPostgreSqlIntegrationEnabled = 'IsPostgreSQLIntegrationEnabled',
IsSsoEnabled = 'IsSSOEnabled',
IsStripeIntegrationEnabled = 'IsStripeIntegrationEnabled',
IsUniqueIndexesEnabled = 'IsUniqueIndexesEnabled',
IsViewGroupsEnabled = 'IsViewGroupsEnabled',
IsWorkflowEnabled = 'IsWorkflowEnabled'
}

export type FeatureFlagSort = {
direction: SortDirection;
field: FeatureFlagSortFields;
Expand Down Expand Up @@ -481,6 +503,12 @@ export enum IdentityProviderType {
Saml = 'SAML'
}

export type ImpersonateOutput = {
__typename?: 'ImpersonateOutput';
loginToken: AuthToken;
workspace: WorkspaceSubdomainAndId;
};

export type IndexConnection = {
__typename?: 'IndexConnection';
/** Array of edges. */
Expand Down Expand Up @@ -544,7 +572,7 @@ export enum MessageChannelVisibility {
export type Mutation = {
__typename?: 'Mutation';
activateWorkflowVersion: Scalars['Boolean']['output'];
activateWorkspace: ActivateWorkspaceOutput;
activateWorkspace: Workspace;
addUserToWorkspace: User;
addUserToWorkspaceByInviteToken: User;
authorizeApp: AuthorizeApp;
Expand Down Expand Up @@ -579,13 +607,13 @@ export type Mutation = {
generateApiKeyToken: ApiKeyToken;
generateTransientToken: TransientToken;
getAuthorizationUrl: GetAuthorizationUrlOutput;
impersonate: AuthTokens;
impersonate: ImpersonateOutput;
publishServerlessFunction: ServerlessFunction;
renewToken: AuthTokens;
resendWorkspaceInvitation: SendInvitationsOutput;
runWorkflowVersion: WorkflowRun;
sendInvitations: SendInvitationsOutput;
signUp: LoginToken;
signUp: SignUpOutput;
skipSyncEmailOnboardingStep: OnboardingStepSuccess;
switchWorkspace: PublicWorkspaceDataOutput;
syncRemoteTable: RemoteTable;
Expand Down Expand Up @@ -645,7 +673,9 @@ export type MutationChallengeArgs = {


export type MutationCheckoutSessionArgs = {
plan?: BillingPlanKey;
recurringInterval: SubscriptionInterval;
requirePaymentMethod?: Scalars['Boolean']['input'];
successUrlPath?: InputMaybe<Scalars['String']['input']>;
};

Expand Down Expand Up @@ -1368,6 +1398,12 @@ export type SetupSsoOutput = {
type: IdentityProviderType;
};

export type SignUpOutput = {
__typename?: 'SignUpOutput';
loginToken: AuthToken;
workspace: WorkspaceSubdomainAndId;
};

/** Sort Directions */
export enum SortDirection {
Asc = 'ASC',
Expand Down Expand Up @@ -1751,6 +1787,7 @@ export type WorkspaceEdge = {

export type WorkspaceInfo = {
__typename?: 'WorkspaceInfo';
allowImpersonation: Scalars['Boolean']['output'];
featureFlags: Array<FeatureFlag>;
id: Scalars['String']['output'];
logo?: Maybe<Scalars['String']['output']>;
Expand Down Expand Up @@ -1804,6 +1841,12 @@ export type WorkspaceNameAndId = {
id: Scalars['String']['output'];
};

export type WorkspaceSubdomainAndId = {
__typename?: 'WorkspaceSubdomainAndId';
id: Scalars['String']['output'];
subdomain: Scalars['String']['output'];
};

export type BillingCustomer = {
__typename?: 'billingCustomer';
id: Scalars['UUID']['output'];
Expand Down
3 changes: 0 additions & 3 deletions packages/twenty-front/src/generated/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export type Billing = {

/** The different billing plans available */
export enum BillingPlanKey {
Base = 'BASE',
Enterprise = 'ENTERPRISE',
Pro = 'PRO'
}
Expand Down Expand Up @@ -325,14 +324,12 @@ export enum FeatureFlagKey {
IsFunctionSettingsEnabled = 'IsFunctionSettingsEnabled',
IsGmailSendEmailScopeEnabled = 'IsGmailSendEmailScopeEnabled',
IsJsonFilterEnabled = 'IsJsonFilterEnabled',
IsMessageThreadSubscriberEnabled = 'IsMessageThreadSubscriberEnabled',
IsMicrosoftSyncEnabled = 'IsMicrosoftSyncEnabled',
IsPageHeaderV2Enabled = 'IsPageHeaderV2Enabled',
IsPostgreSqlIntegrationEnabled = 'IsPostgreSQLIntegrationEnabled',
IsSsoEnabled = 'IsSSOEnabled',
IsStripeIntegrationEnabled = 'IsStripeIntegrationEnabled',
IsUniqueIndexesEnabled = 'IsUniqueIndexesEnabled',
IsViewGroupsEnabled = 'IsViewGroupsEnabled',
IsWorkflowEnabled = 'IsWorkflowEnabled'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
import { RecordGqlOperationSignatureFactory } from '@/object-record/graphql/types/RecordGqlOperationSignatureFactory';

export const fetchAllThreadMessagesOperationSignatureFactory: RecordGqlOperationSignatureFactory =
({
messageThreadId,
isSubscribersEnabled,
}: {
messageThreadId: string;
isSubscribersEnabled: boolean;
}) => ({
({ messageThreadId }: { messageThreadId: string }) => ({
objectNameSingular: CoreObjectNameSingular.Message,
variables: {
filter: {
Expand All @@ -33,15 +27,6 @@ export const fetchAllThreadMessagesOperationSignatureFactory: RecordGqlOperation
receivedAt: true,
messageThread: {
id: true,
subscribers: isSubscribersEnabled
? {
workspaceMember: {
id: true,
name: true,
avatarUrl: true,
},
}
: undefined,
},
messageParticipants: {
id: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { isDefined } from 'twenty-ui';
import { FeatureFlagKey } from '~/generated/graphql';

export const useRightDrawerEmailThread = () => {
const viewableRecordId = useRecoilValue(viewableRecordIdState);
Expand All @@ -38,14 +36,9 @@ export const useRightDrawerEmailThread = () => {
},
});

const isMessageThreadSubscribersEnabled = useIsFeatureEnabled(
FeatureFlagKey.IsMessageThreadSubscriberEnabled,
);

const FETCH_ALL_MESSAGES_OPERATION_SIGNATURE =
fetchAllThreadMessagesOperationSignatureFactory({
messageThreadId: viewableRecordId,
isSubscribersEnabled: isMessageThreadSubscribersEnabled,
});

const {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const triggerAttachRelationOptimisticEffect = ({
id: targetRecordCacheId,
fields: {
[fieldNameOnTargetRecord]: (targetRecordFieldValue, { toReference }) => {
const fieldValueisObjectRecordConnectionWithRefs =
const fieldValueIsObjectRecordConnectionWithRefs =
isObjectRecordConnectionWithRefs(
sourceObjectNameSingular,
targetRecordFieldValue,
Expand All @@ -47,7 +47,7 @@ export const triggerAttachRelationOptimisticEffect = ({
return targetRecordFieldValue;
}

if (fieldValueisObjectRecordConnectionWithRefs) {
if (fieldValueIsObjectRecordConnectionWithRefs) {
const nextEdges: RecordGqlRefEdge[] = [
...targetRecordFieldValue.edges,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import { useAggregateRecordsQuery } from '@/object-record/hooks/useAggregateReco
import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
import { generateAggregateQuery } from '@/object-record/utils/generateAggregateQuery';
import { renderHook } from '@testing-library/react';
import { getColumnNameForAggregateOperation } from 'twenty-shared';
import { FieldMetadataType } from '~/generated/graphql';

jest.mock('@/object-metadata/hooks/useObjectMetadataItem');
jest.mock('@/object-record/utils/generateAggregateQuery');
jest.mock('twenty-shared', () => ({
getColumnNameForAggregateOperation: jest.fn(),
}));

const mockObjectMetadataItem: ObjectMetadataItem = {
nameSingular: 'company',
Expand Down Expand Up @@ -65,6 +69,7 @@ describe('useAggregateRecordsQuery', () => {
});

it('should handle simple count operation', () => {
(getColumnNameForAggregateOperation as jest.Mock).mockReturnValue('name');
const { result } = renderHook(() =>
useAggregateRecordsQuery({
objectNameSingular: 'company',
Expand All @@ -86,6 +91,7 @@ describe('useAggregateRecordsQuery', () => {
});

it('should handle field aggregation', () => {
(getColumnNameForAggregateOperation as jest.Mock).mockReturnValue('amount');
const { result } = renderHook(() =>
useAggregateRecordsQuery({
objectNameSingular: 'company',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const ObjectOptionsDropdown = ({
clickableComponent={
<StyledHeaderDropdownButton>Options</StyledHeaderDropdownButton>
}
onClose={handleResetContent}
dropdownComponents={
<ObjectOptionsDropdownContext.Provider
value={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { useSetRecoilState } from 'recoil';

export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => {
const {
viewType,
currentContentId,
recordIndexId,
objectMetadataItem,
Expand All @@ -47,6 +48,7 @@ export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => {
const { handleVisibilityChange: handleRecordGroupVisibilityChange } =
useRecordGroupVisibility({
viewBarId: recordIndexId,
viewType,
});

const viewGroupSettingsUrl = getSettingsPagePath(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useGetCurrentView } from '@/views/hooks/useGetCurrentView';
import { ViewType } from '@/views/types/ViewType';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { FeatureFlagKey } from '~/generated/graphql';
import { isDefined } from '~/utils/isDefined';

export const ObjectOptionsDropdownMenuContent = () => {
const {
Expand All @@ -42,10 +41,6 @@ export const ObjectOptionsDropdownMenuContent = () => {
closeDropdown,
} = useOptionsDropdown();

const isViewGroupEnabled = useIsFeatureEnabled(
FeatureFlagKey.IsViewGroupsEnabled,
);

const { getIcon } = useIcons();
const { currentViewWithCombinedFiltersAndSorts: currentView } =
useGetCurrentView();
Expand Down Expand Up @@ -120,9 +115,13 @@ export const ObjectOptionsDropdownMenuContent = () => {
contextualText={`${visibleBoardFields.length} shown`}
hasSubMenu
/>
{(viewType === ViewType.Kanban || isViewGroupEnabled) && (
{viewType === ViewType.Kanban && currentView?.key !== 'INDEX' && (
<MenuItem
onClick={() => onContentChange('recordGroups')}
onClick={() =>
isDefined(recordGroupFieldMetadata)
? onContentChange('recordGroups')
: onContentChange('recordGroupFields')
}
LeftIcon={IconLayoutList}
text="Group by"
contextualText={recordGroupFieldMetadata?.label}
Expand Down
Loading

0 comments on commit b876240

Please sign in to comment.