Added option to prevent sending requests to twenty-icons (#16723)
Solution for #15891 https://github.com/user-attachments/assets/82ce5c4b-0a78-45a8-8196-413473887820 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+1
@@ -98,6 +98,7 @@ describe('ClientConfigController', () => {
|
||||
isImapSmtpCaldavEnabled: false,
|
||||
calendarBookingPageId: undefined,
|
||||
isTwoFactorAuthenticationEnabled: false,
|
||||
allowRequestsToTwentyIcons: true,
|
||||
isCloudflareIntegrationEnabled: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -195,6 +195,9 @@ export class ClientConfig {
|
||||
@Field(() => Boolean)
|
||||
isImapSmtpCaldavEnabled: boolean;
|
||||
|
||||
@Field(() => Boolean)
|
||||
allowRequestsToTwentyIcons: boolean;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
calendarBookingPageId?: string;
|
||||
|
||||
|
||||
+3
@@ -195,6 +195,9 @@ export class ClientConfigService {
|
||||
isImapSmtpCaldavEnabled: this.twentyConfigService.get(
|
||||
'IS_IMAP_SMTP_CALDAV_ENABLED',
|
||||
),
|
||||
allowRequestsToTwentyIcons: this.twentyConfigService.get(
|
||||
'ALLOW_REQUESTS_TO_TWENTY_ICONS',
|
||||
),
|
||||
calendarBookingPageId: isNonEmptyString(calendarBookingPageId)
|
||||
? calendarBookingPageId
|
||||
: undefined,
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import {
|
||||
} from 'src/engine/core-modules/__mocks__/mockFlatObjectMetadatas';
|
||||
import { FileService } from 'src/engine/core-modules/file/services/file.service';
|
||||
import { SearchService } from 'src/engine/core-modules/search/services/search.service';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager';
|
||||
import { WorkspaceCacheStorageService } from 'src/engine/workspace-cache-storage/workspace-cache-storage.service';
|
||||
|
||||
describe('SearchService', () => {
|
||||
let service: SearchService;
|
||||
@@ -18,8 +18,8 @@ describe('SearchService', () => {
|
||||
providers: [
|
||||
SearchService,
|
||||
{ provide: GlobalWorkspaceOrmManager, useValue: {} },
|
||||
{ provide: WorkspaceCacheStorageService, useValue: {} },
|
||||
{ provide: FileService, useValue: {} },
|
||||
{ provide: TwentyConfigService, useValue: { get: () => false } },
|
||||
],
|
||||
}).compile();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import { SEARCH_VECTOR_FIELD } from 'src/engine/metadata-modules/search-field-me
|
||||
import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager';
|
||||
import { type WorkspaceRepository } from 'src/engine/twenty-orm/repository/workspace.repository';
|
||||
import { type RolePermissionConfig } from 'src/engine/twenty-orm/types/role-permission-config';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
|
||||
type LastRanks = { tsRankCD: number; tsRank: number };
|
||||
|
||||
@@ -48,6 +49,7 @@ export class SearchService {
|
||||
constructor(
|
||||
private readonly globalWorkspaceOrmManager: GlobalWorkspaceOrmManager,
|
||||
private readonly fileService: FileService,
|
||||
private readonly twentyConfigService: TwentyConfigService,
|
||||
) {}
|
||||
|
||||
async getAllRecordsWithObjectMetadataItems({
|
||||
@@ -383,7 +385,10 @@ export class SearchService {
|
||||
flatFieldMetadataMaps,
|
||||
);
|
||||
|
||||
if (flatObjectMetadata.nameSingular === 'company') {
|
||||
if (
|
||||
flatObjectMetadata.nameSingular === 'company' &&
|
||||
this.twentyConfigService.get('ALLOW_REQUESTS_TO_TWENTY_ICONS')
|
||||
) {
|
||||
return getLogoUrlFromDomainName(record.domainNamePrimaryLinkUrl) || '';
|
||||
}
|
||||
|
||||
|
||||
@@ -161,6 +161,14 @@ export class ConfigVariables {
|
||||
})
|
||||
IS_IMAP_SMTP_CALDAV_ENABLED = true;
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.OTHER,
|
||||
description:
|
||||
"Enable or disable requests to twenty-icons to get companies' icons",
|
||||
type: ConfigVariableType.BOOLEAN,
|
||||
})
|
||||
ALLOW_REQUESTS_TO_TWENTY_ICONS = true;
|
||||
|
||||
@ConfigVariablesMetadata({
|
||||
group: ConfigVariablesGroup.MICROSOFT_AUTH,
|
||||
description: 'Enable or disable Microsoft authentication',
|
||||
|
||||
Reference in New Issue
Block a user