-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize metadata queries #7013
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request optimizes metadata queries and updates authentication mechanisms across multiple components of the Twenty server.
- Replaced JwtAuthGuard with WorkspaceAuthGuard and UserAuthGuard in various resolvers and controllers for more granular authentication
- Introduced a new utility function
getObjectMetadata
inget-object-metadata.util.ts
for efficient metadata retrieval - Updated
workspace-schema.factory.ts
to useobjectMetadataMap
instead ofobjectMetadataCollection
for improved performance - Removed
defaultWorkspace
relation from user query injwt.auth.strategy.ts
, potentially affecting existing features - Added feature flag check for 'IsCopilotEnabled' in
ai-sql-query.resolver.ts
to control access to AI SQL query feature
30 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings
@@ -12,15 +12,16 @@ import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Typo in the import path. Remove 'copy' from the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { UserService } from 'src/engine/core-modules/user/services/user.service'; | ||
import { User } from 'src/engine/core-modules/user/user.entity'; | ||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | ||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | ||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | ||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | ||
import { CaptchaGuard } from 'src/engine/core-modules/captcha/captcha.guard'; | ||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Typo in import path. Remove 'copy' from the end of the file name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -141,7 +142,7 @@ export class AuthResolver { | |||
} | |||
|
|||
@Mutation(() => AuthorizeApp) | |||
@UseGuards(JwtAuthGuard) | |||
@UseGuards(WorkspaceAuthGuard, UserAuthGuard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Similar guard change here. Verify that WorkspaceAuthGuard and UserAuthGuard provide the same level of security as JwtAuthGuard.
@@ -155,7 +156,7 @@ export class AuthResolver { | |||
} | |||
|
|||
@Mutation(() => AuthTokens) | |||
@UseGuards(JwtAuthGuard) | |||
@UseGuards(WorkspaceAuthGuard, UserAuthGuard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Another instance of guard replacement. Test thoroughly to ensure all affected endpoints still function correctly.
@@ -186,7 +187,7 @@ export class AuthResolver { | |||
return await this.authService.impersonate(impersonateInput.userId, user); | |||
} | |||
|
|||
@UseGuards(JwtAuthGuard) | |||
@UseGuards(WorkspaceAuthGuard) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Only WorkspaceAuthGuard is used here. Confirm if UserAuthGuard is intentionally omitted for this mutation.
@@ -16,7 +16,8 @@ import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: The import path for UserAuthGuard seems to have a typo. It includes 'copy' at the end, which might be unintentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,7 +10,8 @@ import { GetMessagesService } from 'src/engine/core-modules/messaging/services/g | |||
import { UserService } from 'src/engine/core-modules/user/services/user.service'; | |||
import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: The import path for UserAuthGuard contains 'copy' which seems to be a typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -7,9 +7,10 @@ import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: Typo in import path. 'user-auth.guard copy' should be 'user-auth.guard'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/twenty-server/src/engine/metadata-modules/field-metadata/field-metadata.service.ts
Show resolved
Hide resolved
} from 'src/engine/api/graphql/graphql-query-runner/errors/graphql-query-runner.exception'; | ||
import { ObjectMetadataMapItem } from 'src/engine/metadata-modules/utils/generate-object-metadata-map.util'; | ||
|
||
export const getObjectMetadata = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OrThrow?
@@ -12,15 +12,16 @@ import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { UserService } from 'src/engine/core-modules/user/services/user.service'; | ||
import { User } from 'src/engine/core-modules/user/user.entity'; | ||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | ||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | ||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | ||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | ||
import { CaptchaGuard } from 'src/engine/core-modules/captcha/captcha.guard'; | ||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -16,7 +16,8 @@ import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,7 +10,8 @@ import { GetMessagesService } from 'src/engine/core-modules/messaging/services/g | |||
import { UserService } from 'src/engine/core-modules/user/services/user.service'; | |||
import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -7,9 +7,10 @@ import { User } from 'src/engine/core-modules/user/user.entity'; | |||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity'; | |||
import { AuthUser } from 'src/engine/decorators/auth/auth-user.decorator'; | |||
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator'; | |||
import { JwtAuthGuard } from 'src/engine/guards/jwt.auth.guard'; | |||
import { UserAuthGuard } from 'src/engine/guards/user-auth.guard copy'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
workspaceId: fieldMetadataInput.workspaceId, | ||
}, | ||
relations: ['fields'], | ||
order: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
In this PR: 1. Refactor guards to avoid duplicated queries: WorkspaceAuthGuard and UserAuthGuard only check for existence of workspace and user in the request without querying the database
* Remove performance logs (#6709) We have found the root cause of the issue: - when using a datasource (including the cached ones), we are fetching ObjectMetadataCollection from cache (700kB). Datasource usage is happening any time we are using twentyORM, which is everywhere in the jobs and in some resolvers (including the GetCurrentUser one). This is leading to a high load on redis and leading to the performance issues we are seeing. - we actually don't need to fetch this objectMetadataCollection while using a cached datasource, only when we instantiate a new one * Fix webhook issue (#6711) Fix [#web](https://github.com/orgs/twentyhq/projects/1/views/3?pane=issue&itemId=75329194) This PR does 2 things: - migrate webhooks to TwentyORM - Fix inversion between objectNameSingular and operation in webhook eventName. It is stored as {objectNameSingular}.{operation} and we were querying {operation}.{objectNameSingular} * Bump version to 0.23.2 * corrected targetableobject being undefined when clicked on create task in command menu (#6635) Issue #6630 It seems this bug is caused by `targetableObjects` being assigned an empty array, which then leads to an error due to it being undefined. I've made some changes that should address the issue, but I would appreciate any feedback or suggestions on alternative solutions. Please let me know if there is a better approach to resolving this. Thank you! https://github.com/user-attachments/assets/d6409798-3320-49b3-834f-2b6888847ed8 * Trigger workflow run manually (#6696) Fix https://github.com/twentyhq/twenty/issues/6669 - create a commun function `startWorkflowRun` that both create the run object and the job for executing the workflow - use it in both the `workflowEventJob` and the `runWorkflowVersion` endpoint Bonus: - use filtering for exceptions instead of a util. It avoids doing a try catch in all endpoint * Check workflow version is valid before publishing (#6702) Fix https://github.com/twentyhq/twenty/issues/6670 * Fix logging error in webhook system * Make workspaceMemberId optional in JWT for workspaces that are not ACTIVE (#6714) WorkspaceMemberId is mandatory in the jwt token generated for a given user on a given workspace. However, when a user signs up, it does not have a workspaceMemberId yet. * TWNTY-6135 - Improve Data Importer Select Matching (#6338) ### Description: - we move all logic about the unmatchedOptions to a new component called UnmatchColumn, because as it will be a full line in the table, it was better to update where the component will be rendered - In the latest changes to keep the columns when we change the step to step 3 and go back to step 2, we added a fallback state initialComputedColumnsState that saves the columns and only reverts the updates when we go back to step 1 or close by clicking the X button ### Refs: #6135 ``` It was necessary to add references and floating styles to the generic component to fix the bug when the last option was open and the dropdown was being hidden in the next row of the spreadsheet table. We fixed the same problem that occurs in the companies table as well ``` we used this approach mentioned on this documentation to be able to use the hook without calling it on each component, we are calling only once, on the shared component <https://floating-ui.com/docs/useFloating#elements>\ before: ![](https://assets-service.gitstart.com/25493/2c994e0f-6548-4a9e-8b22-2c6eccb73b2e.png) now: ![](https://assets-service.gitstart.com/25493/f56fd516-7e95-4616-b1ed-c9ea5195a8ae.png)### Demo: <https://jam.dev/c/e0e0b921-7551-4a94-ac1c-8a50c53fdb0c> Fixes #6135 NOTES: the enter key are not working on main branch too --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: Lucas Bordeau <[email protected]> * 6687 change messaging import cron job to run every minute (#6704) Closes #6687 * Update workflow version struct (#6716) We want to avoid the nested structure of active pieces. Steps to execute will now be separated from the trigger. It will be an array executed sequentially. For now a step can only be an action. But at some point it will also be a branch or a loop * Created a specific scroll wrapper context per scroll wrapper and made ScrollTop and ScrollLeft componentStates (#6645) @lucasbordeau @charlesBochet Issue #4826 Could u review this changes. Let me know what do you think. --------- Co-authored-by: Lucas Bordeau <[email protected]> * 6686 Add try catch on every cron job, and send exception to exceptionHandler (#6705) Closes #6686 --------- Co-authored-by: Charles Bochet <[email protected]> * Add isInactive to FieldMetadata decorator (#6623) This PR was created by [GitStart](https://gitstart.com/) to address the requirements from this ticket: [TWNTY-4145](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-4145). This ticket was imported from: [TWNTY-4145](https://github.com/twentyhq/twenty/issues/4145) --- ### Description This PR introduces the @isInActive() decorator to the standard field metadata. \ - This gives the ability to allow workspaces to be able to be created with standard fields as inactive *Helps prevent polluting existing workspaces - A new standard field can be added to* eg company-workspace-entity.ts and the @WorkspaceIsInActive() decorator can be added to create it in deactivated mode sync-metadata command: `yarn command:prod workspace:sync-metadata -f` ### Refs #4145 ### Demo <https://www.loom.com/share/10c13e2614d749809cfe2d2d847e963e?sid=017bbfcf-53c6-4205-8ffc-8a09c416220a>\ <https://www.loom.com/share/6ab86bd36f344c999cb8dacdb82c7bb0?sid=13ac78a2-de44-4772-bb54-7b57975e7360>\ Fixes: #4145 --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: Charles Bochet <[email protected]> * 6654 serverless functions add a deploy button disable deploy when autosave (#6715) - improvements on serverless function behavior (autosave performances, deploy on execution only) - add versioning to serverless functions - add a publish endpoint to create a new version of a serverless function - add deploy and reset to lastVersion button in the settings section: <img width="736" alt="image" src="https://github.com/user-attachments/assets/2001f8d2-07a4-4f79-84dd-ec74b6f301d3"> * chore: upgrade aws-sdk v2 to v3 (#6643) (#6693) Fixes (#6643) - According to `aws-sdk` v3, each service is packaged as a separate module, and the codebase uses all of the required AWS services accordingly. Therefore, removing the direct dependency on `aws-sdk:v2` to resolve the warning shown in (#6643) Co-authored-by: Charles Bochet <[email protected]> * Fix addition of new option in select field if there are no existing options (#6718) Fixes [sentry](https://twenty-v7.sentry.io/issues/5745628875/?alert_rule_id=15135099&alert_type=issue¬ification_uuid=95108411-b431-4abd-bdd6-687c96a7353e&project=4507072563183616&referrer=discord) * [Fix] Prevent fields name conflicts with composite subfields names (#6713) At field creation we are checking the availability of the name by comparing it to the other fields' names' on the object; but for composite fields the fields' names' as indicated in the repository do not exactly match the column names' on the tables (e.g "createdBy" field is actually represented by columns createdByName, createdBySource etc.). In this PR we prevent the conflict with the standard composite fields' names. There is still room for errors with the custom composite fields: for example a custom composite field "address" of type address on a custom object "listing" will introduce the columns addressAddressStreet1, addressAddressStreet2 etc. while we won't prevent the user from later creating a custom field named "addressAddressStreet1". For now I decided not to tackle this as this seem extremely edgy + would impact performance on creation of all fields while never actually useful (I think). * Fix sentry issue (#6719) https://twenty-v7.sentry.io/issues/5677123076/?environment=prod&project=4507072499810304&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=7d&stream_index=12 Removes billing section when is_free_access_enabled * Added hotkeyScopes to serverless functions in settings (#6710) Fixes #6656 Is this the right way to implement keyboard listeners? Please let me know, I'll make the changes accordingly. :) https://github.com/user-attachments/assets/af71d340-ead9-4659-81e6-a440522a194f --------- Co-authored-by: Lucas Bordeau <[email protected]> * Fix serverless save when name empty (#6720) - fix serverless function error on save when name empty - remove useless unique constraint on serverless function names * Visualize Workflows (#6697) ## Features - Fetch a workflow and display it in a tree with the React Flow library - The nodes are positioned by an algorithm - The feature is put behind a feature flag. The `/workflow/:id` route is disabled if the flag is off. - I started implementing a right drawer. That's a big WIP and it will be finished in another PR. ## How to test this feature 1. Create a workflow instance in the database through a GraphQL query. See below for instructions. 2. After enabling the feature flag, you should be able to see the workflow you created in the workflows list. To visualize the workflow, go to the `/workflow/:id` page where the id is the id of the workflow. See the video for a quick way to do so. ```gql // First mutation createWorkflow($data: WorkflowCreateInput!) { createWorkflow(data: $data) { id } } // Result { "data": { "name": "test" } } // Second mutation createWorkflowVersion($data: WorkflowVersionCreateInput!) { createWorkflowVersion (data: $data) { id } } // Result { "data": { "name": "v1", "trigger": { "name": "trigger", "displayName": "New or Updated Row", "type": "DATABASE_EVENT", "settings": { "eventName": "company.created", "triggerName": "Company Created" }, "nextAction": { "name": "step_1", "displayName": "Code", "type": "CODE", "valid": true, "settings": { "serverlessFunctionId": "function_id", "errorHandlingOptions": { "retryOnFailure": { "value": false }, "continueOnFailure": { "value": false } } } } }, "workflowId": "workflow_id" } } ``` https://github.com/user-attachments/assets/42bbd98c-5e13-447c-9307-461a18ac2195 * Fix table re-renders on update field (#6722) The update of all fields was caused by `useContextSelector` not being properly implemented. As it is a memoization library the `useRecordFieldValue` hook wasn't giving to the library the required things to allow memoization. I just added recordId + fieldName to the memoization function so that `useContextSelector` doesn't recompute itself whenever any record changes. * Fix currency field edition form (#6723) This PR was created by [GitStart](https://gitstart.com/) to address the requirements from this ticket: [TWNTY-6692](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6692). This ticket was imported from: [TWNTY-6692](https://github.com/twentyhq/twenty/issues/6692) --- ### Description The problem is not related to the API, what was happening was a failure in the form validation, because in the changed file, the `currencyCode` value, which should be a string with single quotes around it, was receiving single quotes again, unnecessarily, and this affected field validation in `packages/twenty-front/src/modules/object-record/record-field/validation-schemas/currencyFieldDefaultValueSchema.ts` please, make this change below before testing the PR(to fix a bug, the slice is not updated yet):\ <https://github.com/twentyhq/twenty/commit/aa4ae53fb497d292f9b2319012482b942cbecfa5> ### Demo <https://www.loom.com/share/2ce130f2e2fe46868e9b1e9119f65cde?sid=dbcb2da2-3641-423c-bdfc-01b0fc52162a> ### Refs #6692 Fixes #6692 --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: Marie Stoppa <[email protected]> * Fix twenty-front performances (#6744) I have investigated the performance of our frontend vite build: `npx nx run twenty:start` of `npx nx run twenty:build` RAM usage: - 160Mb: vite serve - background typescript checker: 2.5GB - background eslint checker: 3.5GB I'm introducing two environment variables in FE .env to disable these checkers on lower configuration (and to disable them from CD build): ``` # VITE_DISABLE_TYPESCRIPT_CHECKER=true # VITE_DISABLE_ESLINT_CHECKER=true ``` * Increase front build max memory usage for sourcemaps build * [Fix] Move save button to top on field edit (#6739) Before <img width="802" alt="image" src="https://github.com/user-attachments/assets/2a9d9501-6bd4-4dc2-b8d7-98a29816caab"> After <img width="871" alt="Capture d’écran 2024-08-26 à 12 17 29" src="https://github.com/user-attachments/assets/b6cb688c-fdcd-4b10-8d91-197245f7dd56"> * E2E tests (#6717) Continuation of #6644 Now chromium browser is used in workspaces tests instead of firefox and screenshots after each test are properly saved in one folder when run from IDE and from terminal using `yarn test:e2e` command * View becomes blank after deleting select (#6703) This PR was created by [GitStart](https://gitstart.com/) to address the requirements from this ticket: [TWNTY-6027](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6027). This ticket was imported from: [TWNTY-6027](https://github.com/twentyhq/twenty/issues/6027) --- ### Description - Delete corresponding view simultaneously once select field is deactivated instead of deleted because the bug happens on the deactivation (one step before deleting), confirmation: <https://discord.com/channels/1130383047699738754/1268662542172028971/1270367244509249651> - Is still possible to create Kanban views with deactivated Select fields, but this is not related to the PR. - The changes on the frontend are for refreshing the data after the view deletion ### Refs #6027 ### Demo <https://www.loom.com/share/4f705344e3054cd5b3d5eadd398d2c9c?sid=8db3d8b9-4dce-4e31-8359-0e31cbc0e2e7> Fixes #6027 --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: Lucas Bordeau <[email protected]> * Added sync status on the FE (#6730) Issue #6685 How do we make sure we get the latest syncStatus on the frontend? For now we dont get it unless refreshed. useInterval() on fetching account details? * Increase front build max memory usage for sourcemaps build * Fix Website build CD (#6751) Website CD has been broken by the recent addition of typeorm patch in root package.json Our current vision is to add npm package to each twenty-package package.json directly * [POC] add graphql query runner (#6747) ## Context The goal is to replace pg_graphql with our own ORM wrapper (TwentyORM). This PR tries to add some parsing logic to convert graphql requests to send to the ORM to replace pg_graphql implementation. --------- Co-authored-by: Charles Bochet <[email protected]> * Fix twenty-front build (#6752) * 6256 refactor messaging module to remove all provider specific code and put it inside the drivers folders (#6721) Closes #6256 Closes #6257 + Create custom exceptions --------- Co-authored-by: Charles Bochet <[email protected]> * Add function execution throttler (#6742) Add throttler service to limit the number of function execution * Improve record table scroll look (#6753) We had a regression on the record table as our inView hook was not able to find the right div to compute its margin. This is because we are identify this div by a hacky css selector as we don't have a direct control on it (it's provided by our scrolling library) * 6655 remove field direction in message and add it in mcma (#6743) Closes #6655 - Remove direction from message - Add direction do mcma - Create migration command - Create upgrade 0.24 * 5617 Create CalendarOngoingStaleCron Job (#6748) Closes #5617 --------- Co-authored-by: Charles Bochet <[email protected]> * Fix post merge conflicts on messaging services * Fix post merge conflicts on messaging services * Fix message direction seeds (#6760) Direction is now on mcma and no longer on message * Add workflow statuses (#6765) Following figma updates https://www.figma.com/design/PNBfTgOVraw557OXChYagk/Explo?node-id=21872-7929&t=DOUzd6rzwr6lprcs-0 - No activity targets for workflow entities for now - Adding a direct relation between workflow run et workflow - Adding a status on the version (draft, active, deactivated) - Adding a list of statuses on workflow - publishedVersionId => lastPublishedVersionId Also adding: - the endpoint to deactivate a version * Added "Add record" button in kanban view column headers dropdown (#6649) Closes #4629 Refactored `RecordBoardColumnNewOpportunityButton` and `RecordBoardColumnNewButton` to use the same logic in dropdown. I kept those hooks inside `record-board-column` where these buttons are. Let me know if it should be placed somewhere else. Also Added navigation state preservation when clicked on `edit from settings` Thanks :) --------- Co-authored-by: Lucas Bordeau <[email protected]> * Fix participant listeners (#6767) Fixes a bug where all the messagesParticipants and the calendarEventParticipants were linked to a contact after its restoration. * added "reply in gmail" button (#6754) Issue https://github.com/twentyhq/twenty/issues/4217 * fix: defaultHomePagePath to be last visited page or alphatically first active object with the name (#6629) ### ISSUE - Closes #6612 - Closes #6125 - Closes #5949 - Closes #6652 ### Description - [x] need to check changes in jest test. - [x] fallback to alphabetically firstActiveObject with the name if no last visited exist https://github.com/user-attachments/assets/dd11480b-c47f-4393-9857-8a55467061e3 - [x] fallback to last visited page with the last visited view by default if no views would have toggled with subNav or viewChangeDropdown it will fallback to INDEX or if no INDEX view then zero position view, works with both subNavViewBar and viewChangeDropdown. https://github.com/user-attachments/assets/33e97e55-2aa2-4c45-a3ab-fc8e43f4964c https://github.com/user-attachments/assets/d1db76a2-da59-4cd2-81bf-d6119408fbbf - [x] lastVisited view across the objects have been persisted so now navigating back from x object to y or z to x will open always last visited view and defaults to index or zero position view. https://github.com/user-attachments/assets/70a01a11-a7ef-4031-926e-02923551466c - [x] lastVisited Page with view has been persisted across the workspace, scope is per workspace so jumping between workspace will also work to have lastvisited object of particular workspace. https://github.com/user-attachments/assets/25107339-8ec1-4421-9f6e-1da43b8f4816 - [x] when lastVisitedObject has been deactivated and going back from settings should have a fallback Object that is alphabetically First activeObject. https://github.com/user-attachments/assets/6b24a933-b139-49ac-82b2-eac5e4848516 - [x] Creation of new View of **anyType** should also get persist and that should get lastVisitedObject with View in case the user leaves from there right away. https://github.com/user-attachments/assets/80ff7114-051d-4e9b-ab58-0e1e3a7d328c - [x] Similarly deleted view also works. https://github.com/user-attachments/assets/cb0b8043-fba4-4a66-941d-b3fa0a57eb22 - [x] fixed active subnav background when opening object directly with root path **/** , it wasn't showing active subNav background. Before: https://github.com/user-attachments/assets/db341c4a-f1f9-43c4-9838-37d1a1f5ab8e Fixed: https://github.com/user-attachments/assets/0f0fd492-bc5d-4efe-b695-bee4e3f41d4e --------- Co-authored-by: Lucas Bordeau <[email protected]> * Removed drag grip and accent is now tertiary in hidden fields (#6650) Closes #6115 This change successfully addresses the issue as described. However, it also causes the primary non-draggable field, `Name`, to render without a draggable handle and with a secondary accent. Is this an acceptable outcome? https://github.com/user-attachments/assets/4bc15e00-6c73-41d4-8342-4e36487d0981 --------- Co-authored-by: Lucas Bordeau <[email protected]> * Improve Data Importer Select Matching - Post Merge Updates (#6750) This PR was created by [GitStart](https://gitstart.com/) to address the requirements from this ticket: [TWNTY-6135-1](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6135-1). --- ### Description This [PR](https://github.com/twentyhq/twenty/pull/6338) was merged, but the reviewr asked for some changes in another PR https://github.com/twentyhq/twenty/pull/6338#pullrequestreview-2255006727 ### Refs https://github.com/twentyhq/twenty/pull/6338 ### Demo <https://jam.dev/c/80336c7a-4536-4a58-b531-981bac81cb26> Co-authored-by: gitstart-twenty <[email protected]> * refactor graphql query runner connection mapper (#6771) * Add composite Emails field and forbid creation of Email field type (#6689) ### Description 1. - We are introducing new field type(Emails) - We are Forbiding creation of Email field - We Added support for filtering and sorting on Emails field - We are using the same display mode as used on the Links field type (chips), check the Domain field of the Company object - We are also using the same logic of the link when editing the field \ How To Test\ Follow the below steps for testing locally:\ 1. Checkout to TWENTY-6261\ 2. Reset database using "npx nx database:reset twenty-server" command\ 3. Run both the backend and frontend app\ 4. Go to Settings/Data model and choose one of the standard objects like people\ 5. Click on Add Field button and choose Emails as the field type \ ### Refs #6261\ \ ### Demo \ <https://www.loom.com/share/22979acac8134ed390fef93cc56fe07c?sid=adafba94-840d-4f01-872c-dc9ec256d987> Co-authored-by: gitstart-twenty <[email protected]> * fix: relation and record chip height (#6758) # ISSUE - Closes #6756 After Changes: https://github.com/user-attachments/assets/1885be11-b50a-4b05-afae-d2f02a403ad6 https://github.com/user-attachments/assets/edc6a913-95a6-4c75-8ec2-83e2c27fddb0 * fix/6759: reduce icon size in note grip menu to 16px and adjust conta… (#6780) ### Summary This pull request addresses issue #6759 by adjusting the icon size and container padding in the note grip menu. The 6-dot icon's size has been reduced from 20px to 16px, while the container size has been kept at 20px to maintain the proper alignment and spacing. ### Changes Made - **Icon Size**: Reduced the SVG icon size to 16x16px. - **Container Size**: Ensured the container remains 20x20px to accommodate the icon and maintain visual consistency. ### Screenshots <img width="1440" alt="Screenshot 2024-08-29 at 3 26 41 AM" src="https://github.com/user-attachments/assets/d8618636-165a-440d-a41e-947b2aa00bdb"> ### Related Issue - [Issue #6759] ### Testing - Verified that the icon and container sizes are correctly displayed in the note grip menu. - Ensured no other UI elements were affected by these changes. Please review the changes and let me know if any additional modifications are required. Thank you! Co-authored-by: Rishi Kant <[email protected]> * Added ability to search objects and fields (#6775) Closes #6770 https://github.com/user-attachments/assets/e3134389-30d2-48c8-bbca-34209d5ae66d * chore(*): remove unused code (#6781) The code removed in the PR was flagged as unused by the JetBrains inspector. I did a QA on the dev environment but other checks are highly recommended. There is one commit by scope to make the review easier. --------- Co-authored-by: Charles Bochet <[email protected]> * Fixed record table fetch more scroll bug (#6790) Fetch more on the record table was causing a strange bug where it was auto scrolling to the bottom of the newly loaded chunk of rows. This was confusing because we lost our previous position in the record table. With this fix the table doesn't scroll when more rows are loaded. The fetch more row has been moved in the same tbody as the rest of the rows. We now only hide it when there is no more record to fetch. --------- Co-authored-by: Charles Bochet <[email protected]> * 0.24 changelog (#6787) * Bump version to 0.24 (#6789) As title * Update wording on soft deletes * Add instructions to migrate to 0.24 version * Created a breadcrumb for left nav menu sub items (#6762) Closes https://github.com/twentyhq/twenty/issues/6484 <img width="270" alt="image" src="https://github.com/user-attachments/assets/3cfd7a5a-5239-4998-87f7-a9b45e3b5229"> * Create new steps in workflow editor (#6764) This PR adds the possibility of creating new steps. For now, only actions are available. The steps are stored on the server, and the visualizer is reloaded to include them. Selecting a step opens the right drawer and shows its details. For now, it's only the id of the step, but in the future, it will be the parameters of the step. In the future we'll want to let users add steps at any point in the diagram. As a consequence, it's crucial to be able to walk in the tree that make the steps to find the correct place where to put the new step. I wrote a function that returns where the new step should be inserted. This function will become recursive once we get branching implemented. Things to mention: - Reactflow needs every node and edge to have a unique identifier. In this PR, I chose to use steps' id as nodes' id. That way, it's easy to move from a node to a step, which helps make operations on a step without resolving the step's id from the node's id. * Set statuses on workflows (#6792) Add listener to keep status on workflows up to date: - version draft => statuses should contain draft - version active => statuses should contain active - version deactivated => if no version active, statuses should contain deactivated Renaming also the endpoints because it was not reflecting the full behaviour. Finally, adding a new status Archived for versions. Will be used when a version is deactivated, but is not the last published version anymore. It means this version cannot be re-activated. * Fix CI errored tasks for front (#6806) In this PR: - revert de-optimization of icons bundle for storybook. This was forcing the browser to load ~3k files while running stories - adding lazy loading on Settings route to improve developer experience (some files will be loaded later) - fix FE tests: unit, modules stories, pages stories --------- Co-authored-by: Charles Bochet <[email protected]> * Increase storybook pages code coverage * fix: EmailThreads and Calendar making one extra graphql requests even total records are fetched (#6814) ## ISSUE (BUG) - Closes #5282 ## Description - [x] Email Threads Tab was making two graphql requests **[GetTimelineThreadsFromCompanyId]** when navigating after a first render of record page, once only, later it was making only one. - [x] Similarly Calendar Tab **[GetTimelineCalendarEventsFromCompanyId]** ### Before https://github.com/user-attachments/assets/c234b7b4-fe7d-4655-92d6-0a6817fda6b5 ### After https://github.com/user-attachments/assets/80af33c7-b801-4377-a59a-47c43e0fecdd Co-authored-by: Charles Bochet <[email protected]> * fix: Updated Button states for pages and minor UI fix (#6812) ## Description #6811 - Deleted button lacked `accent danger` on options menu - Customize fields `onhover` lacked width to cover entire div tag - Deactivate button lacked variant ## After <img width="305" alt="Screenshot 2024-08-31 at 1 43 29 AM" src="https://github.com/user-attachments/assets/82852227-e7d2-4327-a8cc-8f9f0e84f488"> <img width="229" alt="Screenshot 2024-08-31 at 1 09 31 AM" src="https://github.com/user-attachments/assets/4783dd5a-a8ab-41b5-83d5-95425b6bebc4"> <img width="163" alt="Screenshot 2024-08-31 at 1 07 49 AM" src="https://github.com/user-attachments/assets/33ec9928-6463-4797-bfc4-b40a927ec8ec"> --------- Co-authored-by: Charles Bochet <[email protected]> * 6657 Refactor and fix blocklist (#6803) Closes #6657 - Fix listeners - Refactor jobs to take array of events - Fix calendar events and messages deletion --------- Co-authored-by: Charles Bochet <[email protected]> * fix: Deactivate & Activate icons should be swapped UI improvements (#6796) ## Fix This fixes the minor UI issue #6795 in which it addressed the following two problems- 1. Fixed the Icon switch 2. Updated the Delete Modal ## Screenshots <img width="314" alt="Screenshot 2024-08-30 at 1 38 31 AM" src="https://github.com/user-attachments/assets/2a3e2363-6c0e-493e-825a-5a84121ccc3d"> <img width="168" alt="Screenshot 2024-08-30 at 1 39 13 AM" src="https://github.com/user-attachments/assets/51b48b85-070f-4656-a42d-31db0baebca3"> <img width="182" alt="Screenshot 2024-08-30 at 1 39 23 AM" src="https://github.com/user-attachments/assets/6ac958eb-34eb-44b8-a588-30813a567f3e"> * Add set custom object is soft deletable command (#6788) ## Context Custom object were not automatically created as softDeletable, this has been fixed in a recent PR. This PR adds a command to backfill existing custom objects. We also introduce a baseCommandRunner and ActiveWorkspacesCommandRunner to put some boilerplate and simplify future commands. ## Test ```bash yarn command:prod upgrade-0-24:set-custom-object-is-soft-deletable [Nest] 75852 - 08/29/2024, 5:16:41 PM LOG [SetCustomObjectIsSoftDeletableCommand] Running command on 2 workspaces query: UPDATE "metadata"."objectMetadata" SET "isSoftDeletable" = $1, "updatedAt" = CURRENT_TIMESTAMP WHERE ("workspaceId" IN ($2, $3) AND "isCustom" = $4 AND "isSoftDeletable" = $5) -- PARAMETERS: [true,"3b8e6458-5fc1-4e63-8563-008ccddaa6db","20202020-1c25-4d02-bf25-6aeccf7ea419",true,false] [Nest] 75852 - 08/29/2024, 5:16:41 PM LOG [SetCustomObjectIsSoftDeletableCommand] Updated 1 entities [Nest] 75852 - 08/29/2024, 5:16:41 PM LOG [SetCustomObjectIsSoftDeletableCommand] Command completed! ``` ```bash yarn command:prod upgrade-0-24:set-custom-object-is-soft-deletable -d [Nest] 75424 - 08/29/2024, 5:16:14 PM LOG [SetCustomObjectIsSoftDeletableCommand] Running command on 2 workspaces [Nest] 75424 - 08/29/2024, 5:16:14 PM LOG [SetCustomObjectIsSoftDeletableCommand] Dry run mode: No changes will be applied query: SELECT "ObjectMetadataEntity"."id" AS "ObjectMetadataEntity_id" FROM "metadata"."objectMetadata" "ObjectMetadataEntity" WHERE (("ObjectMetadataEntity"."workspaceId" IN ($1, $2)) AND ("ObjectMetadataEntity"."isCustom" = $3) AND ("ObjectMetadataEntity"."isSoftDeletable" = $4)) -- PARAMETERS: ["3b8e6458-5fc1-4e63-8563-008ccddaa6db","20202020-1c25-4d02-bf25-6aeccf7ea419",true,false] [Nest] 75424 - 08/29/2024, 5:16:14 PM LOG [SetCustomObjectIsSoftDeletableCommand] Dry run: 1 entities would be updated [Nest] 75424 - 08/29/2024, 5:16:14 PM LOG [SetCustomObjectIsSoftDeletableCommand] Command completed! ``` ```bash yarn command:prod upgrade-0-24:set-custom-object-is-soft-deletable -w 20202020-1c25-4d02-bf25-6aeccf7ea419 -w 20202020-1c25-4d02-bf25-6aeccf7ea419 query: UPDATE "metadata"."objectMetadata" SET "isSoftDeletable" = $1, "updatedAt" = CURRENT_TIMESTAMP WHERE ("workspaceId" IN ($2, $3) AND "isCustom" = $4) -- PARAMETERS: [true,"20202020-1c25-4d02-bf25-6aeccf7ea419","20202020-1c25-4d02-bf25-6aeccf7ea419",true] [Nest] 70588 - 08/29/2024, 5:11:31 PM LOG [SetCustomObjectIsSoftDeletableCommand] Updated 2 entities [Nest] 70588 - 08/29/2024, 5:11:31 PM LOG [SetCustomObjectIsSoftDeletableCommand] Command completed! ``` --------- Co-authored-by: Charles Bochet <[email protected]> * Make custom objects soft deletable by default (#6768) Fixes #6766 * fix: Fixed API typo and webhook checkerror (#6779) ## Issue 1.There was an Api typo with API under Developers section #6778 2. Webhook lacked an check method for the `TextInput` #6774 ## After- <img width="649" alt="Screenshot 2024-08-29 at 2 13 21 AM" src="https://github.com/user-attachments/assets/bc9595f8-533f-430e-bc18-56373983eec8"> https://github.com/user-attachments/assets/8e2b06bc-308a-48ad-8ecb-9d0a130877bc --------- Co-authored-by: Charles Bochet <[email protected]> * Serverless function improvements (#6769) - add layer for lambda execution - add layer for local execution - add package resolve for the monaco editor - add route to get installed package for serverless functions - add layer versioning * Prevent workflow version from bad update (#6848) Closes https://github.com/twentyhq/twenty/issues/6840 - Add query-hooks folder in common. Will be followed by hooks for workflows and runs - When updating a version, ensure the status is draft and that the status is not manually updated * chore: improve the softdelete style (#6846) ## This PR - Fix #6836 <img width="1296" alt="Screenshot 2024-09-02 at 17 54 31" src="https://github.com/user-attachments/assets/cc1411b6-87f3-425f-b7e7-a1ba20c2993a"> * Updated MultiItemFieldInput to display current value properly (#6857) * fix: securing tasks and notes all view (#6869) ISSUE - Closes #6863 * Ability to filter on DATE fields (#6299) (#6824) This was surprisingly quick, it was already built, just not enabled. Let's double check it together still on Monday @FelixMalfait! * Field name is oddly displayed when long (#6755) ### Description - we added a new styled component to handle the label styles - we added the title prop, and this will be applied for all fields, track the styles and only adding the title if the label is hidden would add unnecessary complexity to this issue, let us know if It's fine - On our internal QA review, we noticed this extra error in the name:\ when we have spaces between the characters on names the name is displayed in a weird way ![](https://assets-service.gitstart.com/28455/b3933bec-f5ec-48b9-a627-744507bc9fad.png) when we don't have spaces we use the space on the right to fit the full name\ like this: ![](https://assets-service.gitstart.com/28455/77aec9d1-7875-4164-b2ce-97ccee7fb25e.png)Do you want us to fix this problem too? when testing the new changes since we changed one component that is used on the main pages we created objects with a big name, to test the header on the table view, and we noticed that the object name has exactly the same issue as the field name on the settings page. !\[image\](<https://github.com/user-attachments/assets/cfa3a0a3-da98-4b09-9650-178ace05bcbf>) we added a fix for new field creation if the object name is long ![](https://assets-service.gitstart.com/28455/99faef48-99b4-480e-ae6d-71aa40030434.png)### Refs #6738 ### Demo <https://www.loom.com/share/3572fb0c4e994b0aaac52985e76ae4fd?sid=9ef177e2-827b-45f2-8083-60771eef6203> Fixes #6738 --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: Marie Stoppa <[email protected]> * update refresh token expires in (#6879) Fixes https://github.com/twentyhq/twenty/issues/6598 Updating the refresh token default value to a much more common threshold, this can still be overridden with env variables when needed. Example of the refresh token mechanism from the fronted side <img width="679" alt="Screenshot 2024-09-03 at 16 05 12" src="https://github.com/user-attachments/assets/7e618ab1-12b9-48cb-a93e-e27974ad2425"> <img width="673" alt="Screenshot 2024-09-03 at 16 05 22" src="https://github.com/user-attachments/assets/f4d08315-1f5b-4f4a-a86a-a9cd9cdf9b01"> * Add workflow query hooks (#6876) Workflow version : - prevent status to be update manually - prevent creation / deletion in another status than draft - prevent creation if a draft already exists Workflow: - prevent statuses to set manually WorkflowRun: - prevent all manual operations * Enable payload without status update (#6881) As title * fix: Updated Menu item font size (#6884) ## Description This PR solves the issue #6878. Updated the font size from 12 px to 13 px. ## Before <img width="156" alt="Screenshot 2024-09-03 at 11 46 58 PM" src="https://github.com/user-attachments/assets/d4077ecc-0a14-4802-a4d7-9b03c4e419bd"> ## After <img width="154" alt="Screenshot 2024-09-03 at 11 47 33 PM" src="https://github.com/user-attachments/assets/fd6ff0e3-0212-44e3-ba01-864ea9f4c5c6"> * Fix bug bypassing verification in confirmation modal when pressing Enter (#6889) # Description Fix bug bypassing verification in the confirmation modal when pressing Enter # Demo Tested for webhook case (similar to other cases): 1. Press Enter when invalid verification => not delete webhook 2. Press Enter when valid verification => delete webhook https://github.com/user-attachments/assets/81aa0aaa-7361-4584-b7ae-b29525f33664 # Ref Fixes #6663 * fix(6423): add username and password for redis connection (#6745) Co-authored-by: pbb <[email protected]> * Check if user wants to run make postgres-on-linux (#6819) Fix #6319 Now script checks if user wants to run the script, the default is no, so user has explicitly type `y` or `Y` in order to run it. * Fix unauthorized error handling (#6835) from @BOHEUS comments in #6640 - fix bad 500 error when authentication invalid - remove "id", "createdAt", "updatedAt", etc from creation and update paths schema - improve error message - remove "id" from test body - improve secondaryLink schema description - improve depth parameter description - remove required from response body - improve examples - improve error message formatting - fix filter by position - answered to negative float position @BOHEUS comment Also: - fix secondary field openapi field description - remove schema display in playground Screenshots ![image](https://github.com/user-attachments/assets/a5d52afd-ab10-49f3-8806-ee41b04bc775) ![image](https://github.com/user-attachments/assets/33f985bb-ff75-42f6-a0bb-741bd32a1d08) * Update workflow nodes configuration (#6861) - Improve the design of the right drawer - Allow to update the trigger of the workflow: the object and the event listened to - Allow to update the selected serverless function that a code action should execute - Change how we determine which workflow version to display in the visualizer. We fetch the selected workflow's data, including whether it has a draft or a published version. If the workflow has a draft version, it gets displayed; otherwise, we display the last published version. - I used the type `WorkflowWithCurrentVersion` to forward the currently edited workflow with its _current_ version embedded across the app. - I created single-responsibility hooks like `useFindWorkflowWithCurrentVersion`, `useFindShowPageWorkflow`, `useUpdateWorkflowVersionTrigger` or `useUpdateWorkflowVersionStep`. - I updated the types for workflow related objects, like `Workflow` and `WorkflowVersion`. See `packages/twenty-front/src/modules/workflow/types/Workflow.ts`. - This introduced the possibility to have `null` values for triggers and steps. I made the according changes in the codebase and in the tests. - I created a utility function to extract both parts of object-event format (`company.created`): `packages/twenty-front/src/modules/workflow/utils/splitWorkflowTriggerEventName.ts` * Fixed view reset on view change (#6897) Fixes #6833 The view states for unsaved changes were not reseted on view change. The fix was to just add a call to the existing resetCurrentView when the viewId changes in the related effect. * Fix restore event sent to webhooks (#6905) We were sending the wrong event when restoring a record (delete instead of create) * Add workspace favorites behind feature flag (#6904) - make member nullable on favorites - add potential relation with view entity - add a new type of favorite list in front : workspace favorite - build a new component for retrieving workspace favorite to display + refacto the existing one Bonus: - removing activities seed since this is deprecated * Display workflow visualizer on show page (#6894) - Removed the route I previously used to visualize workflows - Created another tab in the `<ShowPageRightContainer />` component in which we display the visualizer Questions: - Should I use a feature flag to hide the feature? Closes #6858 * fix: Api text typo in ApiKeyInput.tsx (#6916) (#6918) ## Issue Closes (#6916) There was an `Api` typo with API under Developer section while copying the API Key to clipboard in the status popup which is now corrected to `API`. * fix: Minor UI fixes in Settings page (#6915) ## Description This PR fixes the issue #6887. ## Current Behaviour - https://github.com/user-attachments/assets/6e53f7f5-7fed-4482-9c67-fb33969429ab - <img width="539" alt="Screenshot 2024-09-04 at 10 25 14 AM" src="https://github.com/user-attachments/assets/a1a1f8ac-8069-4b07-9ca1-d0c77596ff3b"> ## Expected behavior - https://github.com/user-attachments/assets/63e92a6a-6be5-4d0a-b42f-d4310492b8b4 - <img width="226" alt="Screenshot 2024-09-04 at 10 36 49 AM" src="https://github.com/user-attachments/assets/94e360c2-26ed-41f3-8943-dfee2b6c2a48"> * Fixed open table cell triggering (#6910) Open table cell was triggered by a click on a field input. This is a temporary solution. I fixed it for DoubleTextInput but it might be problematic for other field types as well, we should implement a kind of bubbling shield to make sure that no click event can bubble up to trigger things like open table cell in the above components that shouldn't listen. See https://github.com/twentyhq/twenty/issues/6909 * added scroll wrapper for ShowPageActivityContainer (#6903) fixes #6902 * Enables creating an opportunityCard instantly if company field is disabled (#6316) (#6911) fixes #6316 --------- Co-authored-by: martmull <[email protected]> * Fix lint (#6922) * multiselect for onetomany relations (#6892) Issue #4345 used `useUpdateRelationFromManyFieldInput` hook from `FieldInput` to `updateRelation`. Creating a seperate hook didnt made sense when it basically does the same thing. However renaming the hook to something generic would make sense so that its not tied to `FieldInput` according to naming convention followup issue to tackle - #6890 https://github.com/user-attachments/assets/452372ea-2699-45fd-9edf-ded36abdbca2 --------- Co-authored-by: Weiko <[email protected]> * fix: settings search field bottom padding (#6920) ## ISSUE - Closes #6919 * Adds KeyBoard Navigation to ObjectFilterDropDownFilterSelect ( #4365 ) (#6613) fixes #4365 --------- Co-authored-by: Lucas Bordeau <[email protected]> * Added new view to select types for objects (#6700) Issue #6496 Hi team, Is this the right approach for handling type selection with states and conditional rendering, or should these be managed on separate pages altogether? Please let me know Ill make changes accordingly :) I’m also working on styling the buttons according to the Figma design and will be moving constants like categoryDescriptions and categories to the constants folder. Thanks for your guidance! https://github.com/user-attachments/assets/452bea9f-4d0a-4472-9941-421b54cda47f --------- Co-authored-by: Lucas Bordeau <[email protected]> Co-authored-by: Charles Bochet <[email protected]> * Adds secondary color and styles to code snippets in block note editor ( #6029 ) (#6928) fixes https://github.com/twentyhq/twenty/issues/6929 --------- Co-authored-by: Lucas Bordeau <[email protected]> * added timeout to avoid appending of blocks (#6725) @FelixMalfait fixes #6724 Thanks :) --------- Co-authored-by: Lucas Bordeau <[email protected]> * fix: Minor bugs in notes pages (#6914) ## Descripion This PR fixed the issue #6913 ## Currently behavior <img width="646" alt="Screenshot 2024-09-06 at 1 12 33 AM" src="https://github.com/user-attachments/assets/60f3ec83-5976-40b1-a89e-01f28b8e809b"> <img width="244" alt="Screenshot 2024-09-06 at 1 13 31 AM" src="https://github.com/user-attachments/assets/89b77e03-fe58-4fab-88e2-f121d6e7eb72"> ## Expected behaviour <img width="585" alt="Screenshot 2024-09-06 at 1 15 07 AM" src="https://github.com/user-attachments/assets/206d4f65-c9d1-449a-8f05-f485116157ae"> <img width="242" alt="Screenshot 2024-09-06 at 1 15 20 AM" src="https://github.com/user-attachments/assets/88cd6acd-bb8e-4cf3-b5cf-169cb51c9f91"> Co-authored-by: Lucas Bordeau <[email protected]> * Fixed page inputs style layout bugs (#6899) ## Description This PR resolves the issue #6870 - Adjusted width for all textInput - `240px` - Added responsiveness to Address field - [ ] To add Blur to background text component ## Before <img width="421" alt="Screenshot 2024-09-05 at 11 57 40 AM" src="https://github.com/user-attachments/assets/24f55e35-660e-4263-9bb0-ab363893e63b"> <img width="443" alt="Screenshot 2024-09-05 at 11 57 54 AM" src="https://github.com/user-attachments/assets/656e93f6-ec48-41b7-b92f-06f9bfc779f2"> ## After <img width="377" alt="Screenshot 2024-09-05 at 11 51 37 AM" src="https://github.com/user-attachments/assets/f323930c-a8bf-4d38-9ed8-db43b86209b1"> <img width="427" alt="Screenshot 2024-09-05 at 11 52 26 AM" src="https://github.com/user-attachments/assets/f34922fc-4687-4842-a85a-e28b603d47ae"> <img width="429" alt="Screenshot 2024-09-05 at 11 52 50 AM" src="https://github.com/user-attachments/assets/f3016e57-1214-408f-9f5b-ee34d9caaf5d"> --------- Co-authored-by: Lucas Bordeau <[email protected]> * Update SettingsDevelopersApiKeyDetail.tsx typo (#6937) Corrected typo error of Expiration description in which it was "diasbled" to "disabled". * fix: Notes not visible in Timeline activities (#6936) ## Description - This PR solves #6935 #6934 - fixed the notes color in timeline activities which was not visible in dark mode - fixed spelling typo ## Before <img width="626" alt="Screenshot 2024-09-08 at 12 28 03 PM" src="https://github.com/user-attachments/assets/7c532c6b-af3f-4af6-baa1-be134d2142a6"> <img width="1195" alt="Screenshot 2024-09-08 at 12 20 27 PM" src="https://github.com/user-attachments/assets/2fb868b0-b66c-485f-b574-1beaf83bfb23"> ## After <img width="561" alt="Screenshot 2024-09-08 at 12 27 53 PM" src="https://github.com/user-attachments/assets/937e11ff-77ef-4170-b1ef-dc9cbfa86166"> <img width="1194" alt="Screenshot 2024-09-08 at 12 19 17 PM" src="https://github.com/user-attachments/assets/12455593-051d-490d-bc53-f5c5699f9c97"> * Prevent fullWidth from being passed to Link ie <a> (#6893) fixes #6825 * sort task groups reverse alphabetically by their status (#6886) This PR Solves #6830 ## Issue Summary The tasks are grouped by their respective statuses and displayed on the ui. The grouping is performed by `lodash.groupBy` which doesn't maintain explicit ordering of the keys. ## Fix Sort the tasks groups array by their status on the basis of reverse-alphabetical order before generating task component for each task data. #### Why reverse alphabetical? It implicitly sorts the statuses as per the order `TODO` -> `IN_PROGRESS` -> `DONE` Caveats: 1. Changing the name of one or more status might result in a different unwanted order. 2. `null` is unhandled, although the original code doesn't allow for nulls as status while displaying ### Alternative Fix Maintain an explicit ordering of the statuses and sort the tasks accordingly. --------- Co-authored-by: Lucas Bordeau <[email protected]> * fix: ability to create empty kanban (#6951) ## ISSUE - Closes #6946 * minor fix - removed scrollwrapper stylings for SettingsPageContainer (#6949) @Bonapara fixes https://github.com/twentyhq/twenty/pull/6700#issuecomment-2322817298 * Bump version to 0.24.2 (#6955) * Fix/object detail recordcell tooltip (#6908) Fixes for https://github.com/twentyhq/twenty/issues/6596 ![image](https://github.com/user-attachments/assets/69014a93-a61c-4b6a-bffa-33fdb31a8511) --------- Co-authored-by: martmull <[email protected]> * Fixes multi-select search not working ( #6800 ) (#6964) fixes #6800 * Fixed the overflow height of the Developers page's table (#6963) Ref: https://github.com/twentyhq/twenty/issues/6962 As of now, if user has more than 20 API keys or webhooks, whole page has scroll, when for the end user (UX) it'd be better if each table had it's own scroll. * added button in nav bar for kanban view (#6829) @Bonapara Addressing issue #6783. I tried to achieve the exact behavior you were looking for, but I couldn't get the dropdown to render correctly in that specific column. I'd love some help to make sure it's working as expected! 😊 Most of the logic is shared with the `useHandleOpportunity` and `useAddNewCard` hooks, which could be refactored to reduce code debt. Also, please go harsh with the review because I know there's a lot of code cleaning required. I also agree with Charles's point in [this comment](https://github.com/twentyhq/twenty/issues/6783#issuecomment-2323299840). Thanks :) https://github.com/user-attachments/assets/bccdb3f1-3946-4e22-b9a4-b7496ef134c9 * Adds secondary color and styling to code blocks using theme varibales ( #6029 ) (#6931) Follow-up of #6929, this PR just changes the hard coded values to theme values. * Fix note linked text in timeline view (in dark mode) (#6944) This PR Fixes https://github.com/twentyhq/twenty/issues/6942 Other improvements : - Fetch activities (note and task) title only when loading timeline, so we don't always have a clickable title. - Fixed IconButton width regression. --------- Co-authored-by: Lucas Bordeau <[email protected]> * Support for multiple values in the Phone field (#6882) ### Description - This is the first PR on Phones field; - We are introducing new field type(Phones) - We are Forbidding creation of Phone field - We Added support for filtering and sorting on Phones field - We are using the same display mode as used on the Links field type (chips), check the Domain field of the Company object - We are also using the same logic of the link when editing the field **How to Test** 1. Checkout to TWNTY-6260 branch 2. Reset database using "npx nx database:reset twenty-server" command 3. Add custom field of type Phones in settings/data-model **Loom Video:**\ <https://www.loom.com/share/3c981260be254dcf851256d020a20ab0?sid=58507361-3a3b-452c-9de8-b5b1abda70ac> ### Refs #6260 Co-authored-by: gitstart-twenty <[email protected]> * Fix not possible to edit options (#6979) We have recently merged: https://github.com/twentyhq/twenty/pull/6700 However, this introduced a regression on field edition as we have removed the type dropdown from the field edition page. This dropdown was wrapped into a controller setting the type on the form. Without this type, the form is considered as invalid and cannot be saved. I'm setting the form values through useForm. I'm unhappy with this PR for too reasons: - usage of activeMetadataField?.icon ?? '' format because I cannot call useForm conditionnally. This would imply splitting the component into several components to avoid this issue - usage of react hook form which is very hard to debug, we should remove it from the project * [Flexible-schema] Add findOne and fix findMany pagination + soft-delete for graphql-query-runner (#6978) * Fixed CI (#6982) Fixed CI : - Unit test for useTimelineActivities - Story for field creation with new 2-step process * Refactor graphql query runner + fix nested or (#6986) * Add relations to notes/tasks list view (#6971) <img width="664" alt="Screenshot 2024-09-10 at 17 00 11" src="https://github.com/user-attachments/assets/37132805-ff67-4d28-b664-b03da680e166"> --------- Co-authored-by: Lucas Bordeau <[email protected]> * 6658 workflows add a first twenty piece email sender (#6965) * add contibuting_example.md (#6998) add a contributing_example.md on folder .github --------- Co-authored-by: Félix Malfait <[email protected]> * Set all standard objects soft deletable (#7006) * Refactor metadata caching (#7011) This PR introduces the following changes: - add the metadataVersion to all our metadata cache keys to ease troubleshooting: <img width="1146" alt="image" src="https://github.com/user-attachments/assets/8427805b-e07f-465e-9e69-1403652c8b12"> - introduce a cache recompute lock to avoid overloading the database to recompute the cache many time * Scaffold empty workflow (#6926) - Create a workflow version when the user visits an empty workflow. - If the trigger is not defined yet and the user selects either the standard object type or the event type first, we automatically select the first option of the other value. Indeed, every state update is automatically saved on the backend and we need both standard object and event types to save the event name. - Introduces a change in the backend. I removed the assertions that throw when a workflow version is not complete, that is, when it doesn't have a defined trigger, which is the case when scaffolding a new workflow with a first empty workflow version. - We should keep validating the workflow versions, at least when we publish them. That should be done in a second step. * Handle migration of Email to Emails fields (#6885) This is the second PR on TWNTY-6261 which handlesdata migration of Email field to Emails field.\ \ How to Test?\ Firstly make sure that you have completed the testing steps on first PR then follow the below steps: - Checkout to TWNTY-6261-emails-migrations branch - Rebuild typescript using "npx nx build twenty-server" - Run command "yarn command:prod upgrade-0.25" to do migration\ \ Loom Video:\ <https://www.loom.com/share/f82b8d29f8f64f92abe3c59c01147b45?sid=9f8ccc05-aa38-4c49-b139-fd0823066273> **Testing Messaging Sync functionality:** Please watch the below video to see that the synchronization of contacts is working fine after migrating Email field to Emails field:\ <https://www.loom.com/share/400949464b244272b78c25e338cc6ab2?sid=103f6625-5933-4b99-9825-0fed33782f36> **Question to the client** should we rename email to emails here? in the DomainName PR, the name did not change. ```typescript @WorkspaceField({ standardId: PERSON_STANDARD_FIELD_IDS.email, type: FieldMetadataType.EMAILS, label: 'Email', description: 'Contact’s Email', icon: 'IconMail', }) email: EmailsMetadata; ``` **Test Messaging Sync** This pr will update messaging sync files so the changes shouldn't break existing functionality of importing people and companies in the app.\ To test messaging sync you should follow the below steps:\ 1. you need to connect a google account to see the importing functionality. For this purpose you have to create a project inside Google Cloud. But to make things easier you can use the below credentials of an already created project. Put them in .env of twenty-server package: ```properties MESSAGING_PROVIDER_GMAIL_ENABLED=true CALENDAR_PROVIDER_GOOGLE_ENABLED=true AUTH_GOOGLE_ENABLED=true AUTH_GOOGLE_CLIENT_ID=951231465939-h61tg6nkpkv1821qi899fjbj9looquto.apps.googleusercontent.com AUTH_GOOGLE_CLIENT_SECRET=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 AUTH_GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/redirect AUTH_GOOGLE_APIS_CALLBACK_URL=http://localhost:3000/auth/google-apis/get-access-token MESSAGE_QUEUE_TYPE=bull-mq ``` Alternative env ```properties MESSAGING_PROVIDER_GMAIL_ENABLED=true CALENDAR_PROVIDER_GOOGLE_ENABLED=true AUTH_GOOGLE_ENABLED=true AUTH_GOOGLE_CLIENT_ID=622006708006-dc4n3vrtf3cs2h6k7hgbborudme7ku9l.apps.googleusercontent.com AUTH_GOOGLE_CLIENT_SECRET=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 AUTH_GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/redirect AUTH_GOOGLE_APIS_CALLBACK_URL=http://localhost:3000/auth/google-apis/get-access-token MESSAGE_QUEUE_TYPE=bull-mq ``` 1. Launch your worker with `npx nx run twenty-server:worker` 2. npx nx run twenty-server:command cron:messaging:messages-import 3. npx nx run twenty-server:command cron:messaging:message-list-fetch 4. npx nx run twenty-server:command cron:calendar:calendar-event-list-fetch 5. Run the app and navigate to Settings/Accounts then connect your Google account --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: Marie Stoppa <[email protected]> Co-authored-by: Weiko <[email protected]> * Display tag for workflow version status (#6972) - Move where we fetch workflow data. We now fetch them in the `Workflow` component directly. That's useful to access it in the `WorkflowShowPageEffect` and `WorkflowDiagramCanvas` components. ![CleanShot 2024-09-10 at 16 27 53@2x](https://github.com/user-attachments/assets/7d30f407-31ab-472c-a096-c525042c0f35) * [metadata] fix soft delete for standard objects missing deletedAt fieldMetadata (#7017) This https://github.com/twentyhq/twenty/pull/7006 introduced a regression. The goal was to set "isSoftDeletable" to all standard objects but it was done at the wrong level, meaning it was setting the boolean correctly but not creating the corresponding fieldMetadata. I took the occasion to update the new graphql query runner to use that boolean and automatically add a filter on soft delete in case it's true. Also adding **IsQueryRunnerTwentyORMEnabled** by default in the seeds * add field config new icons (#6996) https://github.com/twentyhq/twenty/issues/6950 Add new icons to Object Fields Data types. Before: ![image](https://github.com/user-attachments/assets/55697e31-841d-435e-8c70-13ff1c59268d) After: ![image](https://github.com/user-attachments/assets/bd43f0ec-d3f7-4ecf-a95f-87a030f68e24) ![image](https://github.com/user-attachments/assets/369893a9-35be-43f8-bfcb-55149effa78a) * Optimize metadata queries (#7013) In this PR: 1. Refactor guards to avoid duplicated queries: WorkspaceAuthGuard and UserAuthGuard only check for existence of workspace and user in the request without querying the database * Fix billing services not accepting new subscriptions * Fix emailThread not loading and rest batch api forbidden * feat: improve self hosting documentation (#7024) This PR aims to resolve common misunderstanding while deploying Twenty with Docker compose. I've made the documentation clearer, and more detailed. This should solve https://github.com/twentyhq/twenty/issues/5184, #6140 and similar issues * feat: replace ts-node with tsx and pre-install it globaly in docker (#7027) Implement https://github.com/twentyhq/twenty/issues/5976 suggestion. It leads to faster boot time since we don't have to install dependencies. It should also solve https://github.com/twentyhq/twenty/issues/4772 as we don't need to run ressource-heavy `npm install` (the mentioned migration step does not seem to exist anymore anyway. * fix(one-liner): update SERVER_URL when not using default port (#7026) Small fix that should resolve #6341 by replacing the port of SERVER_URL in the generated .env file * Add data-testid to MultiWorkspaceDropdownButton container (#7028) PR for #6895 * removed @chakra-ui dependencies (#7004) Issue #6976 @FelixMalfait I could not do ``` import { Banner } from 'twenty-ui'; const StyledBanner = styled(Banner) display: flex; align-items: center; padding: ${({ theme }) => theme.spacing(8)}; position: absolute; border-radius: 8px; &:hover { background-color: ${({ theme }) => theme.accent.primary}; } ; ``` The styles wont get overridden for Banner, so for now I styled a new banner in `UnmatchColumnBanner` which is inconsistent. I couldnt figure out why css properties are not being overridden, need help! @Bonapara Question - Should the click work on entire banner or just cheveron? For now it just on cheveron click. https://github.com/user-attachments/assets/0f409e78-a341-4f26-af74-117e4b2775a9 --------- Co-authored-by: Charles Bochet <[email protected]> * Optimize sync, reset, seed commands to flush cache and to use less memory (#7034) In this PR: - removing ugprade-0.24 commands as we are releasing 0.30 - introducing cache:flush command - refactoring upgrade command and sync-metadata command to use the ActiveWorkspacesCommand so they consistently run on all workspaces or selected workspaces Fixes: - clear localStorage on sign out - fix missing workspaceMember in verify resolver - do not throw on datasource already destroyed exception which can happen with race condition when several resolvers are resolving in parallel * Optimize migrate-email-fields-command (#7035) Quick follow up to prepare for 0.30 release * Fix contributor script (#7040) We had an issue affecting twenty.com/contributors ; this should probably fix it * [flexible-schema] Add createOne/createMany with upsert to graphql query runner (#7041) ## Context This PR introduces createOne/createMany through the new graphql query runner. Trying to use twentyOrm wrapper as much as possible, in this case here the args are already converted from "metadata-like" structure (including composite fields) as graphql input to typeorm / raw columns (I had to introduce a little fix there). Keep in mind that I'm not using the new graphql query runner parsing classes here, especially the selected-fields part, because typeorm already returns all the record columns in the InsertResult object (including default values such as id, createdAt, ...). That also means relation objects will be returned as NULL in the gql response but we don't handle nested creation for the moment so it should be fine. Note: also removing the feature flag from findOne/findMany * Remove objectMetadata isSoftDeletable * 0-30-set-custom-object-is-soft-deletable.command (#7045) This command was supposed to set all custom objects as softDeletable. After some discussion we realised this bool was not used as intended so we are removing it all together until we find a better usage (remote objects for example). This PR removes the command which won't be needed anymore * Introduce ARRAY field type (#6862) This PR was created by \[GitStart\](<https://gitstart.com/>) to address the requirements from this ticket: \[TWNTY-6447\](<https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6447>). This ticket was imported from: <https://github.com/twentyhq/twenty/issues/6447> ### Description \- We added a new field type ### Refs #6447 ### Demo <https://jam.dev/c/2b4d7853-ea89-4e9d-a561-6edcb4fdb34b> Fixes #6447 --------- Co-authored-by: gitstart-twenty <[email protected]> Co-authored-by: Charles Bochet <[email protected]> * Create command to set stale message sync back to pending (#7048) Some message channels are stuck in an ongoing `syncStage` because `syncStartedAt` was not set correctly at the beginning of the sync. This command resets message channels with an ongoing `syncStage` and `syncStartedAt` set to null. * Fix: Set sync stage started at when starting sync (#7046) Fix:`syncStageStartedAt` was not set correctly after refactoring * Re-enable displaying one-to-many in table and kanban (#7053) As per title * fix: Company picker opening when it shouldn't (#7023)…
In this PR: