Commit Graph

5056 Commits

Author SHA1 Message Date
8572471973 Introduce IsScrollable on ScrollWrapper (#9724)
It's beautiful!

Using same techniques as for the Header! Was not that easy but looks
very nice now!
2025-01-17 19:26:34 +01:00
18dea07344 Create many steps in a row (#9727)
Fixes
https://discord.com/channels/1130383047699738754/1329099124515274823
2025-01-17 18:12:11 +01:00
06033040d8 remove swc folder (#9723) 2025-01-17 16:35:50 +01:00
3f372c0edf Revert "Fix last record row cells are cropped when selected (#9678)" (#9722)
This reverts commit 446bbdbd96.
2025-01-17 16:32:36 +01:00
6bd0244045 Fix date type update (#9700)
This PR fixes a problem with how TypeORM handles date without time. 

A date without time that is stored in PostgreSQL database as `date` type
gets returned as an ISO string date with a timezone that can shift its
date part in an unwanted way.

In short DB stores `2025-01-01`, TypeORM query builder returns
`2024-12-31T23:00:00Z` which gets parsed as `2024-12-31` on the front
end field.

We don't want to handle timezone here because we are manipulating a date
without its time part, so this PR adds a step that counteracts what
TypeORM does and returns `2025-01-01T00:00:00.000Z` so that the front
can parse it correctly.

@Weiko We might want to check other places of the backend where date
types are returned by TypeORM, we might have the same problem, this PR
only fixes it for updateOne resolver return.

- Fixed date persist on frontend which was shifting the date to a
different day due to timezone issue
- Fixed date returned by the backend update logic, which was shifting
the date by the timezone offset (so this PR adds back the offset so that
it stays at 00:00:00Z time)
2025-01-17 16:19:49 +01:00
b6b5fd1759 refactor(auth): remove redundant workspace lookup logic (#9716)
Removed unnecessary workspace lookup in `findWorkspaceForSignInUp` when
using password-based auth. Updated tests to validate the refactored
behavior and ensure no regressions in workspace resolution for different
auth scenarios.
2025-01-17 14:59:54 +01:00
2efc71b5cb Add first real translations + translation.io (#9715) 2025-01-17 14:59:19 +01:00
f8f9bb2b78 Serverless function timeout concerns (#9689)
closes https://github.com/twentyhq/core-team-issues/issues/242
- unify timeout behavior between local and lambda
- add timeout in serverless entity
- set timeout default to 300s (5min)
2025-01-17 13:49:02 +00:00
679429447d fix(auth): update onboarding activation for specific users (#9702)
Adjust onboarding activation to trigger only for new users with
pictures. This prevents unnecessary activation steps for other user
types, streamlining the flow.
2025-01-17 14:31:24 +01:00
f38a25412e Add more translations (#9707)
As per title
2025-01-17 12:50:28 +01:00
55feeaeef1 [CI][FIX] Storybook coverage configuration injection per scope (#9711)
# Introduction
Running `storybook` with `configuration=pages` outputs a coverage that
is not replicated afterwards by the `storybook:coverage` command.
```sh
npx nx storybook:serve-and-test:static twenty-front --configuration=pages --shard=1/1 --checkCoverage=true
# ...
[TEST] Test Suites: 40 passed, 40 total
[TEST] Tests:       52 passed, 52 total
[TEST] Snapshots:   0 total
[TEST] Time:        84.786 s
[TEST] Ran all test suites.
[TEST] Coverage file (13067196 bytes) written to .nyc_output/coverage.json
[TEST] > nx storybook:coverage twenty-front --coverageDir=coverage/storybook --checkCoverage=true
[TEST] 
[TEST] 
[TEST] > nx run twenty-front:"storybook:coverage" --coverageDir=coverage/storybook --checkCoverage=true
[TEST] 
[TEST] > npx nyc report --reporter=lcov --reporter=text-summary -t coverage/storybook --report-dir coverage/storybook --check-coverage=true --cwd=packages/twenty-front
[TEST] 
[TEST] 
[TEST] =============================== Coverage summary ===============================
[TEST] Statements   : 70.45% ( 775/1100 )
[TEST] Branches     : 45.39% ( 197/434 )
[TEST] Functions    : 63.52% ( 209/329 )
[TEST] Lines        : 71.28% ( 767/1076 )
[TEST] ================================================================================
[TEST] 
```

```sh
> npx nyc report --reporter=lcov --reporter=text-summary -t coverage/storybook --report-dir coverage/storybook --check-coverage=true --cwd=packages/twenty-front


=============================== Coverage summary ===============================
Statements   : 37.4% ( 9326/24931 )
Branches     : 22.99% ( 2314/10063 )
Functions    : 28.27% ( 2189/7741 )
Lines        : 37.81% ( 9261/24488 )
================================================================================
ERROR: Coverage for lines (37.81%) does not meet global threshold (39%)
ERROR: Coverage for branches (22.99%) does not meet global threshold (23%)
ERROR: Coverage for statements (37.4%) does not meet global threshold (39%)
Warning: command "npx nyc report --reporter=lcov --reporter=text-summary -t coverage/storybook --report-dir coverage/storybook --check-coverage=true --cwd=packages/twenty-front" exited with non-zero status code
```

## Fix
Persist configuration scope arg to the `check-coverage` command

## Question
Should we add a step in the `ci-front` what would merge all
`performance,modules,pages` coverage and calculate the `global` coverage
? => I think that this has no plus value as we still compute each of
them individualy
2025-01-17 12:42:32 +01:00
0357797612 [CI] Add performance to merge coverage matrix strategy job (#9708)
# Introduction
It seems like I've just oversight adding it back while debugging

# Centralization
Please note that we only have access to the following context within a
job matrix properties:
```
Available expression contexts: github, inputs, vars, needs
```
We could centralize the `storybook_scope` as a job `outputs` in order to
avoid this to re-occurs.
2025-01-17 11:17:39 +01:00
b2a0eb6620 [Microsoft Outlook] fix + error handling (#9696)
- bettter error handling
- small fix in the amount of items Microsoft graph api accepts
2025-01-17 11:04:49 +01:00
22ee77145a [CI] ci-server reorder twenty-shared build after cache restoration (#9672)
# Introduction
Unless I'm mistaken we can win few seconds `~12s` by reordering the
`twenty-shared` build step after the cache restoration in order for `nx`
to hit it if possible.

[Related
run](https://github.com/twentyhq/twenty/actions/runs/12809421832/job/35714544486)
2025-01-17 08:06:30 +01:00
7acb68929f Progress on translations (#9703)
Start adding a few translations on setting pages, introduce
pseudo-locale, switch to dynamic import, add eslint rule
2025-01-16 23:34:54 +01:00
f44b31573a Set up localization with feature flag control (#9649)
Refers #8128 

Changes Introduced:
- Added i18n configuration.
- Added a feature flag for localization.
- Enabled language switching based on the flag.

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
2025-01-16 21:00:56 +01:00
b81ffcc77c Add viewId to recordIndexId (#9647)
Before the `recordIndexId` was the name plural. This caused problems
because the component states were the same for every view of an object.
When we switched from one view to another, some states weren't reset.
This PR fixes this by:
- Creating an effect at the same level of page change effect to set the
`currentViewId` inside the object `contextStore`
- Adding the `currentViewId` to the `recordIndexId`

Follow ups:
- We need to get rid of
`packages/twenty-front/src/modules/views/states/currentViewIdComponentState.ts`
and use the context store instead
2025-01-16 18:41:19 +01:00
a248e891ae Upgrade to 0.40 guide (#9695) 2025-01-16 17:48:45 +01:00
6540057c98 fix(auth): return early in workspace access check (#9697)
Ensure early return in `hasUserAccessToWorkspaceOrThrow` for existing
users during sign-in. This prevents further unnecessary execution when
access validation is complete.
2025-01-16 17:36:53 +01:00
f621af1732 fix: date input click outside (#9676)
cc @lucasbordeau

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2025-01-16 17:35:59 +01:00
1df0603aaa Fix filter displayed value from query params (#9693)
Filter displayed value that use query params was broken. Recently we
added a new type of filters using the schema `{ selectedRecordIds:
string[] }` while before we were using `string[]` directly.
In that case, when fetching relation record name, we need to fix the
findManyRecord query.

Before
<img width="1512" alt="Capture d’écran 2025-01-16 à 16 10 33"
src="https://github.com/user-attachments/assets/36dc8c4f-91a4-438f-8480-bc237745a59e"
/>

After
<img width="1512" alt="Capture d’écran 2025-01-16 à 16 04 43"
src="https://github.com/user-attachments/assets/544512a3-0ef9-4d3e-993b-a4416737ab53"
/>
2025-01-16 17:16:42 +01:00
0ff8637469 Add create new record action to workflows (#9692)
- Added create new record action to `WorkflowActionsConfig`

As @FelixMalfait suggested
[here](https://github.com/twentyhq/core-team-issues/issues/72), we
should introduce an inheritance system for actions.
2025-01-16 17:10:16 +01:00
2eb98bf966 0.40 changelog (#9688)
![0
40-group-by](https://github.com/user-attachments/assets/0e013739-af86-4650-9508-98b233064c4c)
![0
40-aggregates](https://github.com/user-attachments/assets/d9af1a60-c67c-40e9-9ecc-f84d52512c8a)
2025-01-16 16:50:50 +01:00
ad0dc7d664 fix(auth): streamline SSO auth callback logic (#9668)
Removed unused UserService dependency and simplified authCallback
function by using destructured parameters. Added checks for user email
and integrated invitation lookup and access validation for enhanced SSO
sign-in/up flow.
2025-01-16 16:07:06 +01:00
91eac86520 fix empty actor field (#9677)
<img width="300" alt="Screenshot 2025-01-16 at 14 19 18"
src="https://github.com/user-attachments/assets/1d8558b1-cab2-4256-9ab8-cc085dced7cd"
/>
<img width="300" alt="Screenshot 2025-01-16 at 14 19 24"
src="https://github.com/user-attachments/assets/e7100be8-be76-4bed-b149-658cd996adb1"
/>

closes #9180

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
2025-01-16 15:28:06 +01:00
7ec48b93eb Use main apollo client for workflows (#9675)
We were using metadata client by legacy. Architecture is not great for
Core engine: workflows are available both in data and metadata client.
It makes more sense to use the data client since workflows are part of
standard objects
2025-01-16 15:21:29 +01:00
df93b5b311 fix: increase font height and decrease gap in TrialCard (#9686)
### Context

Fix design to match 'Choose Your Trial' [figma
design](https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=52632-204440&t=mRMsJYiGtmCmWrs6-4)

<img width="331" alt="Screenshot 2025-01-16 at 15 04 30"
src="https://github.com/user-attachments/assets/b582ee71-2b1a-4003-ac0a-e39028fe432a"
/>

[Bug bash link

](https://discord.com/channels/1130383047699738754/1329445193300312084/1329445193300312084)

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
2025-01-16 15:20:21 +01:00
446bbdbd96 Fix last record row cells are cropped when selected (#9678)
Before
<img width="432" alt="Capture d’écran 2025-01-16 à 14 52 34"
src="https://github.com/user-attachments/assets/0d23c48a-ad27-49ee-9194-7ae12397f928"
/>

After
<img width="503" alt="Capture d’écran 2025-01-16 à 14 51 55"
src="https://github.com/user-attachments/assets/c8b1c8d1-8655-48f0-81fc-d451878e0d10"
/>

---------

Co-authored-by: Weiko <corentin@twenty.com>
2025-01-16 15:14:06 +01:00
f545bd1c40 Treat suspended workspace as workspaces that need to be synced (#9669)
In this PR:
- migrate WorkspaceActivationStatus to twenty-shared (and update case to
make FE and BE consistent)
- introduce isWorkspaceActiveOrSuspended in twenty-shared
- refactor the code to use it (when we fetch data on the FE, we want to
keep SUSPENDED workspace working + when we sync workspaces we want it
too)
2025-01-16 15:01:04 +01:00
4a0b89d094 Update GetClientConfigQuery type (#9673)
Co-authored-by: Weiko <corentin@twenty.com>
2025-01-16 14:49:20 +01:00
5982a5a8ba Aggregate queries and field metadata deletion (#9660) 2025-01-16 14:46:56 +01:00
560f715c37 [CI][NITPICK]: Rename prerequisites jobs to changed-files-check (#9670)
Related to https://github.com/twentyhq/twenty/pull/9643

Renaming `prerequisites` jobs to a more accurate `changed-files-check`
2025-01-16 14:09:59 +01:00
f8ddc02b8e [CI] Refactor changed files integration (#9643)
# BEFORE
[run](https://github.com/twentyhq/twenty/actions/runs/12806801953)

![image](https://github.com/user-attachments/assets/f0a8ffe3-3fc0-42ca-b2ee-8a980606b5dd)
# AFTER
[run](https://github.com/twentyhq/twenty/actions/runs/12807034402)

![image](https://github.com/user-attachments/assets/5117c680-6804-416b-a8c8-bf00614ca453)

## Motivations:
- less workflow to whitelist as blocking for PRs
- less if condition per step

cons:
- quite verbose
- need to manually sync the `ci-NAME-status-check` needs list to any
other existing and should be dep jobs

## Version migration
Migrated to the latest `changed-files@45` version, getting rid of the
`set-output` usage warnings

## Tests runs:

With mutation:
- [Success
flow](https://github.com/twentyhq/twenty/actions/runs/12791958651/job/35661546343)
- [server-setup failure
flow](https://github.com/twentyhq/twenty/actions/runs/12792225779)
- [Other job failure
flow](https://github.com/twentyhq/twenty/actions/runs/12792313463), one
of the `inner` job failed
- [Manual cancel
flow](https://github.com/twentyhq/twenty/actions/runs/12792313463)
`ci-server-status-check` also has the `cancelled` status
- [Matrix
failure](https://github.com/twentyhq/twenty/actions/runs/12806883553)

Without mutation:
- [Nothing to do
flow](https://github.com/twentyhq/twenty/actions/runs/12792098384),
skipped `inner` job but `ci-server-status-check` still succeeded

## Notes
### Linter
We should setup a `yml` prettier and linter for the `.github/worfklows`
folder
### Centralized `ci-NAME-status-check` logic
Unfortunately I couldn't achieve to either make a `composite` action or
a `reusable-workflow`, as I could not access the correct layer to run
the `always` but also acessing the `needs` context
2025-01-16 13:37:28 +01:00
4503ee3fbd bugfix: fix navigation between onboarding screens (#9637)
# This PR

- Fixes #9565

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2025-01-16 11:24:03 +01:00
6a738181b4 [CI][NITPICK] .yml to yaml github workflows (#9664)
# Introduction
Applying the most present `yaml` file extension to all
`.github/workflows/` files

## Notes
Regarding the `restore-cache` and `save-cache` composite actions github
agnostically searches for any `DockerFile` `action.yml` and
`action.yaml` within the target folder when invoking composite actions
as follows:
```yml
      - name: Restore storybook build cache
        if: steps.changed-files.outputs.any_changed == 'true'
        uses: ./.github/workflows/actions/restore-cache
        with: 
          key: ${{ env.STORYBOOK_BUILD_CACHE_KEY }}
```
2025-01-16 11:21:00 +01:00
9a82fb980b fix: record group chevron alignment (#9661)
<img width="142" alt="Screenshot 2025-01-16 at 10 23 07 AM"
src="https://github.com/user-attachments/assets/07ea1d2f-0172-4f8e-94e4-bfeb87f4092a"
/>
<img width="153" alt="Screenshot 2025-01-16 at 10 22 37 AM"
src="https://github.com/user-attachments/assets/685bd859-cc51-4d52-8c3f-aba83056e92c"
/>

Fix Chevron alignment and CheckBox alignment
2025-01-16 11:20:39 +01:00
f74b12adb8 fix: group by disabled in dark mode wrong color (#9662)
<img width="255" alt="Screenshot 2025-01-16 at 10 51 50 AM"
src="https://github.com/user-attachments/assets/c171401e-6c19-42f1-975b-fdb33b0a0789"
/>
2025-01-16 11:15:03 +01:00
26058f3e25 Update ChooseYourPlan page with new trial period options (#9628)
### Context
- Update /plan-required page to let users get free trial without credit
card plan
- Update usePageChangeEffectNavigateLocation to redirect paused and
canceled subscription (suspended workspace) to /settings/billing page

### To do

- [x] Update usePageChangeEffectNavigateLocation test
- [x] Update ChooseYourPlan sb test



closes #9520

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
2025-01-16 11:10:36 +01:00
c79cb14132 Refetch query on draft creation (#9650)
After hitting use as draft, we redirect the user to the workflow page.
If the user already accessed that page, the workflow and its current
version will be stored in cache. So we also need to update that cache.

I tried to update it manually but it was more complex than expected.
Steps and trigger are not fully defined objects.

I ended with a simple refetch query that I wanted to avoid but that is
at least fully working with minimum logic.
2025-01-16 10:46:23 +01:00
34ddeade83 Documentation + docker-compose.yml update (#9653)
Related to #9469 #9455 #9419 #8943
2025-01-16 10:43:27 +01:00
5bae5a9f7c fix: filter dark mode (#9659)
Fix dark mode color of dropdown menu in Filter
2025-01-16 10:29:35 +01:00
f5b0926b63 feat: record group chevron button (#9645)
This ticket is related to this Discord post
https://discord.com/channels/1130383047699738754/1328756649657110559
2025-01-16 10:03:05 +01:00
f077efd171 Outlook integration (#9631)
Get Partial messages
2025-01-16 09:50:01 +01:00
789ff30dc7 fix(sso|auth): fix sso signinup (#9651)
Renamed `user` to `payload` for better context clarity and updated
related references. Adjusted the login token generation to use
`workspace.id`, improving readability and maintainability of the code.
2025-01-15 19:27:05 +01:00
f722a2d619 Add Email Verification for non-Microsoft/Google Emails (#9288)
Closes twentyhq/twenty#8240 

This PR introduces email verification for non-Microsoft/Google Emails:

## Email Verification SignInUp Flow:

https://github.com/user-attachments/assets/740e9714-5413-4fd8-b02e-ace728ea47ef

The email verification link is sent as part of the
`SignInUpStep.EmailVerification`. The email verification token
validation is handled on a separate page (`AppPath.VerifyEmail`). A
verification email resend can be triggered from both pages.

## Email Verification Flow Screenshots (In Order):

![image](https://github.com/user-attachments/assets/d52237dc-fcc6-4754-a40f-b7d6294eebad)

![image](https://github.com/user-attachments/assets/263a4b6b-db49-406b-9e43-6c0f90488bb8)

![image](https://github.com/user-attachments/assets/0343ae51-32ef-48b8-8167-a96deb7db99e)

## Sent Email Details (Subject & Template):
![Screenshot 2025-01-05 at 11 56
56 PM](https://github.com/user-attachments/assets/475840d1-7d47-4792-b8c6-5c9ef5e02229)

![image](https://github.com/user-attachments/assets/a41b3b36-a36f-4a8e-b1f9-beeec7fe23e4)

### Successful Email Verification Redirect:

![image](https://github.com/user-attachments/assets/e2fad9e2-f4b1-485e-8f4a-32163c2718e7)

### Unsuccessful Email Verification (invalid token, invalid email, token
expired, user does not exist, etc.):

![image](https://github.com/user-attachments/assets/92f4b65e-2971-4f26-a9fa-7aafadd2b305)

### Force Sign In When Email Not Verified:

![image](https://github.com/user-attachments/assets/86d0f188-cded-49a6-bde9-9630fd18d71e)

# TODOs:

## Sign Up Process

- [x] Introduce server-level environment variable
IS_EMAIL_VERIFICATION_REQUIRED (defaults to false)
- [x] Ensure users joining an existing workspace through an invite are
not required to validate their email
- [x] Generate an email verification token
- [x] Store the token in appToken
- [x] Send email containing the verification link
  - [x] Create new email template for email verification
- [x] Create a frontend page to handle verification requests

## Sign In Process

- [x] After verifying user credentials, check if user's email is
verified and prompt to to verify
- [x] Show an option to resend the verification email

## Database

- [x] Rename the `emailVerified` colum on `user` to to `isEmailVerified`
for consistency

## During Deployment
- [x] Run a script/sql query to set `isEmailVerified` to `true` for all
users with a Google/Microsoft email and all users that show an
indication of a valid subscription (e.g. linked credit card)
- I have created a draft migration file below that shows one possible
approach to implementing this change:

```typescript
import { MigrationInterface, QueryRunner } from 'typeorm';

export class UpdateEmailVerifiedForActiveUsers1733318043628
  implements MigrationInterface
{
  name = 'UpdateEmailVerifiedForActiveUsers1733318043628';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      CREATE TABLE core."user_email_verified_backup" AS
      SELECT id, email, "isEmailVerified"
      FROM core."user"
      WHERE "deletedAt" IS NULL;
    `);

    await queryRunner.query(`
      -- Update isEmailVerified for users who have been part of workspaces with active subscriptions
      UPDATE core."user" u
      SET "isEmailVerified" = true
      WHERE EXISTS (
        -- Check if user has been part of a workspace through userWorkspace table
        SELECT 1 
        FROM core."userWorkspace" uw
        JOIN core."workspace" w ON uw."workspaceId" = w.id
        WHERE uw."userId" = u.id
        -- Check for valid subscription indicators
        AND (
          w."activationStatus" = 'ACTIVE'
          -- Add any other subscription-related conditions here
        )
      )
      AND u."deletedAt" IS NULL;
  `);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      UPDATE core."user" u
      SET "isEmailVerified" = b."isEmailVerified"
      FROM core."user_email_verified_backup" b
      WHERE u.id = b.id;
    `);

    await queryRunner.query(`DROP TABLE core."user_email_verified_backup";`);
  }
}

```

---------

Co-authored-by: Antoine Moreaux <moreaux.antoine@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
2025-01-15 18:43:40 +01:00
266b771a5b [test(auth)]: Add unit tests for useSignInUpForm hook (#9648)
Introduce unit tests to validate the behavior of the useSignInUpForm
hook. Tests cover default initialization, handling of developer
defaults, and prefilled values based on state.
2025-01-15 18:07:06 +01:00
585212b441 Aggregate queries - Fix empty / not empty operations on composite fields and array fields (#9644)
as per title

closes https://github.com/twentyhq/twenty/issues/9353
2025-01-15 16:59:46 +00:00
b5c5bee6cf Fix error message (#9646)
- fix typo
2025-01-15 16:29:42 +00:00
c01e3af8ee Fix race condition on stripe subscription (#9629)
Fixes https://github.com/twentyhq/core-team-issues/issues/191
- remove automatic redirection on payment success page when subscription
status is undefined
- add an effect component to refresh the subscription status on payment
success page

Observation: Locally, I had to delay the stripe webhook subscription
created endpoint by 7s to see race condition issue


https://github.com/user-attachments/assets/463e1816-34fd-4c4f-b590-3994a3a3e91a
2025-01-15 16:08:34 +01:00
d63aec44bb [CI] Yarn install composite action remove --immutable-cache (#9641) 2025-01-15 16:02:29 +01:00