Commit Graph

5614 Commits

Author SHA1 Message Date
5528577707 10004 tasks will not delete in people view (#10039)
Fixes #10004 
- Fixed `useListenClickOutside` which wasn't working with
`excludeClassNames` for `comparePixels` mode
- Added `emitCloseEvent` parameter to the `closeRightDrawer` function
because closing the right drawer after deleting a note or a task was
triggering an update after the deletion.

This bug was only for the old version of the command menu.
2025-02-05 18:25:39 +01:00
e3182a145d Implement updateRole (#10009)
In this PR, we are implementing the updateRole endpoint with the
following rules

1. A user can only update a member's role if they have the permission (=
the admin role)
2. Admin role can't be unassigned if there are no other admin in the
workspace
3. (For now) as members can only have one role for now, when they are
assigned a new role, they are first unassigned the other role (if any)
4. (For now) removing a member's admin role = leaving the member with no
role = calling updateRole with a null roleId
2025-02-05 18:02:14 +01:00
ef1b492e2f Lab image cover (#10027)
Added Object-Cover to eliminate image distortion. Set all cards to the
large variant to enhance the design.

---------

Co-authored-by: ehconitin <nitinkoche03@gmail.com>
2025-02-05 22:24:23 +05:30
f31ee88fe8 [NITPICK] Avoid duplicated action position index in DefaultActionsConfigV2 (#10031)
# Introduction Nitpick
Action's record has two entries with `position: 0`
Unless I'm mistaken I could not find any place where the `position`
property is consumed
So this is just for sake of the +1 suite
2025-02-05 16:20:57 +01:00
dadee81175 [FEAT] Destroy many Workflow actions (#10028)
# Introduction
Added destroy many records to the `WorkflowActionConfig`

## Repro:
- Filter by deleted workflow
- Select mulitple rows
- Click on destroy

# Pinned action standardization
After discussion with @Bonapara and @bosiraphael we landed on a
standardization of the pinned actions between `DefaultActionsConfigV2`
and `WorkflowActionConfig` which means that now are pinned the `DELETE`
and `DESTROY` for both `single/multiple` modes for both features

Related to https://github.com/twentyhq/twenty/pull/9991
2025-02-05 16:16:13 +01:00
710366514c BaseObjectRecord and__typename naming updates (#10024)
Folllowing:
9049c47fd2
From PR https://github.com/twentyhq/twenty/pull/10014
2025-02-05 14:51:30 +01:00
c3c800b097 Post #10014 merged nitpicks followup (#10021)
## Only nitpicks
Method signature mutation from several to one record arg
Renamed a variable in map to fit related business logic

#10014 Followup
2025-02-05 14:28:17 +01:00
5c24cf4084 320 new command menu navigation bar buttons (#10018)
Closes https://github.com/twentyhq/core-team-issues/issues/320


https://github.com/user-attachments/assets/8082e986-07fd-46fb-9652-ad006aa9dac8
2025-02-05 13:25:29 +00:00
36d148d5e5 Fetch roles in roles settings page (#10001)
## Context
Following the addition of the new Roles page, we are now fetching roles
from the DB thanks to this PR #9955

## Test
<img width="1136" alt="Screenshot 2025-02-04 at 14 46 21"
src="https://github.com/user-attachments/assets/2c55c4d0-ee51-47bb-8113-efce172a9365"
/>

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2025-02-05 14:22:00 +01:00
3e05c3743e [BUG][PROD] Fix ViewGroup creation optimistic cache (#10014)
# Introduction
When we create a new `view` from record table that has relation such as
opportunities.
Encountered invariant conditions:

## Unknown fiel `__typename`
`Should never occur, encountered unknown fields __typename in
objectMetadaItem viewGroup`,

### Fixed by ignoring unknown internal fields


## Provided both relation `view` and `viewId`
`Should never provide relation mutation through anything else than the
fieldId e.g companyId and not company, encountered: view`

### Fixed by sending only `viewId` to `createManyRecords` in
`usePersistViewGroupRecords.ts`
2025-02-05 12:22:45 +01:00
736b845c98 335 workflow implement workflow cron triggers backend (#9988)
[Backend side] Add cron triggers to workflow
Closes https://github.com/twentyhq/core-team-issues/issues/335
2025-02-05 11:02:49 +00:00
074cc113ac Implement query variables in useCombinedFindManyRecords (#10015)
Implements filtering, ordering and cursor filtering for the hook
useCombinedFindManyRecords, because it was not implemented, which was
misleading because variables could be passed to it.

The difficult part was to make sure that the cursor filtering was
working, both before and after a cursor, because it was only hard coded
for last cursor (equivalent to after).

The duplicate limit parameter in the type RecordGqlOperationVariables
was merged into one limit parameter, because it was making the developer
guess how both could be handled.

This single limit parameter can be used for either : general limit
without cursor, first records from after cursor, last records until
before cursor. Since those cases are exclusive it's better to have only
one limit parameter and have an internal logic handling those cases.

Tests were added on the relevant parts, especially
useCombinedFindManyRecordsQueryVariables which requires its own unit
test to handle this cursor + limit logic.

Record show page pagination was tested to make sure removing the
duplicate limit parameter had no impact.
2025-02-05 11:59:38 +01:00
28a3f75946 [FEAT] RecordAction destroy many record (#9991)
# Introduction
Added the `RecordAction` destroy multiple record

## Repro
Select multiples `deletedRecords`, you should be able to see the
`Destroy` pinned CTA ( iso short label with the destroy one ), open
control panel and fin new CTA `Permanently delete records`


https://github.com/user-attachments/assets/31ee8738-9d61-4dec-9a1f-41bb6785e018

## TODO
- [ ] Gain granularity within tests to assert the action should be
registered only when filtering by deleted

## Conclusion
Closes https://github.com/twentyhq/core-team-issues/issues/110
2025-02-05 11:33:01 +01:00
aa003f25d9 [CHORE] Twenty emails deps to twenty-shared lockfile update (#10013)
Related to https://github.com/twentyhq/twenty/pull/10010
Forgot to add lockfile
2025-02-05 10:28:11 +01:00
0a8d75bc07 [FIX] Nx project's scope build dependency management (#10010)
# Introduction
Defined `dependsOn` for each nx project's configuration that has a
dependency to another local package ( ui, shared ).
As follows:
```json
"dependsOn": ["^build"]
``` 
Where the `^` symbol means "all dependencies of this project"

Now on a fresh repo, no built or install deps after install dependencies
you can directly hit `npx nx build PROJECT_NAME`
closes https://github.com/twentyhq/core-team-issues/issues/371

Related what was failing
[run](https://github.com/twentyhq/twenty-infra/actions/runs/13141544809/job/36669643182)
Cancelled before deploy, attested build was correct within the publish
and digest
2025-02-04 18:46:16 +01:00
125a0c3419 Create variants for workflow visualizer nodes (#10006)
Closes https://github.com/twentyhq/core-team-issues/issues/332

- Create the success and failed variants
- Introduce the first responsive color
- Creating stories for the new variants

These components are not yet in use in the source code. If you want to
see them, launch Storybook.

| Success | Failure |
|--------|--------|
| ![CleanShot 2025-02-04 at 16 24
43@2x](https://github.com/user-attachments/assets/0dd68a8f-3914-4b6e-b2d8-43108c2f5e8c)
| ![CleanShot 2025-02-04 at 16 24
59@2x](https://github.com/user-attachments/assets/e4e408d3-29fb-4fbc-a277-044aec9b0f4b)
|
| ![CleanShot 2025-02-04 at 16 24
54@2x](https://github.com/user-attachments/assets/d565ee47-1476-475d-adf6-dadfff9c6719)
| ![CleanShot 2025-02-04 at 16 25
05@2x](https://github.com/user-attachments/assets/9a0aabcc-84d1-41e2-a5a1-7c8cb05f963f)
|
2025-02-04 18:38:38 +01:00
5be22413c9 [3/n]: Migrate the PUT rest/* and PATCH rest/* to use TwentyORM (#10002)
# This PR

- Is addressing #3644 
- Migrates the PUT and PATCH rest/* endpoints to use twentyORM directly
- Adds integration tests
2025-02-04 17:25:02 +01:00
7dfb9dd77f Fix send email error when empty connected account (#10005)
- Fix send email error when empty connected account
- Add a global util to valid uuid
- Add an util to check if object is workflow related
2025-02-04 17:13:29 +01:00
0113e40399 Dockerfile update (#10007)
partially fixes https://github.com/twentyhq/core-team-issues/issues/371
2025-02-04 17:11:50 +01:00
0675017b5e Fix:Empty link in record details isn't deleted by default (#9840)
Gives a fix for #9780 . I have added handleDelete inside the submit
function and created a state to manage the empty placeholder
[Screencast from 2025-01-24
01-45-22.webm](https://github.com/user-attachments/assets/87b209a0-7f60-4d72-ad06-c8b955cf6cd2)

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
Co-authored-by: Etienne <45695613+etiennejouan@users.noreply.github.com>
2025-02-04 16:04:34 +01:00
c9f45a30d6 0.41 release note -> Introducing Lab Tab (#9989) 2025-02-04 15:50:06 +01:00
cc14c7e0d0 Update cleaning suspended workspace job (#9999)
- split workspace metadata deletion into multiple queries
- delete all subscriptions when workspace is deleted

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
2025-02-04 15:49:22 +01:00
dfc1bb7c29 361 create a navigation stack for the command menu (#9995)
Closes https://github.com/twentyhq/core-team-issues/issues/361

- Created navigation stack state
- Created navigation functions inside the `useCommandMenu` hook
- Added tests
2025-02-04 15:47:43 +01:00
b2e4d0d04d Fixed cannot close record table cell header filter (#9998)
With the introduction of dropdown focus id, the table header cell filter
dropdown wasn't taken into account by this new system that prevents
multiple dropdowns from conflicting.

The fix was to just add a dropdown focus id when opening the dropdown.

There was also a bug with the hotkey scope which was staying on table
hotkey scope, thus triggering table hotkeys, this PR also fixes that.
2025-02-04 15:41:26 +01:00
2368dad9ad Enable workflow in lab (#9997)
Refresh of `objectmetadataitems` was not happening fast enough. Page was
breaking when enabling the feature flag. Instead of not storing worklow
objects in state, we will use the feature flag to block on read. This
way we avoid race conditions

<img width="1511" alt="Capture d’écran 2025-02-04 à 14 11 56"
src="https://github.com/user-attachments/assets/912cc59a-f422-48ab-84b7-7fdd7bbc35c1"
/>
2025-02-04 15:25:04 +01:00
53b51c8bba Fix-issue-370 (#9996)
Fixes the issue from introduced when alowing gmail and outlook.

fixes https://github.com/twentyhq/core-team-issues/issues/370
2025-02-04 14:20:35 +00:00
b9b7700155 Improve translations with gpt (#10000)
Running GPT4 on all files to improve the quality of translations
2025-02-04 14:56:55 +01:00
a5e27aa751 [2/n]: Rest API -> TwentyORM migration POST rest/* (#9986)
# This PR

- Addressing #3644 
- Migrates the `POST rest/*` endpoint to use TwentyORM directly
- Adds integration tests
- Refactors common login in the v2 service file
- Refactors test utility files
2025-02-04 12:36:52 +01:00
40f43a4076 add createMany fields to fieldMetadataService to batch field creation (#9957)
## Context
Not exposed in the API yet, this new method allows us to reduce the time
to create multiple fields at once, mostly during seeding. This allows us
to batch transactions and avoid recomputing the cache everytime.

With this change, we recompute the cache 7 times instead of 35 during
seeding. We could do the same for objects.
2025-02-04 11:18:57 +01:00
0e5c2cff42 optimize feature flag query in Lab (#9987)
addressing
ee4a321c71 (r1939711930)
2025-02-04 09:45:14 +01:00
edeaecad05 hotfix for lab (#9981)
Issue:
When attempting to toggle a public feature flag that didn't exist in the
workspace's feature flags array, the LabService threw a
FeatureFlagException with code FEATURE_FLAG_NOT_FOUND. This prevented
users from enabling public feature flags for the first time in their
workspace.
Fix:
Modified the LabService to handle non-existent public feature flags by
creating them instead of throwing an error. When the flag doesn't exist,
the service now saves a new feature flag record with the provided key
and value, associates it with the workspace, and returns the newly
created flag.
2025-02-03 22:25:46 +01:00
7a0f2f8c0a Add logged out translations (#9983)
Add translation for logged in / sub pages
2025-02-03 22:00:54 +01:00
351e768038 [Permissions] Implement getRoles (#9955)
In this PR

- introducing roles module to separate roles logic (assign a Role, get a
workspace's roles etc.) from permission logic (check if a user has a
permission)
- Introduces getRoles endpoint to fetch a workspace's roles
- introduces the first permission check: getRoles in only accessible to
users with permission on ROLE setting. Implemented
validatesUserHasWorkspaceSettingPermissionOrThrow
2025-02-03 19:14:18 +01:00
caee5b1f89 allow people to connect their mailbox (#9982)
allow people to connect their mailbox independantly from the auth
possibilities
2025-02-03 17:53:19 +00:00
47487f5d1c feat(sso): fix saml + allow to use public invite with sso + fix invite page with multiple sso provider (#9963)
- Fix SAML issue
- Fix the wrong state on the Invite page when multiple SSO provider
exists
- Allow to signup with SSO and public invite link
- For OIDC, use the property upn to guess email for Microsoft and enable
oidc with a specific context in azure
- Improve error in OIDC flow when email not found
2025-02-03 17:48:25 +00:00
253a3eb83f fix: prevent updating isCustom on object and field metadata (#9968)
This PR prevents updating isCustom on object and field metadata.

Example graphql mutation now cannot be used to modify existing field's
isCustom property as expected.

```
mutation UpdateOneFieldMetadataItem(
    $idToUpdate: UUID!
    $updatePayload: UpdateFieldInput!
  ) {
    updateOneField(input: { id: $idToUpdate, update: $updatePayload }) {
      id
     isCustom
    }
  }
```

Example payload is not allowed now and it will return error in response.

```
{
  "idToUpdate": "80c6c8df-f719-42d2-985a-353468a3ed00",
  "updatePayload": {
    "isCustom": true
  }
}
```

fixes- #6581
2025-02-03 17:30:08 +01:00
b29ff9b4e6 Removed availableFilterDefinitions as a state but kept its usage as a derived state of objectMetadataItems (#9972)
The global record filter refactor will derive everything at runtime from
objectMetadataItemsState, thus removing the need for a filter definition
concept.

Here we don't yet remove available filter definition usage but we
replace the available filter definitions states, we now derive the same
value from objectMetadataItemsState.

This will allow us to progressively remove the usage of the concept of
filter definition, at the end it will then be easy to just remove from
the codebase because nothing will use it anymore.
2025-02-03 17:29:57 +01:00
c8af90dc01 Environment variables in admin panel (read only) - backend (#9943)
Backend for https://github.com/twentyhq/core-team-issues/issues/293

POC - https://github.com/twentyhq/twenty/pull/9903

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2025-02-03 21:05:43 +05:30
49e4484937 324 add search records as a fallback action in case of no results (#9976)
Closes https://github.com/twentyhq/core-team-issues/issues/324

Fixed typos: 'No results' is used when multiple results are expected and
'No result' is used when only one result is expected.


https://github.com/user-attachments/assets/e3655ced-465a-44b1-92af-63878b9d8a94
2025-02-03 15:54:24 +01:00
eb0762dc58 refactor(auth): update SSO provider selection logic (#9975)
Refined the logic to check for SSO providers before setting the sign-in
step. Consolidated conditions to ensure clarity and avoid redundant
checks.
2025-02-03 14:12:56 +00:00
5a13d5ae29 Sort active workspaces (#9973)
Adding an order when fetching active workspaces so that when we run
command we can better understand the workspaces from the logs. Also, if
the command fails, we know we could start from a specific createdAt
later on
2025-02-03 13:33:00 +01:00
9d24bfb747 preparing version 0.42-caanry (#9938) 2025-02-03 10:53:05 +01:00
39e7f6cec3 setup localization for twenty-emails (#9806)
One of the steps to address #8128 

How to test:
Please change the locale in the settings and click on change password
button. A password reset email in the preferred locale will be sent.


![image](https://github.com/user-attachments/assets/2b0c2f81-5c4d-4e49-b021-8ee76e7872f2)

![image](https://github.com/user-attachments/assets/0453e321-e5aa-42ea-beca-86e2e97dbee2)

Todo:
- Remove the hardcoded locales for invitation, warn suspended workspace
email, clean suspended workspace emails
- Need to test invitation, email verification, warn suspended workspace
email, clean suspended workspace emails
- The duration variable `5 minutes` is always in english. Do we need to
do something about that? It does seems odd in case of chinese
translations.

Notes:
- Only tested the password reset , password update notify templates.
- Cant test email verification due to error during sign up `Internal
server error: New workspace setup is disabled`

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
2025-02-02 21:01:34 +01:00
4b9414a002 Add Japanese language (#9956)
I added Japanese translation.

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
2025-02-01 12:49:18 +01:00
c9ca87f49f Add instructions to upgrade to 0.41 in docs (#9964)
As per title

Also:
- making sure to destroy datasource in upgrade commands to lower memory
usage
2025-02-01 12:11:27 +01:00
7fd89678b7 [CHORE] Avoid isDefined duplicated reference, move it to twenty-shared (#9967)
# Introduction
Avoid having multiple `isDefined` definition across our pacakges
Also avoid importing `isDefined` from `twenty-ui` which exposes a huge
barrel for a such little util function

## In a nutshell
Removed own `isDefined.ts` definition from `twenty-ui` `twenty-front`
and `twenty-server` to move it to `twenty-shared`.
Updated imports for each packages, and added explicit dependencies to
`twenty-shared` if not already in place

Related PR https://github.com/twentyhq/twenty/pull/9941
2025-02-01 12:10:10 +01:00
d9b86475d3 323 add object name inside the search (#9962)
Closes https://github.com/twentyhq/core-team-issues/issues/323

Before:
<img width="495" alt="Capture d’écran 2025-01-31 à 18 11 56"
src="https://github.com/user-attachments/assets/dd1d3ac1-6c97-4398-b233-d323eeacdbb9"
/>

After:
<img width="500" alt="Capture d’écran 2025-01-31 à 18 09 58"
src="https://github.com/user-attachments/assets/68d23990-2d0b-437d-ad2e-a686cdb320e1"
/>
2025-02-01 08:18:48 +01:00
58aa86cc0c [Permissions] Add userWorkspaceId to JWT token (#9954)
This information will be used to fetch a user's role and check their
permissions
2025-01-31 18:15:29 +01:00
f00e7cc670 Make variable nodes undeletable in a readonly tiptap editor (#9950)
In this PR:

- Refactor how we initialize the content of the tiptap editor; providing
a default value for the editor makes node appear instantly
- Hide the button to remove a variable tag when the editor is readonly

| Editable | Readonly |
|--------|--------|
| ![CleanShot 2025-01-31 at 15 04
25@2x](https://github.com/user-attachments/assets/54b90c80-aab1-4ff0-93f9-a0550f031d82)
| ![CleanShot 2025-01-31 at 15 05
51@2x](https://github.com/user-attachments/assets/0480a7dc-9d7a-4e3f-b1a5-0550548622c6)
|

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2025-01-31 18:00:40 +01:00
fa3ea4bb68 Fix composite type update migration builder (#9959) 2025-01-31 16:34:42 +00:00