mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-25 13:02:15 +03:00
parent
381bf0fc8d
commit
a750901582
@ -17,7 +17,6 @@ import { DropdownMenu } from '@/ui/layout/dropdown/components/DropdownMenu';
|
||||
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
||||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
|
||||
type SettingsAccountsRowDropdownMenuProps = {
|
||||
account: ConnectedAccount;
|
||||
@ -39,8 +38,6 @@ export const SettingsAccountsRowDropdownMenu = ({
|
||||
|
||||
const { triggerGoogleApisOAuth } = useTriggerGoogleApisOAuth();
|
||||
|
||||
const isCalendarEnabled = useIsFeatureEnabled('IS_CALENDAR_ENABLED');
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
dropdownId={dropdownId}
|
||||
@ -63,18 +60,16 @@ export const SettingsAccountsRowDropdownMenu = ({
|
||||
closeDropdown();
|
||||
}}
|
||||
/>
|
||||
{isCalendarEnabled && (
|
||||
<MenuItem
|
||||
LeftIcon={IconCalendarEvent}
|
||||
text="Calendar settings"
|
||||
onClick={() => {
|
||||
navigate(
|
||||
`/settings/accounts/calendars/${account.calendarChannels[0].id}`,
|
||||
);
|
||||
closeDropdown();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<MenuItem
|
||||
LeftIcon={IconCalendarEvent}
|
||||
text="Calendar settings"
|
||||
onClick={() => {
|
||||
navigate(
|
||||
`/settings/accounts/calendars/${account.calendarChannels[0].id}`,
|
||||
);
|
||||
closeDropdown();
|
||||
}}
|
||||
/>
|
||||
{account.authFailedAt && (
|
||||
<MenuItem
|
||||
LeftIcon={IconRefresh}
|
||||
|
@ -7,7 +7,6 @@ import { getSettingsPagePath } from '@/settings/utils/getSettingsPagePath';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { H2Title } from '@/ui/display/typography/components/H2Title';
|
||||
import { Section } from '@/ui/layout/section/components/Section';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
|
||||
const StyledCardsContainer = styled.div`
|
||||
display: flex;
|
||||
@ -17,7 +16,6 @@ const StyledCardsContainer = styled.div`
|
||||
|
||||
export const SettingsAccountsSettingsSection = () => {
|
||||
const navigate = useNavigate();
|
||||
const isCalendarEnabled = useIsFeatureEnabled('IS_CALENDAR_ENABLED');
|
||||
|
||||
return (
|
||||
<Section>
|
||||
@ -38,7 +36,6 @@ export const SettingsAccountsSettingsSection = () => {
|
||||
<SettingsNavigationCard
|
||||
Icon={IconCalendarEvent}
|
||||
title="Calendar"
|
||||
soon={!isCalendarEnabled}
|
||||
onClick={() =>
|
||||
navigate(getSettingsPagePath(SettingsPath.AccountsCalendars))
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/componen
|
||||
import { NavigationDrawerItemGroup } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemGroup';
|
||||
import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection';
|
||||
import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
|
||||
export const SettingsNavigationDrawerItems = () => {
|
||||
const navigate = useNavigate();
|
||||
@ -36,7 +35,6 @@ export const SettingsNavigationDrawerItems = () => {
|
||||
navigate(AppPath.SignInUp);
|
||||
}, [signOut, navigate]);
|
||||
|
||||
const isCalendarEnabled = useIsFeatureEnabled('IS_CALENDAR_ENABLED');
|
||||
const billing = useRecoilValue(billingState);
|
||||
|
||||
return (
|
||||
@ -73,7 +71,6 @@ export const SettingsNavigationDrawerItems = () => {
|
||||
path={SettingsPath.AccountsCalendars}
|
||||
Icon={IconCalendarEvent}
|
||||
matchSubPages
|
||||
soon={!isCalendarEnabled}
|
||||
/>
|
||||
</NavigationDrawerItemGroup>
|
||||
</NavigationDrawerSection>
|
||||
|
@ -66,11 +66,10 @@ export const ShowPageRightContainer = ({
|
||||
const activeTabId = useRecoilValue(activeTabIdState);
|
||||
|
||||
const shouldDisplayCalendarTab =
|
||||
useIsFeatureEnabled('IS_CALENDAR_ENABLED') &&
|
||||
(targetableObject.targetObjectNameSingular ===
|
||||
targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Company ||
|
||||
targetableObject.targetObjectNameSingular ===
|
||||
CoreObjectNameSingular.Person);
|
||||
targetableObject.targetObjectNameSingular === CoreObjectNameSingular.Person;
|
||||
|
||||
const shouldDisplayLogTab = useIsFeatureEnabled('IS_EVENT_OBJECT_ENABLED');
|
||||
|
||||
const shouldDisplayEmailsTab =
|
||||
|
@ -1,6 +1,5 @@
|
||||
export type FeatureFlagKey =
|
||||
| 'IS_BLOCKLIST_ENABLED'
|
||||
| 'IS_CALENDAR_ENABLED'
|
||||
| 'IS_QUICK_ACTIONS_ENABLED'
|
||||
| 'IS_EVENT_OBJECT_ENABLED'
|
||||
| 'IS_AIRTABLE_INTEGRATION_ENABLED'
|
||||
|
@ -20,11 +20,6 @@ export const seedFeatureFlags = async (
|
||||
workspaceId: workspaceId,
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
workspaceId: workspaceId,
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
key: FeatureFlagKeys.IsAirtableIntegrationEnabled,
|
||||
workspaceId: workspaceId,
|
||||
|
@ -1,9 +1,4 @@
|
||||
import {
|
||||
Injectable,
|
||||
CanActivate,
|
||||
NotFoundException,
|
||||
ExecutionContext,
|
||||
} from '@nestjs/common';
|
||||
import { Injectable, CanActivate, NotFoundException } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { Repository } from 'typeorm';
|
||||
@ -13,12 +8,8 @@ import {
|
||||
GoogleAPIScopeConfig,
|
||||
GoogleAPIsStrategy,
|
||||
} from 'src/engine/core-modules/auth/strategies/google-apis.auth.strategy';
|
||||
import {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
||||
import { getRequest } from 'src/utils/extract-request';
|
||||
|
||||
@Injectable()
|
||||
export class GoogleAPIsProviderEnabledGuard implements CanActivate {
|
||||
@ -29,7 +20,7 @@ export class GoogleAPIsProviderEnabledGuard implements CanActivate {
|
||||
private readonly featureFlagRepository: Repository<FeatureFlagEntity>,
|
||||
) {}
|
||||
|
||||
async canActivate(context: ExecutionContext): Promise<boolean> {
|
||||
async canActivate(): Promise<boolean> {
|
||||
if (
|
||||
!this.environmentService.get('MESSAGING_PROVIDER_GMAIL_ENABLED') &&
|
||||
!this.environmentService.get('CALENDAR_PROVIDER_GOOGLE_ENABLED')
|
||||
@ -37,25 +28,12 @@ export class GoogleAPIsProviderEnabledGuard implements CanActivate {
|
||||
throw new NotFoundException('Google apis auth is not enabled');
|
||||
}
|
||||
|
||||
const transientToken = getRequest(context)?.query?.transientToken;
|
||||
|
||||
const scopeConfig: GoogleAPIScopeConfig = {
|
||||
isCalendarEnabled: false,
|
||||
isCalendarEnabled: !!this.environmentService.get(
|
||||
'MESSAGING_PROVIDER_GMAIL_ENABLED',
|
||||
),
|
||||
};
|
||||
|
||||
if (transientToken && typeof transientToken === 'string') {
|
||||
const { workspaceId } =
|
||||
await this.tokenService.verifyTransientToken(transientToken);
|
||||
|
||||
const isCalendarEnabledFlag = await this.featureFlagRepository.findOneBy({
|
||||
workspaceId,
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
value: true,
|
||||
});
|
||||
|
||||
scopeConfig.isCalendarEnabled = !!isCalendarEnabledFlag?.value;
|
||||
}
|
||||
|
||||
new GoogleAPIsStrategy(this.environmentService, scopeConfig);
|
||||
|
||||
return true;
|
||||
|
@ -5,10 +5,7 @@ import { Repository, EntityManager } from 'typeorm';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
import { TypeORMService } from 'src/database/typeorm/typeorm.service';
|
||||
import {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
||||
import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants';
|
||||
import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service';
|
||||
@ -76,15 +73,9 @@ export class GoogleAPIsService {
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
const isCalendarEnabledFlag = await this.featureFlagRepository.findOneBy({
|
||||
workspaceId,
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
value: true,
|
||||
});
|
||||
|
||||
const isCalendarEnabled =
|
||||
this.environmentService.get('CALENDAR_PROVIDER_GOOGLE_ENABLED') &&
|
||||
!!isCalendarEnabledFlag?.value;
|
||||
const isCalendarEnabled = this.environmentService.get(
|
||||
'CALENDAR_PROVIDER_GOOGLE_ENABLED',
|
||||
);
|
||||
|
||||
const connectedAccounts =
|
||||
await this.connectedAccountRepository.getAllByHandleAndWorkspaceMemberId(
|
||||
|
@ -17,7 +17,6 @@ import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/
|
||||
|
||||
export enum FeatureFlagKeys {
|
||||
IsBlocklistEnabled = 'IS_BLOCKLIST_ENABLED',
|
||||
IsCalendarEnabled = 'IS_CALENDAR_ENABLED',
|
||||
IsEventObjectEnabled = 'IS_EVENT_OBJECT_ENABLED',
|
||||
IsAirtableIntegrationEnabled = 'IS_AIRTABLE_INTEGRATION_ENABLED',
|
||||
IsPostgreSQLIntegrationEnabled = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
|
||||
|
@ -54,7 +54,6 @@ export class AddStandardIdCommand extends CommandRunner {
|
||||
},
|
||||
{
|
||||
IS_BLOCKLIST_ENABLED: true,
|
||||
IS_CALENDAR_ENABLED: true,
|
||||
IS_EVENT_OBJECT_ENABLED: true,
|
||||
IS_AIRTABLE_INTEGRATION_ENABLED: true,
|
||||
IS_POSTGRESQL_INTEGRATION_ENABLED: true,
|
||||
@ -69,7 +68,6 @@ export class AddStandardIdCommand extends CommandRunner {
|
||||
},
|
||||
{
|
||||
IS_BLOCKLIST_ENABLED: true,
|
||||
IS_CALENDAR_ENABLED: true,
|
||||
IS_EVENT_OBJECT_ENABLED: true,
|
||||
IS_AIRTABLE_INTEGRATION_ENABLED: true,
|
||||
IS_POSTGRESQL_INTEGRATION_ENABLED: true,
|
||||
|
@ -5,10 +5,7 @@ import { Repository } from 'typeorm';
|
||||
|
||||
import { MessageQueueJob } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface';
|
||||
|
||||
import {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { CalendarEventParticipantService } from 'src/modules/calendar/services/calendar-event-participant/calendar-event-participant.service';
|
||||
import { MessageParticipantService } from 'src/modules/messaging/services/message-participant/message-participant.service';
|
||||
|
||||
@ -40,16 +37,6 @@ export class MatchParticipantJob
|
||||
workspaceMemberId,
|
||||
);
|
||||
|
||||
const isCalendarEnabled = await this.featureFlagRepository.findOneBy({
|
||||
workspaceId,
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
value: true,
|
||||
});
|
||||
|
||||
if (!isCalendarEnabled || !isCalendarEnabled.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.calendarEventParticipantService.matchCalendarEventParticipants(
|
||||
workspaceId,
|
||||
email,
|
||||
|
@ -5,10 +5,7 @@ import { Repository } from 'typeorm';
|
||||
|
||||
import { MessageQueueJob } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface';
|
||||
|
||||
import {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { CalendarEventParticipantService } from 'src/modules/calendar/services/calendar-event-participant/calendar-event-participant.service';
|
||||
import { MessageParticipantService } from 'src/modules/messaging/services/message-participant/message-participant.service';
|
||||
|
||||
@ -40,16 +37,6 @@ export class UnmatchParticipantJob
|
||||
workspaceMemberId,
|
||||
);
|
||||
|
||||
const isCalendarEnabled = await this.featureFlagRepository.findOneBy({
|
||||
workspaceId,
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
value: true,
|
||||
});
|
||||
|
||||
if (!isCalendarEnabled || !isCalendarEnabled.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.calendarEventParticipantService.unmatchCalendarEventParticipants(
|
||||
workspaceId,
|
||||
email,
|
||||
|
@ -5,10 +5,7 @@ import { Repository, In } from 'typeorm';
|
||||
|
||||
import { MessageQueueJob } from 'src/engine/integrations/message-queue/interfaces/message-queue-job.interface';
|
||||
|
||||
import {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity';
|
||||
import { WorkspaceGoogleCalendarSyncService } from 'src/modules/calendar/services/workspace-google-calendar-sync/workspace-google-calendar-sync.service';
|
||||
@ -39,20 +36,9 @@ export class GoogleCalendarSyncCronJob implements MessageQueueJob<undefined> {
|
||||
})
|
||||
).map((workspace) => workspace.id);
|
||||
|
||||
const workspacesWithFeatureFlagActive =
|
||||
await this.featureFlagRepository.find({
|
||||
where: {
|
||||
workspaceId: In(workspaceIds),
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
value: true,
|
||||
},
|
||||
});
|
||||
|
||||
const dataSources = await this.dataSourceRepository.find({
|
||||
where: {
|
||||
workspaceId: In(
|
||||
workspacesWithFeatureFlagActive.map((w) => w.workspaceId),
|
||||
),
|
||||
workspaceId: In(workspaceIds),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import { CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
||||
@ -22,9 +20,6 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
||||
})
|
||||
@IsSystem()
|
||||
@IsNotAuditLogged()
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsCalendarEnabled,
|
||||
})
|
||||
export class CalendarChannelEventAssociationObjectMetadata extends BaseObjectMetadata {
|
||||
@FieldMetadata({
|
||||
standardId:
|
||||
|
@ -4,12 +4,10 @@ import {
|
||||
RelationMetadataType,
|
||||
RelationOnDeleteAction,
|
||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import { CALENDAR_CHANNEL_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
||||
@ -33,9 +31,6 @@ export enum CalendarChannelVisibility {
|
||||
})
|
||||
@IsSystem()
|
||||
@IsNotAuditLogged()
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsCalendarEnabled,
|
||||
})
|
||||
export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
|
||||
@FieldMetadata({
|
||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.connectedAccount,
|
||||
|
@ -4,7 +4,6 @@ import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/fi
|
||||
import { CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
@ -31,9 +30,6 @@ export enum CalendarEventParticipantResponseStatus {
|
||||
})
|
||||
@IsSystem()
|
||||
@IsNotAuditLogged()
|
||||
@Gate({
|
||||
featureFlag: 'IS_CALENDAR_ENABLED',
|
||||
})
|
||||
export class CalendarEventParticipantObjectMetadata extends BaseObjectMetadata {
|
||||
@FieldMetadata({
|
||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.calendarEvent,
|
||||
|
@ -1,14 +1,12 @@
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
||||
import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import {
|
||||
RelationMetadataType,
|
||||
RelationOnDeleteAction,
|
||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
||||
@ -30,9 +28,6 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
||||
})
|
||||
@IsSystem()
|
||||
@IsNotAuditLogged()
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsCalendarEnabled,
|
||||
})
|
||||
export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
||||
@FieldMetadata({
|
||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.title,
|
||||
@ -170,9 +165,6 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
inverseSideFieldKey: 'calendarEvent',
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: 'IS_CALENDAR_ENABLED',
|
||||
})
|
||||
calendarChannelEventAssociations: Relation<
|
||||
CalendarChannelEventAssociationObjectMetadata[]
|
||||
>;
|
||||
|
@ -19,10 +19,7 @@ import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/work
|
||||
import { MessageParticipantService } from 'src/modules/messaging/services/message-participant/message-participant.service';
|
||||
import { CalendarEventParticipantService } from 'src/modules/calendar/services/calendar-event-participant/calendar-event-participant.service';
|
||||
import { filterOutContactsFromCompanyOrWorkspace } from 'src/modules/connected-account/auto-companies-and-contacts-creation/utils/filter-out-contacts-from-company-or-workspace.util';
|
||||
import {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
|
||||
@Injectable()
|
||||
export class CreateCompanyAndContactService {
|
||||
@ -154,16 +151,6 @@ export class CreateCompanyAndContactService {
|
||||
transactionManager,
|
||||
);
|
||||
|
||||
const isCalendarEnabled = await this.featureFlagRepository.findOneBy({
|
||||
workspaceId,
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
value: true,
|
||||
});
|
||||
|
||||
if (!isCalendarEnabled || !isCalendarEnabled.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.calendarEventParticipantService.updateCalendarEventParticipantsAfterPeopleCreation(
|
||||
workspaceId,
|
||||
transactionManager,
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||
import {
|
||||
RelationMetadataType,
|
||||
@ -9,7 +8,6 @@ import {
|
||||
import { CONNECTED_ACCOUNT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
@ -126,8 +124,5 @@ export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
|
||||
inverseSideTarget: () => CalendarChannelObjectMetadata,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: FeatureFlagKeys.IsCalendarEnabled,
|
||||
})
|
||||
calendarChannels: Relation<CalendarChannelObjectMetadata[]>;
|
||||
}
|
||||
|
@ -16,10 +16,7 @@ import {
|
||||
DeleteConnectedAccountAssociatedMessagingDataJob,
|
||||
} from 'src/modules/messaging/jobs/delete-connected-account-associated-messaging-data.job';
|
||||
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
||||
import {
|
||||
FeatureFlagEntity,
|
||||
FeatureFlagKeys,
|
||||
} from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||
|
||||
@Injectable()
|
||||
export class MessagingConnectedAccountListener {
|
||||
@ -36,12 +33,6 @@ export class MessagingConnectedAccountListener {
|
||||
async handleDeletedEvent(
|
||||
payload: ObjectRecordDeleteEvent<ConnectedAccountObjectMetadata>,
|
||||
) {
|
||||
const isCalendarEnabled = await this.featureFlagRepository.findOneBy({
|
||||
workspaceId: payload.workspaceId,
|
||||
key: FeatureFlagKeys.IsCalendarEnabled,
|
||||
value: true,
|
||||
});
|
||||
|
||||
await this.messageQueueService.add<DeleteConnectedAccountAssociatedMessagingDataJobData>(
|
||||
DeleteConnectedAccountAssociatedMessagingDataJob.name,
|
||||
{
|
||||
@ -50,14 +41,12 @@ export class MessagingConnectedAccountListener {
|
||||
},
|
||||
);
|
||||
|
||||
if (isCalendarEnabled) {
|
||||
await this.calendarQueueService.add<DeleteConnectedAccountAssociatedCalendarDataJobData>(
|
||||
DeleteConnectedAccountAssociatedCalendarDataJob.name,
|
||||
{
|
||||
workspaceId: payload.workspaceId,
|
||||
connectedAccountId: payload.recordId,
|
||||
},
|
||||
);
|
||||
}
|
||||
await this.calendarQueueService.add<DeleteConnectedAccountAssociatedCalendarDataJobData>(
|
||||
DeleteConnectedAccountAssociatedCalendarDataJob.name,
|
||||
{
|
||||
workspaceId: payload.workspaceId,
|
||||
connectedAccountId: payload.recordId,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import {
|
||||
import { PERSON_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
@ -219,9 +218,6 @@ export class PersonObjectMetadata extends BaseObjectMetadata {
|
||||
inverseSideTarget: () => CalendarEventParticipantObjectMetadata,
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: 'IS_CALENDAR_ENABLED',
|
||||
})
|
||||
@IsSystem()
|
||||
calendarEventParticipants: Relation<CalendarEventParticipantObjectMetadata[]>;
|
||||
|
||||
|
@ -9,7 +9,6 @@ import {
|
||||
import { WORKSPACE_MEMBER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
||||
@ -243,9 +242,6 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
||||
inverseSideFieldKey: 'workspaceMember',
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@Gate({
|
||||
featureFlag: 'IS_CALENDAR_ENABLED',
|
||||
})
|
||||
calendarEventParticipants: Relation<CalendarEventParticipantObjectMetadata[]>;
|
||||
|
||||
@FieldMetadata({
|
||||
|
Loading…
Reference in New Issue
Block a user