Skip to content

Commit

Permalink
Merge branch 'main' into use-label-html-element
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Oct 13, 2024
2 parents 7e42c73 + 73cb8c5 commit 67fbb38
Show file tree
Hide file tree
Showing 185 changed files with 23,248 additions and 18,653 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ Your turn 👇

» 11-October-2024 by [thefool76](https://oss.gg/thefool76) poster Link: [poster](https://drive.google.com/file/d/1cIC1eitvY6zKVTXKq2LnVrS_2Ho9H8-P/view?usp=sharing)

» 12-October-2024 by [Ionfinisher](https://oss.gg/Ionfinisher) poster Link: [poster](https://x.com/ion_finisher/status/1845168965963628802)

---
6 changes: 5 additions & 1 deletion oss-gg/twenty-design-challenges/2-design-new-logo-twenty.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Side Quest**: Design/Create new Twenty logo, tweet your design, and mention @twentycrm.
**Points**: 300 Points
**Proof**: Create a logo uploade it on any of the platform and add your oss handle and logo link to the list below.
**Proof**: Create a logo upload it on any of the platform and add your oss handle and logo link to the list below.

Please follow the following schema:

Expand All @@ -20,5 +20,9 @@ Your turn 👇

» 11-October-2024 by [thefool76](https://oss.gg/thefool76) Logo Link: [logo](https://drive.google.com/file/d/1DxSwNY_i90kGgWzPQj5SxScBz_6r02l4/view?usp=sharing) » tweet Link: [tweet](https://x.com/thefool1135/status/1844693487067034008)

» 13-October-2024 by [Atharva_404](https://oss.gg/Atharva-3000) Logo Link: [logo](https://drive.google.com/drive/folders/1XB7ELR7kPA4x7Fx5RQr8wo5etdZAZgcs?usp=drive_link) » tweet Link: [tweet](https://x.com/0x_atharva/status/1845421218914095453)

» 13-October-2024 by [Ionfinisher](https://oss.gg/Ionfinisher) Logo Link: [logo](https://drive.google.com/file/d/1l9vE8CIjW9KfdioI5WKzxrdmvO8LR4j7/view?usp=drive_link) » tweet Link: [tweet](https://x.com/ion_finisher/status/1845466470429442163)


---
9 changes: 9 additions & 0 deletions oss-gg/twenty-side-quest/1-quote-tweet-20-oss-gg-launch.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Your turn 👇

////////////////////////////

» 13-October-2024 by Vanshika Dargan
» Link to Tweet: https://x.com/VanshikaDargan/status/1845467453108949123

» 13-October-2024 by Utsav Bhattarai
» Link to Tweet: https://x.com/utsavdotdev/status/1845417863462649900

» 10-October-2024 by Devansh Baghel
» Link to Tweet: https://x.com/DevanshBaghel5/status/1844359648037748954

Expand All @@ -28,3 +34,6 @@ Your turn 👇

» 11-October-2024 by Aritra Sadhukhan
» Link to Tweet: https://x.com/AritraDevelops/status/1844670236512878646

» 13-October-2024 by Nabhag Motivaras
» Link to Tweet: https://x.com/NabhagMotivaras/status/1845449144695218357
3 changes: 3 additions & 0 deletions oss-gg/twenty-side-quest/4-meme-magic.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ Your turn 👇
» 11-October-2024 by Bhavesh Mishra
» Link to Tweet: https://x.com/thefool1135/status/1844458836402503931

» 12-October-2024 by Chirag Arora
» Link to Tweet: https://x.com/Chirag8023/status/1845108226527994222

---
7 changes: 7 additions & 0 deletions oss-gg/twenty-side-quest/5-gif-magic.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ Your turn 👇
» 11-October-2024 by Bhavesh Mishra
» Link to gif: https://shorturl.at/yln9H

» 12-October-2024 by Chirag Arora
» Link to gif: https://giphy.com/gifs/yCJIS2MGbBdifbnuj0

» 13-October-2024 by Nabhag Motivaras
» Link to gif: https://giphy.com/gifs/twenty-twentycrm-opensourcecrm-wCcsmnJuzzzGrfuf9B


---
2 changes: 1 addition & 1 deletion packages/twenty-emails/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twenty-emails",
"version": "0.31.0",
"version": "0.32.0-canary",
"description": "",
"author": "",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/twenty-front/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "twenty-front",
"version": "0.31.0",
"version": "0.32.0-canary",
"private": true,
"type": "module",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/twenty-front/src/generated-metadata/gql.ts

Large diffs are not rendered by default.

130 changes: 128 additions & 2 deletions packages/twenty-front/src/generated-metadata/graphql.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { isObjectRecordConnectionWithRefs } from '@/object-record/cache/utils/is
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
import { isDefined } from '~/utils/isDefined';

export const triggerDeleteRecordsOptimisticEffect = ({
export const triggerDestroyRecordsOptimisticEffect = ({
cache,
objectMetadataItem,
recordsToDelete,
recordsToDestroy,
objectMetadataItems,
}: {
cache: ApolloCache<unknown>;
objectMetadataItem: ObjectMetadataItem;
recordsToDelete: RecordGqlNode[];
recordsToDestroy: RecordGqlNode[];
objectMetadataItems: ObjectMetadataItem[];
}) => {
cache.modify<StoreObject>({
Expand All @@ -36,8 +36,7 @@ export const triggerDeleteRecordsOptimisticEffect = ({

const rootQueryCachedObjectRecordConnection = rootQueryCachedResponse;

const recordIdsToDelete = recordsToDelete.map(({ id }) => id);

const recordIdsToDestroy = recordsToDestroy.map(({ id }) => id);
const cachedEdges = readField<RecordGqlRefEdge[]>(
'edges',
rootQueryCachedObjectRecordConnection,
Expand All @@ -52,7 +51,7 @@ export const triggerDeleteRecordsOptimisticEffect = ({
cachedEdges?.filter((cachedEdge) => {
const nodeId = readField<string>('id', cachedEdge.node);

return nodeId && !recordIdsToDelete.includes(nodeId);
return nodeId && !recordIdsToDestroy.includes(nodeId);
}) || [];

if (nextCachedEdges.length === cachedEdges?.length)
Expand All @@ -62,27 +61,22 @@ export const triggerDeleteRecordsOptimisticEffect = ({
...rootQueryCachedObjectRecordConnection,
edges: nextCachedEdges,
totalCount: isDefined(totalCount)
? totalCount - recordIdsToDelete.length
? totalCount - recordIdsToDestroy.length
: undefined,
};
},
},
});

recordsToDelete.forEach((recordToDelete) => {
recordsToDestroy.forEach((recordToDestroy) => {
triggerUpdateRelationsOptimisticEffect({
cache,
sourceObjectMetadataItem: objectMetadataItem,
currentSourceRecord: recordToDelete,
currentSourceRecord: recordToDestroy,
updatedSourceRecord: null,
objectMetadataItems,
});

cache.modify({
id: cache.identify(recordToDelete),
fields: {
deletedAt: () => recordToDelete.deletedAt,
},
});
cache.evict({ id: cache.identify(recordToDestroy) });
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -65,50 +65,45 @@ export const triggerUpdateRecordOptimisticEffect = ({
const rootQueryFilter = rootQueryVariables?.filter;
const rootQueryOrderBy = rootQueryVariables?.orderBy;

const shouldTryToMatchFilter = isDefined(rootQueryFilter);

if (shouldTryToMatchFilter) {
const updatedRecordMatchesThisRootQueryFilter =
isRecordMatchingFilter({
record: updatedRecord,
filter: rootQueryFilter,
objectMetadataItem,
});
const updatedRecordMatchesThisRootQueryFilter = isRecordMatchingFilter({
record: updatedRecord,
filter: rootQueryFilter ?? {},
objectMetadataItem,
});

const updatedRecordIndexInRootQueryEdges =
rootQueryCurrentEdges.findIndex(
(cachedEdge) =>
readField('id', cachedEdge.node) === updatedRecord.id,
);

const updatedRecordIndexInRootQueryEdges =
rootQueryCurrentEdges.findIndex(
(cachedEdge) =>
readField('id', cachedEdge.node) === updatedRecord.id,
);

const updatedRecordFoundInRootQueryEdges =
updatedRecordIndexInRootQueryEdges > -1;

const updatedRecordShouldBeAddedToRootQueryEdges =
updatedRecordMatchesThisRootQueryFilter &&
!updatedRecordFoundInRootQueryEdges;

const updatedRecordShouldBeRemovedFromRootQueryEdges =
!updatedRecordMatchesThisRootQueryFilter &&
updatedRecordFoundInRootQueryEdges;

if (updatedRecordShouldBeAddedToRootQueryEdges) {
const updatedRecordNodeReference = toReference(updatedRecord);

if (isDefined(updatedRecordNodeReference)) {
rootQueryNextEdges.push({
__typename: getEdgeTypename(objectMetadataItem.nameSingular),
node: updatedRecordNodeReference,
cursor: '',
});
}
}
const updatedRecordFoundInRootQueryEdges =
updatedRecordIndexInRootQueryEdges > -1;

const updatedRecordShouldBeAddedToRootQueryEdges =
updatedRecordMatchesThisRootQueryFilter &&
!updatedRecordFoundInRootQueryEdges;

const updatedRecordShouldBeRemovedFromRootQueryEdges =
!updatedRecordMatchesThisRootQueryFilter &&
updatedRecordFoundInRootQueryEdges;

if (updatedRecordShouldBeRemovedFromRootQueryEdges) {
rootQueryNextEdges.splice(updatedRecordIndexInRootQueryEdges, 1);
if (updatedRecordShouldBeAddedToRootQueryEdges) {
const updatedRecordNodeReference = toReference(updatedRecord);

if (isDefined(updatedRecordNodeReference)) {
rootQueryNextEdges.push({
__typename: getEdgeTypename(objectMetadataItem.nameSingular),
node: updatedRecordNodeReference,
cursor: '',
});
}
}

if (updatedRecordShouldBeRemovedFromRootQueryEdges) {
rootQueryNextEdges.splice(updatedRecordIndexInRootQueryEdges, 1);
}

const rootQueryNextEdgesShouldBeSorted = isDefined(rootQueryOrderBy);

if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApolloCache } from '@apollo/client';

import { triggerAttachRelationOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerAttachRelationOptimisticEffect';
import { triggerDeleteRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerDeleteRecordsOptimisticEffect';
import { triggerDestroyRecordsOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerDestroyRecordsOptimisticEffect';
import { triggerDetachRelationOptimisticEffect } from '@/apollo/optimistic-effect/utils/triggerDetachRelationOptimisticEffect';
import { CORE_OBJECT_NAMES_TO_DELETE_ON_TRIGGER_RELATION_DETACH } from '@/apollo/types/coreObjectNamesToDeleteOnRelationDetach';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
Expand Down Expand Up @@ -122,10 +122,10 @@ export const triggerUpdateRelationsOptimisticEffect = ({
);

if (shouldCascadeDeleteTargetRecords) {
triggerDeleteRecordsOptimisticEffect({
triggerDestroyRecordsOptimisticEffect({
cache,
objectMetadataItem: fullTargetObjectMetadataItem,
recordsToDelete: targetRecordsToDetachFrom,
recordsToDestroy: targetRecordsToDetachFrom,
objectMetadataItems,
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ describe('useCommandMenu', () => {
'ab7901eb-43e1-4dc7-8f3b-cdee2857eb9a',
imageIdentifierFieldMetadataId: null,
fields: [],
indexMetadatas: [],
},
]);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect } from 'react';
import { useCallback, useEffect } from 'react';

import { ObjectMetadataItemNotFoundError } from '@/object-metadata/errors/ObjectMetadataNotFoundError';
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
Expand All @@ -20,7 +20,7 @@ export const PromiseRejectionEffect = () => {
},
);
} else {
enqueueSnackBar(`Error: ${event.reason}`, {
enqueueSnackBar(`${error.message}`, {
variant: SnackBarVariant.Error,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,38 +47,36 @@ export const initialFavorites = [
},
];

export const sortedFavorites = [
{
"avatarType": "rounded",
"avatarUrl": "",
"id": "1",
"labelIdentifier": " ",
"link": "/object/person/1",
"position": 0,
"recordId": "1",
"workspaceMemberId": undefined,
},
{
"avatarType": "rounded",
"avatarUrl": "",
"id": "2",
"labelIdentifier": " ",
"link": "/object/person/3",
"position": 1,
"recordId": "3",
"workspaceMemberId": undefined,
},
{
"avatarType": "squared",
"avatarUrl": "example.com",
"id": "3",
"key": "8f3b2121-f194-4ba4-9fbf-2d5a37126806",
"labelIdentifier": "favoriteLabel",
"link": "example.com",
"position": 2,
"recordId": "1",
},
]
export const sortedFavorites = [
{
id: '1',
recordId: '2',
position: 0,
avatarType: 'squared',
avatarUrl: undefined,
labelIdentifier: 'ABC Corp',
link: '/object/company/2',
},
{
id: '2',
recordId: '4',
position: 1,
avatarType: 'squared',
avatarUrl: undefined,
labelIdentifier: 'Company Test',
link: '/object/company/4',
},
{
id: '3',
position: 2,
key: '8f3b2121-f194-4ba4-9fbf-2d5a37126806',
labelIdentifier: 'favoriteLabel',
avatarUrl: 'example.com',
avatarType: 'squared',
link: 'example.com',
recordId: '1',
},
];

export const mocks = [
{
Expand Down Expand Up @@ -343,8 +341,8 @@ export const mocks = [
mutation DeleteOneFavorite($idToDelete: ID!) {
deleteFavorite(id: $idToDelete) {
__typename
deletedAt
id
deletedAt
}
}
`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { findAvailableTimeZoneOption } from '@/localization/utils/findAvailableTimeZoneOption';

describe('findAvailableTimeZoneOption', () => {
it('should find the matching available IANA time zone select option from a given IANA time zone', () => {
const ianaTimeZone = 'Europe/Paris';
const expectedOption = {
label: '(GMT+02:00) Central European Summer Time - Paris',
value: 'Europe/Paris',
};

const option = findAvailableTimeZoneOption(ianaTimeZone);

expect(option).toEqual(expectedOption);
});
});
Loading

0 comments on commit 67fbb38

Please sign in to comment.