Commit Graph

5174 Commits

Author SHA1 Message Date
7291a1ddcd Add event when creating draft from previous version (#9910)
We create draft without emitting creation event. So workflow statuses
are not properly updated

This service needs a refacto. Will do it once we get out from fast
follows rush
2025-01-29 15:48:22 +01:00
5a34f6bfa7 Disable variables for the country code in the form phone field (#9897)
Fixes
https://discord.com/channels/1130383047699738754/1333820080651501691

We disable the variable picker for the country code for now. We'll
implement a proper solution later.
2025-01-29 15:40:59 +01:00
7536a5a9a0 Add missing fields in update action (#9908)
Fix https://discord.com/channels/1130383047699738754/1333806855264145500
2025-01-29 14:23:21 +00:00
c17dbe7115 fix: broken schema generation (#9905) 2025-01-29 13:46:36 +01:00
fbb67d74c8 feat: new relation schema generation (#9882)
Fix https://github.com/twentyhq/core-team-issues/issues/295

Based on the feature-flag `IsNewRelationEnabled` the schema will be
marked as outdated and regenerated, this will cause an error on the
front-end on the first request on the following ones schema will be well
generated ans request will work.
2025-01-29 10:33:17 +01:00
f74bb5a60b Add field description+label translations (#9899)
Add translations for field descriptions
2025-01-28 23:20:28 +01:00
b1219ff107 Add POC for Field translation (#9898)
Similar to ObjectMetadata translation

Also fixed an issue linked to the migration from `t` to `message`
helper: we're forced to rebuild the ID ourselves
2025-01-28 21:25:09 +01:00
8754b7107d Fix Icon Padding and Size in Select Item (#9888)
This pull request addresses issue
[#9458](https://github.com/twentyhq/twenty/issues/9458) by making the
following changes:

Increase the icon size from 14x14px to 16x16px
Add 8px padding to the right side of the icon
Ensure the icon is not cropped and displays with rounded angles

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2025-01-28 19:50:59 +01:00
5329dd0c63 Disable variable picker when no available variables (#9894)
- Disable variable picker when no available variables
(https://discord.com/channels/1130383047699738754/1331236819227906049)
<img width="496" alt="image"
src="https://github.com/user-attachments/assets/e4cb97c8-648c-4bdf-b230-49687113c9e6"
/>
2025-01-28 18:53:26 +01:00
7195614926 Add history (undo/redo) to text variable editors (#9889)
https://github.com/user-attachments/assets/83689fd9-1b00-49ff-938a-748822baf15f
2025-01-28 18:35:36 +01:00
180f6c28a4 Aggregates - Update Date label (#9862)
https://discord.com/channels/1130383047699738754/1333388007293849640/1333388007293849640
2025-01-28 17:18:29 +00:00
381c180ab9 Update bullmq queue option for job failure strategy (#9887)
## Context
This config tells bullmq what to do with jobs once they have been
processed.
We used to retain 100 completed jobs and 500 failed jobs. We never
really needed that much retention and keeping succeeded job is not
useful either in our case. I'm updating the strategy so all completed
jobs are removed from the queue and we now keep 100 failed jobs in case
we need to debug. (Although we should have good monitoring with
ExceptionHandler driver)
2025-01-28 17:39:10 +01:00
72d4619cd4 adding the predicate in the UPSERT function (#9891)
Bug fix : we are adding the predicate in the UPSERT function in order to
fix a postgres constraint
2025-01-28 16:51:37 +01:00
aa6d5c4c51 fix link validation and matching during csv import (#9890)
### Context
[Issue 9019](https://github.com/twentyhq/twenty/issues/9019) opens by
user having domain name not imported while importing through CSV.
@samyakpiya (thank you for your investigation !) has tested various
domain imports and has reported issue with its import test. Issues that
no longer exist : when I test your import, I get all records imported.

### Solution
- Remove "Link label" (cf screenshot - before fix) composite field in
matching options, not used in front that could mislead the user.
<img width="300" alt="Screenshot 2025-01-28 at 15 39 18"
src="https://github.com/user-attachments/assets/0ea24d9e-b339-42f3-b8d9-e271b33dbcfd"
/>

- Check links type fields validity in "Validate data" step


closes #9019

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
2025-01-28 16:51:19 +01:00
eb88f6f584 feat(custom-domain): remove domainName + add migration for custom dom… (#9872)
…ain + feature flag

Blocked by #9849
2025-01-28 15:28:18 +01:00
0e981bae0a Fix workflows empty states (#9878)
Versions and runs cannot be added manually. Updating message.

<img width="545" alt="Capture d’écran 2025-01-28 à 11 33 47"
src="https://github.com/user-attachments/assets/36b7ade8-3061-4b72-bfa5-c262e4d7d25e"
/>
<img width="614" alt="Capture d’écran 2025-01-28 à 11 34 02"
src="https://github.com/user-attachments/assets/9b524eb4-f40c-4330-a37f-fb33e08d22f4"
/>
2025-01-28 15:16:36 +01:00
ac92aed87f Add command to remove duplicate messageChannelMessageAssociations (#9886)
In this PR:
- create a command to remove duplicate (groupBy messageId,
messageChannelId) within messageChannelmessageAssociaitions.

THis is needed to apply a constraint already present on
messageChannelmessageAssociaitions (to be executed before syncing
metadata)
2025-01-28 15:04:52 +01:00
1e9dce3fd5 Fix the design of the Variable chip (#9871)
- Use a React component for variable tags in tiptap
- Fix the design of the variable chip
- Always display a button to delete the chip

![CleanShot 2025-01-28 at 12 35
55@2x](https://github.com/user-attachments/assets/d78ffa52-fcc3-4bbc-b427-68edde255408)
2025-01-28 14:59:45 +01:00
ac8c0c72cc docs: add Lingui to the Readme (#9884)
This PR adds Lingui to the translation tools in the Stack section of the
Readme, based on the suggestion in the comment
https://github.com/lingui/js-lingui/issues/2159#issuecomment-2618922147
2025-01-28 14:48:46 +01:00
b63ae14318 RICH_TEXT_V2 backend (#9848)
- Add RICH_TEXT_V2 composite type to backend.
- Add `bodyV2` field to tasks and notes.
- Minimum required frontend changes to avoid errors when creating a note

[Testing
instructions](https://github.com/twentyhq/twenty/pull/9690#issuecomment-2602378218)

---------

Co-authored-by: ad-elias <elias@autodiligence.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2025-01-28 14:05:06 +01:00
6f72f1af33 Fix Messaging sync upsert in messageChannel association (#9880)
We have recently changed an .insert into a .upsert but we forgot to add
the unique index on the postgres schema.
2025-01-28 11:48:09 +01:00
069c34cd7b Add link on snack bar (#9873)
Add link to workflow execution 

<img width="639" alt="Capture d’écran 2025-01-27 à 18 15 34"
src="https://github.com/user-attachments/assets/f2a1b3b5-7bf6-4b33-bba7-bf8907f6bcc6"
/>
2025-01-28 11:26:20 +01:00
af8d22ee99 Fix ObjectType casing and conflict between Relation and RelationMetadata (#9849)
Fixes #9827 

Also uncovered a conflict with `@objectType('Relation')` and
`@objectType('relation)`

I don't want to address it in this PR so I will create a followup issue
when we close this but I think there's a confusion between
Relation/RelationMetadata, it's unclear what is what

---------

Co-authored-by: Antoine Moreaux <moreaux.antoine@gmail.com>
2025-01-28 10:06:18 +01:00
08a0e67477 Translate label and descriptions for objects (#9876)
Begin server-side translations
2025-01-28 09:54:59 +01:00
4542199e5c Fix object metadata view creation issue (#9875)
Fixes https://github.com/twentyhq/core-team-issues/issues/26
Fixes https://github.com/twentyhq/twenty/issues/9350
2025-01-27 21:25:02 +01:00
549c3faf71 Add server translation (#9847)
First proof of concept for server-side translation.

The goal was to translate one metadata item:

<img width="939" alt="Screenshot 2025-01-26 at 08 18 41"
src="https://github.com/user-attachments/assets/e42a3f7f-f5e3-4ee7-9be5-272a2adccb23"
/>
2025-01-27 21:07:49 +01:00
2a911b4305 feat(auth): centralize SSO error handling logic (#9832)
Introduce `SsoErrorRedirectService` to handle SSO error redirection and
exception capturing across the authentication controllers. Refactor
Microsoft, Google, and SSO authentication controllers to utilize this
service, replacing the previous direct calls to `DomainManagerService`.
Added unit tests for the new service to ensure robust error handling.
2025-01-27 17:55:20 +00:00
10476fcb01 remove freeAccess user logic (#9866)
closes #9763

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
2025-01-27 17:49:16 +01:00
7362558e30 Reset selectedStep with proper step (#9867)
as title
fixes
https://discord.com/channels/1130383047699738754/1331215762840485908
2025-01-27 15:35:29 +01:00
687b61849a Fix rightDrawer padding (#9869)
Fixes
https://discord.com/channels/1130383047699738754/1331236153713627157
## Before

![image](https://github.com/user-attachments/assets/3b265461-774b-480b-83dd-d3a410cfb31b)

## After

![image](https://github.com/user-attachments/assets/259122fa-3759-4cd6-8698-b94ccd5470bc)
2025-01-27 14:31:47 +00:00
68c4f9cb0d Fix design to match figma (#9864)
As title
Fixes
https://discord.com/channels/1130383047699738754/1331212573902770228

## Before

![image](https://github.com/user-attachments/assets/4b556022-92c3-4197-ab18-91c089117936)

## After

![image](https://github.com/user-attachments/assets/67f97c60-d08b-4ae1-87b4-79c24ae79b93)
2025-01-27 15:23:28 +01:00
4bb8e3a50e updating SettingsAccountsListEmptyStateCard (#9868)
changing from "Connect a Google account" to  "Choose your provider"

updating all languages using 
`npx nx run twenty-front:lingui:extract`
2025-01-27 15:20:48 +01:00
fded1cb5a0 Bug fix microsoft require approval (#9863)
Rolling back since apparently requiring "select_account" fails for
google
2025-01-27 13:58:42 +00:00
77c586db24 fix the bug "require approval" (#9859)
## The bug : 
"Approval required" even though admin consent has been granted for the
whole tenant"

Fix https://github.com/twentyhq/core-team-issues/issues/277 

### More details
described here in
[stackoverflow](https://stackoverflow.com/questions/79385342/approval-required-even-though-admin-consent-has-been-granted-for-the-whole-ten?noredirect=1#comment140006092_79385342)
2025-01-27 14:36:01 +01:00
c1e84a746c Fix design for select action (#9857)
as title 
fixes
https://discord.com/channels/1130383047699738754/1330945172489371771
2025-01-27 13:29:04 +01:00
fb0b342374 Fix background color in code step right drawer (#9856)
Fixes
https://discord.com/channels/1130383047699738754/1331211019430924380
as title
2025-01-27 12:16:21 +01:00
8df3214e84 decoupling isMicrosoftAuthEnabled and IsMicrosoftSyncEnabled (which has no reason to be used here) (#9854)
### what
decoupling auth and email synchro

### why
IsMicrosoftSyncEnabled (which has no reason to be used here) since we
now allow microsoft as a auth provider
2025-01-27 11:04:19 +01:00
98671b6cd2 bug fix urgent (#9851)
upsert messaging
2025-01-27 10:38:18 +01:00
84c299f8d4 Create a reusable Label component (#9833)
As seen with @Bonapara, I'm creating a Label component and use it in the
workflows.
2025-01-24 19:25:04 +01:00
55be726105 Rename Unintuitive Function Names in Authentication Flow (#9706)
Resolves #9623

## Description

This PR renames the following functions to better reflect their purpose.

- Backend:
  - Verify → GetAuthTokensFromLoginToken
  - Challenge → GetLoginTokenFromCredentials

- Frontend:
  - challenge → getLoginTokenFromCredentials
  - verify → getAuthTokensFromLoginToken

## Testing
_Sign in works as expected:_


https://github.com/user-attachments/assets/7e8f73c7-2c7d-4cd2-9965-5ad9f5334cd3

_Sign up works as expected:_
  

https://github.com/user-attachments/assets/d1794ee4-8b59-4934-84df-d819eabd5224

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2025-01-24 19:19:14 +01:00
570b2e3530 Refactored record filter saving to view filters (#9844)
This PR refactors the record filter saving to view filters.

Before we used states to track the change of view filters, now we just
check if there's a difference between the current record filters and the
current view filters before saving.

We also use this check to show the reset and save buttons.

CRUD operations to perform on view filters are computed by utils , and .

Also added unit tests on those utils.
2025-01-24 18:48:59 +01:00
a4011676f0 Add e2e tests for the Use as Draft feature (#9845)
Test with and without a draft version as the last version of the
workflow
2025-01-24 18:38:35 +01:00
aacbf11435 add new emails in suspended workspace cleaning job (#9834)
From: Felix from Twenty <noreply@yourdomain.com>
Subject: Action needed to prevent workspace deletion
<img width="400" alt="Screenshot 2025-01-24 at 16 31 35"
src="https://github.com/user-attachments/assets/8350a499-6815-4b00-a4fb-615b2a3b60e0"
/>


From: Felix from Twenty <noreply@yourdomain.com>
Subject: Your workspace has been deleted
<img width="456" alt="Screenshot 2025-01-24 at 16 33 15"
src="https://github.com/user-attachments/assets/7e392e7c-519c-4b38-ae8c-ab3c9dd72c24"
/>



closes [284](https://github.com/twentyhq/core-team-issues/issues/284) &
[285](https://github.com/twentyhq/core-team-issues/issues/285) - [parent
issue](https://github.com/twentyhq/core-team-issues/issues/179)

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
2025-01-24 18:37:06 +01:00
07dec36976 Tt fast follows 24/01 (#9843)
- Add icons on steps
- Add search input on object selection
- Improve event label
<img width="503" alt="Capture d’écran 2025-01-24 à 17 59 34"
src="https://github.com/user-attachments/assets/4e5d31d6-6fe5-4f78-9112-3fbd6ee66743"
/>
<img width="503" alt="Capture d’écran 2025-01-24 à 17 59 54"
src="https://github.com/user-attachments/assets/7f37402f-3d1a-4bea-9082-05f50a711f35"
/>
<img width="503" alt="Capture d’écran 2025-01-24 à 18 00 08"
src="https://github.com/user-attachments/assets/fffabaff-9d5d-4584-9297-e21434333de0"
/>
2025-01-24 17:25:01 +00:00
17def223b6 Feat/2fa (#9634)
# Description
Closes #7003 
Implements 2FA with TOTP. 

>[!WARNING]
> This is a draft PR, with only partial changes, made as a mean of
discussion about #7003 (it's easier to reason about real code)

## Behaviour
- a `totpSecret` is stored for each user
- use [`otplib`](https://github.com/yeojz/otplib/tree/master) to create
a QR code and to validate an `otp` against an `totpSecret` (great [demo
website](https://otplib.yeojz.dev/) by `otplib`)
- OTP is asked upon each login attempt

## Source
Inspired by:
- [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238)
- Cal.com's implementation of 2FA, namely
- [raising a
401](c21ba636d2/packages/features/auth/lib/next-auth-options.ts (L188-L190))
when missing OTP and 2FA is enabled, with a [specific error
code](c21ba636d2/packages/features/auth/lib/ErrorCode.ts (L9))
- [catching the
401](c21ba636d2/apps/web/modules/auth/login-view.tsx (L160))
in the frontend and
[displaying](c21ba636d2/apps/web/modules/auth/login-view.tsx (L276))
the OTP input

## Remaining
- [ ] encrypt `totpSecret` at rest using a symetric algorithm

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
2025-01-24 18:23:57 +01:00
f58f84114c update subscription interval and quantity for hybrid susbscription (#9822)
Solves https://github.com/twentyhq/private-issues/issues/253

**TLDR:**

Can update the billing subscription interval for a subscription with a
base product and metered product. It also updates correctly as the
quantity of base products depending on how many people are in the
workspace.

**In order to test:**

1. Have the environment variable IS_BILLING_ENABLED set to true and add
the other required environment variables for Billing to work
2. Do a database reset (to ensure that the new feature flag is properly
added and that the billing tables are created)
3. Run the command: npx nx run twenty-server:command
billing:sync-plans-data (if you don't do that the products and prices
will not be present in the database)
4. Run the server , the frontend, the worker, and the stripe listen
command (stripe listen --forward-to
http://localhost:3000/billing/webhooks)
5. Buy a subscription for the Acme workspace , change the interval in
the Billing Settings
6. Add another person to the workspace, you should see all the previous
changes reflected in the database

**Doing**
Moving the BillingSubscriptionsService.getUpdatedSubscriptionItems to an
util (for a less cluttered service)
2025-01-24 18:19:09 +01:00
c89cc38729 [MISC] Twenty-shared build declaration and declarationMap tsconfig (#9838)
# Motivations
By adding the declaration and declaration mapping this allows a better
`go to source` in our IDE
Should also be done for
https://github.com/twentyhq/core-team-issues/issues/281

## FROM


https://github.com/user-attachments/assets/5cc307d0-b2dc-46bf-b61f-0731015c4a30


## TO


https://github.com/user-attachments/assets/5ed1d7af-2716-435d-a1b8-6738b5a77956

## Notes
Might be interesting to add global commands for:
- watch mode for `twenty-ui` and `twenty-shared`
- clean, output folders such as `dist` and `node_modules` and so on
2025-01-24 17:56:42 +01:00
03197226f4 Fix Cmd enter to test code step (#9841) 2025-01-24 16:46:56 +00:00
95c772664e Refactor triggerUpdateRelationsOptimisticEffect to compute relationship from Metadatas (#9815)
# Introduction
At the moment the relationships are inferred from the record data
structure instead of its metadatas
We should refactor the code that computes or not the necessity to detach
a relation on a mutation

We've refactored the `isObjectRecordConnection` method to be consuming a
`relationDefintion` instead of "typeChecking" at the runtime the data
structure using zod validation schema

Related to #9580
2025-01-24 17:24:23 +01:00
a8552a6a67 Fix Typo in Filename (#9835)
- Rename `mircosoft-apis-oauth-request-code.guard.ts` to
`microsoft-apis-oauth-request-code.guard.ts `
- Update import statement in
`packages/twenty-server/src/engine/core-modules/auth/controllers/microsoft-apis-auth.controller.ts`
to reflect the updated filename.
2025-01-24 16:24:41 +01:00