Commit Graph

1166 Commits

Author SHA1 Message Date
Ady Beraud
20670695d6
Added OG Image (#5251)
- Added dynamic OG Image to share and download in contributors page

<img width="1176" alt="Screenshot 2024-05-02 at 16 24 00"
src="https://github.com/twentyhq/twenty/assets/102751374/0579454b-ccc7-46ba-9875-52458f06ee82">

- Added dynamic metadata 

- Added design to contributor page

- Added a NEXT_PUBLIC_HOST_URL in the .env file

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
2024-05-03 16:38:41 +02:00
Thomas Trompette
a5a9e0e238
Remove isMultiSelect feature flag (#5280)
As title

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-05-03 16:30:58 +02:00
Thomas Trompette
5285a428d1
Fix export with relations (#5279)
As title. Only relations are exported right now

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-05-03 16:14:37 +02:00
Charles Bochet
1d9cd234ea
Fix white screen on token expire (#5271)
While using middleware (executed pre-graphql) for graphql endpoint, we
need to swallow exception and return errors with a 200. Otherwise it's
not a valid graphql response
2024-05-03 15:35:49 +02:00
Weiko
2a0c74ab0f
[calendar] Fix calendar sync status (#5272)
## Context
There is no calendarChannel syncStatus column compared to the
messageChannel table. In the meantime, we are trying to infer its status
based on the fact that the connection hasn't failed and the sync is
enabled
2024-05-03 15:32:34 +02:00
martmull
87994c26ff
4900 multi select field front implement expanded cells (#5151)
Add expanded cell


https://github.com/twentyhq/twenty/assets/29927851/363f2b44-7b3c-4771-a651-dfc4014da6ac


![image](https://github.com/twentyhq/twenty/assets/29927851/741bb0f9-fd1e-4a38-8b0e-71e144376876)
2024-05-03 15:03:06 +02:00
Thaïs
1351a95754
fix: fix storybook coverage task (#5256)
- Fixes storybook coverage command: the coverage directory path was
incorrect, but instead of failing `storybook:test --configuration=ci`,
it was hanging indefinitely.
- Switches back to `concurrently` to launch `storybook:static` and
`storybook:test` in parallel, which allows to use options to explicitly
kill `storybook:static` when `storybook:test` fails.
- Moves `storybook:test --configuration=ci` to its own command
`storybook:static:test`: used in the CI, and can be used locally to run
storybook tests without having to launch `storybook:dev` first.
- Creates command `storybook:coverage` and enables cache for this
command.
- Fixes Jest tests that were failing.
- Improves caching conditions for some tasks (for instance, no need to
invalidate Jest test cache if only Storybook story files were modified).
2024-05-03 14:59:09 +02:00
Weiko
50421863d4
Fix filter transform with logic operators (#5269)
Various fixes

- Remote objects are read-only for now, we already hide and block most
of the write actions but the button that allows you to add a new record
in an empty collection was still visible.
- CreatedAt is not mandatory on remote objects (at least for now) so it
was breaking the show page, it now checks if createdAt exists and is not
null before trying to display the human readable format `Added x days
ago`
- The filters are overwritten in query-runner-args.factory.ts to handle
NUMBER field type, this was only working with filters like
```
      {
        "id": {
          "in": [
            1
          ]
        }
```
but not with more depth such as 
```
    "and": [
      {},
      {
        "id": {
          "in": [
            1
          ]
        }
      }
    ]
 ```
- Fixes CREATE FOREIGN TABLE raw query which was missing ",".
2024-05-03 14:52:20 +02:00
Weiko
30ffe0160e
Fix token validation on graphql IntrospectionQuery (#5255)
## Context
We recently introduced a change that now throws a 401 if the token is
invalid or expired.
The first implementation is using an allow list and 'IntrospectionQuery'
was missing so the playground was broken.

The check has been updated and we now only check the excludedOperations
list if a token is not present. This is because some operations can be
both used as loggedIn and loggedOut so we want to validate the token for
those sometimes (and set the workspace, user, cache version, etc). Still
not a very clean solution imho.
2024-05-03 10:30:47 +02:00
Félix Malfait
1430a6745c
Quick job update (#5265) 2024-05-03 09:38:03 +02:00
Weiko
fe758e193f
fix workspace-member deletion with existing attachments/documents (#5232)
## Context
We have a non-nullable constraint on authorId in attachments and
documents, until we have soft-deletion we need to handle deletion of
workspace-members and their attachments/documents.
This PR introduces pre-hooks to deleteOne/deleteMany
This is called when a user deletes a workspace-member from the members
page

Next: needs to be done on user level as well. This is called when users
try to delete their own accounts. I've seen other issues such as
re-creating a user with a previously used email failing.
2024-05-02 17:36:57 +02:00
Thomas Trompette
f9c19c839b
Build stripe integration on backend side (#5246)
Adding stripe integration by making the server logic independent of the
input fields:
- query factories (remote server, foreign data wrapper, foreign table)
to loop on fields and values without hardcoding the names of the fields
- adding stripe input and type
- add the logic to handle static schema. Simply creating a big object to
store into the server

Additional work:
- rename username field to user. This is the input intended for postgres
user mapping and we now need a matching by name

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-05-02 17:13:15 +02:00
Thaïs
5128ea3ffb
fix: fix storybook build script not found by Chromatic (#5235) 2024-05-02 16:15:36 +02:00
Charles Bochet
f802964de4 Bump to 0.10.6 2024-05-02 15:55:11 +02:00
Charles Bochet
3015f4ce31
Fix sync metadata script (#5253)
While troubleshooting self-hosting migration, we run into issues with
sync-metadata script introduced by recent changes
2024-05-02 15:50:40 +02:00
Weiko
8d90c60ada
[calendar] hide calendar settings until implemented (#5252)
## Context
Those settings are not implemented yet, we would like to move them to a
different page as well.
In the meantime, we are hiding them since we plan to launch calendar in
the next release and this won't be implemented before.

We will implement it in this
https://github.com/twentyhq/twenty/issues/5140
2024-05-02 15:47:43 +02:00
Marie
1da64c7715
[feat] Minor updates to the edit db connection page (#5250)
- Add placeholders in db connection edit page
- Fix icon alignement and size (should not change) in Info banner
2024-05-02 15:25:54 +02:00
brendanlaschke
05a90d6153
Constant api version (#5248)
closes #5206
2024-05-02 14:21:19 +02:00
Weiko
9a116b08a4
User workspace middleware throws 401 if token is invalid (#5245)
## Context
Currently, this middleware validates the token and stores the user,
workspace and cacheversion in the request object.
It only does so when a token is provided and ignores the middleware
logic if not. If the token is invalid or expired, the exception is
swallowed.

This PR removes the try/catch and adds an allowlist to skip the token
validation for operations executed while not signed-in.
I don't know a better way to do that with Nestjs. We can't easily add
the middleware per resolver without refactoring the flexible schema
engine so I'm doing it the other way around.

Fixes https://github.com/twentyhq/twenty/issues/5224
2024-05-02 12:54:01 +02:00
Charles Bochet
27a3d7ec27 Bump to 0.10.5 2024-05-02 11:00:24 +02:00
gitstart-app[bot]
268c6b44d9
Enable phone field type (#5052)
### Description

 Enable phone field type

### Refs

https://github.com/twentyhq/twenty/issues/2700

### Demo


https://github.com/twentyhq/twenty/assets/140154534/e9810718-9916-4ad4-a080-4d718777de15

Fixes #2700

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-05-01 15:47:19 +02:00
gitstart-app[bot]
485670c823
Add relation in CSV exports (#5085)
### Description

Add Relation Id to Table in CSV exports

### Demo

Before:


<https://www.loom.com/share/c853cf32767947dcb23a91363bff52c4?sid=0295b6ee-4510-47f8-8ba9-b81b5182985a>

After:


<https://www.loom.com/share/5aa4f87a266c4d96881170a38e063fc0?sid=44eed60c-01a2-406f-9bac-af162e39b66e>

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Chiazokam <chiazokamecheta@gmail.com>
2024-05-01 15:24:23 +02:00
Thaïs
0d023e5e77
feat: update links field (#5212)
Closes #5113

---------

Co-authored-by: Jérémy Magrin <jeremy.magrin@gmail.com>
2024-05-01 14:56:55 +02:00
Thaïs
8853226d17
feat: add Links field type (#5176)
Closes #5113

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-05-01 11:56:14 +02:00
Marie
e0ece3c917
Rename types for UserMappingOptions (#5230)
Following #5210

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-05-01 11:46:47 +02:00
Ady Beraud
0bc3b6f179
Modifications user guide (#5207)
- Modified layout and responsive
- Added remaining user guide cards
- Added new table of content:


https://github.com/twentyhq/twenty/assets/102751374/007118e5-60f2-4572-90cf-339c134f23c4

-Added fade-in:


https://github.com/twentyhq/twenty/assets/102751374/0669c06d-3eab-484c-a5b5-3857c68f42b5

---------

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
2024-05-01 08:55:57 +02:00
Ady Beraud
df5cb9a904
Smart changelog (#5205)
Added a smart Changelog :

- Publish the Changelog before the app release. If the release has not
yet been pushed to production, do not display it.
- When the app release is done, make the Changelog available with the
correct date.
- If the Changelog writing is delayed because the release has already
been made, publish it immediately.
- Display everything locally to be able to iterate on the changelog and
have a preview

Added an endpoint for the Changelog

---------

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-05-01 08:35:11 +02:00
Charles Bochet
bf7c4a5a89 Fix restrictive javascript heap memory 2024-04-30 19:17:12 +02:00
Charles Bochet
b7c2f83abf
Fix sign up (#5231)
Sign up was broken by #5199
2024-04-30 18:48:07 +02:00
Charles Bochet
7dad6e3b5e Re-add chromatic CI 2024-04-30 18:21:08 +02:00
Charles Bochet
ccd1100773
Fix tests (#5228)
Fixing typecheck + storybook:modules!
2024-04-30 17:54:07 +02:00
Marie
1b2ed80c1c
[feat][Remote objects] Edit a connection (for pg) (#5210)
## Context
#4774 

## How was it tested
Locally

## In further PRs
- Update connection status upon page change
- Adapt Info banner to dark mode
- placeholders for form
2024-04-30 17:46:30 +02:00
bosiraphael
3bf9045990
Fix record position on contact creation (#5227)
Fix record position on contact creation

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-04-30 17:09:29 +02:00
gitstart-twenty
9ad68ffe84
Favorites should be user-level not workspace-level (#5186)
### Description
Favorites should be user-level not workspace-level

### Refs
#3374

### Demo


https://github.com/twentyhq/twenty/assets/140154534/38a34cc7-ac58-494f-92d5-e15c43ae542e

Fixes #3374

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-04-30 16:42:44 +02:00
Weiko
bc0d30f28b
[flexible-backend] handle object already exists error (#5225)
## Context
Currently we have an unicity constraint in the DB but we don't return a
clear error to the frontend before reaching the DB (which then throws a
500). This PR adds a validation check similar to what we have with field
creation
2024-04-30 16:36:02 +02:00
Thaïs
c193663a71
chore: use Nx affected tasks in CI (#5110)
Closes #5097

- Uses "nx affected" to detect what projects need to be checked in the
current PR (for now, `ci-front` and `ci-server` workflows only).
- Caches results of certain tasks (`lint`, `typecheck`, `test`,
`storybook:build`) when a PR pipeline runs. The next runs of the same
PR's pipeline will then be able to reuse the PR's task cache to execute
tasks faster.
- Caches Yarn's cache folder to install dependencies faster in CI jobs.
- Rewrites the node modules cache/install steps as a custom, reusable
Github action.
- Distributes `ci-front` jobs with a "matrix" strategy.
- Sets common tasks config at the root `nx.json`. For instance, to
activate the `typecheck` task in a project, add `typecheck: {}` to its
`project.json` and it'll use the default config set in `nx.json` for the
`typecheck` task. Options can be overridden in each individual
`project.json` if needed.
- Adds "scope" tags to some projects: `scope:frontend`, `scope:backend`,
`scope:shared`. An eslint rule ensures that `scope:frontend` only
depends on `scope:frontent` or `scope:shared` projects, same for
`scope:backend`. These tags are used by `nx affected` to filter projects
by scope and generates different task cache keys according to the
requested scope.
- Enables checks for twenty-emails in the `ci-server` workflow.
2024-04-30 16:28:25 +02:00
Weiko
a77cb023c0
Flush cache when reset db (#5214)
Now that we have persistent cache for schemas, we want to be able to
reset its state when users run the database:reset db otherwise schemas
won't be synced with the new DB state.

Note: In an upcoming PR, we want to be able to invalidate the cache on a
workspace level when we change the metadata schema through twenty
version upgrade
2024-04-30 15:03:24 +02:00
Weiko
f512049381
[messaging/calendar] cron jobs can run regardless of sub status if billing is disabled (#5218)
## Context
Messaging and calendar cron jobs are only working for workspace that
have sub status different than incomplete, this is because currently
this is the simplest way to know if a user is onboarded. This should not
be the source of truth and this will be updated in a later version. In
the meantime, to make self-hosting easier, we are adding an extra check
on IS_BILLING_ENABLED env var since sub status is not relevant for
people not using billing.
2024-04-30 15:01:22 +02:00
bosiraphael
7c605fc2f9
4002 prevent user from creating twice the same blocklist item (#5213)
Closes #4002
2024-04-30 14:36:33 +02:00
Thomas Trompette
3a61c922f1
Import full distant schema and store in remote server (#5211)
We should not depend on the foreign data wrapper type to manage distant
table. The remote server should be enough to handle the table creation.

Here is the new flow to fetch available tables:
- check if the remote server have available tables already stored
- if not, import full schema in a temporary schema
- copy the tables into the available tables field 
- delete the schema

Left todo:
- update remote server input for postgres so we receive the schema

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-04-30 14:18:33 +02:00
bosiraphael
907f0a1ea6
Add feature flag gate on calendar settings dropdown and fix queries (#5221)
- Add feature flag gate on calendar settings dropdown
- Fix find many messages
- Fix connected accounts settings
2024-04-30 14:12:48 +02:00
Weiko
95d80af0c6
Remove debounce on filter search bar (#5215)
A search bar has been introduced in the filter dropdown menu however we
don't want to apply debounce since the search has no side-effect and is
purely FE (it's not querying the DB compared to other search bars). Also
adding autofocus on the search bar when the dropdown is open.
2024-04-30 10:44:32 +02:00
Charles Bochet
fab385179b Fix Favorites issue 2024-04-30 00:38:22 +02:00
Charles Bochet
dd366dba47 Bump version to 0.10.4 2024-04-29 23:48:15 +02:00
Charles Bochet
6a14b1c6d6
Fix tasks (#5199)
## Query depth deprecation

I'm deprecating depth parameter in our graphql query / cache tooling.
They were obsolete since we introduce the possibility to provide
RecordGqlFields

## Refactor combinedFindManyRecordHook

The hook can now take an array of operationSignatures

## Fix tasks issues

Fix optimistic rendering issue. Note that we still haven't handle
optimisticEffect on creation properly
2024-04-29 23:33:23 +02:00
gitstart-app[bot]
c946572fde
TWNTY-4203 - Improve Email Thread Visibility with Collapse/Expansion Rules (#5202)
### Description

Improve Email Thread Visibility with Collapse/Expansion Rules

### Refs
#4203

### Demo


https://github.com/twentyhq/twenty/assets/140154534/ece1d783-57ef-45c9-9895-3b4b0e02b9e2


Fixes #4203

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
2024-04-29 18:10:42 +02:00
Vinod Rathod
6065201acd
Implemented Search Feature in Filter Menu (#5068)
Closes #4367
2024-04-29 17:59:26 +02:00
Quentin G
c1740e3395
Feat/add postgres spilo (#5049)
This is a new Docker image that extends the Zalando Spilo image in order
to install the extensions needed by Twenty : pg_graphql, wrappers,
mysql_fdw
2024-04-29 17:09:41 +02:00
Jérémy M
e2185448ed
Feat/twenty orm (#5153)
## Introduction

This PR introduces "TwentyORM," a custom ORM module designed to
streamline database interactions within our workspace schema, reducing
the need for raw SQL queries. The API mirrors TypeORM's to provide a
familiar interface while integrating enhancements specific to our
project's needs.

To facilitate this integration, new decorators prefixed with `Workspace`
have been implemented. These decorators are used to define entity
metadata more explicitly and are critical in constructing our schema
dynamically.

## New Features

- **Custom ORM System**: Named "TwentyORM," which aligns closely with
TypeORM for ease of use but is tailored to our application's specific
requirements.
- **Decorator-Driven Configuration**: Entities are now configured with
`Workspace`-prefixed decorators that clearly define schema mappings and
relationships directly within the entity classes.
- **Injectable Repositories**: Repositories can be injected similarly to
TypeORM, allowing for flexible and straightforward data management.

## Example Implementations

### Decorated Entity Definitions

Entities are defined with new decorators that outline table and field
metadata, relationships, and constraints. Here are examples of these
implementations:

#### Company Metadata Object

```typescript
@WorkspaceObject({
  standardId: STANDARD_OBJECT_IDS.company,
  namePlural: 'companies',
  labelSingular: 'Company',
  labelPlural: 'Companies',
  description: 'A company',
  icon: 'IconBuildingSkyscraper',
})
export class CompanyObjectMetadata extends BaseObjectMetadata {
  @WorkspaceField({
    standardId: COMPANY_STANDARD_FIELD_IDS.name,
    type: FieldMetadataType.TEXT,
    label: 'Name',
    description: 'The company name',
    icon: 'IconBuildingSkyscraper',
  })
  name: string;

  @WorkspaceField({
    standardId: COMPANY_STANDARD_FIELD_IDS.xLink,
    type: FieldMetadataType.LINK,
    label: 'X',
    description: 'The company Twitter/X account',
    icon: 'IconBrandX',
  })
  @WorkspaceIsNullable()
  xLink: LinkMetadata;

  @WorkspaceField({
    standardId: COMPANY_STANDARD_FIELD_IDS.position,
    type: FieldMetadataType.POSITION,
    label: 'Position',
    description: 'Company record position',
    icon: 'IconHierarchy2',
  })
  @WorkspaceIsSystem()
  @WorkspaceIsNullable()
  position: number;

  @WorkspaceRelation({
    standardId: COMPANY_STANDARD_FIELD_IDS.accountOwner,
    label: 'Account Owner',
    description: 'Your team member responsible for managing the company account',
    type: RelationMetadataType.MANY_TO_ONE,
    inverseSideTarget: () => WorkspaceMemberObjectMetadata,
    inverseSideFieldKey: 'accountOwnerForCompanies',
    onDelete: RelationOnDeleteAction.SET_NULL,
  })
  @WorkspaceIsNullable()
  accountOwner: WorkspaceMemberObjectMetadata;
}
```

#### Workspace Member Metadata Object

```typescript
@WorkspaceObject({
  standardId: STANDARD_OBJECT_IDS.workspaceMember,
  namePlural: 'workspaceMembers',
  labelSingular: 'Workspace Member',
  labelPlural: 'Workspace Members',
  description: 'A workspace member',
  icon: 'IconUserCircle',
})
@WorkspaceIsSystem()
@WorkspaceIsNotAuditLogged()
export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
  @WorkspaceField({
    standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.name,
    type: FieldMetadataType.FULL_NAME,
    label: 'Name',
    description: 'Workspace member name',
    icon: 'IconCircleUser',
  })
  name: FullNameMetadata;

  @WorkspaceRelation({
    standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.accountOwnerForCompanies,
    label: 'Account Owner For Companies',
    description: 'Account owner for companies',
    icon: 'IconBriefcase',
    type: RelationMetadataType.ONE_TO_MANY,
    inverseSideTarget: () => CompanyObjectMetadata,
    inverseSideFieldKey: 'accountOwner',
    onDelete: RelationOnDeleteAction.SET_NULL,
  })
  accountOwnerForCompanies: Relation

<CompanyObjectMetadata[]>;
}
```

### Injectable Repository Usage

Repositories can be directly injected into services, allowing for
streamlined query operations:

```typescript
export class CompanyService {
  constructor(
    @InjectWorkspaceRepository(CompanyObjectMetadata)
    private readonly companyObjectMetadataRepository: WorkspaceRepository<CompanyObjectMetadata>,
  ) {}

  async companies(): Promise<CompanyObjectMetadata[]> {
    // Example queries demonstrating simple and relation-loaded operations
    const simpleCompanies = await this.companyObjectMetadataRepository.find({});
    const companiesWithOwners = await this.companyObjectMetadataRepository.find({
      relations: ['accountOwner'],
    });
    const companiesFilteredByLinkLabel = await this.companyObjectMetadataRepository.find({
      where: { xLinkLabel: 'MyLabel' },
    });

    return companiesFilteredByLinkLabel;
  }
}
```

## Conclusions

This PR sets the foundation for a decorator-driven ORM layer that
simplifies data interactions and supports complex entity relationships
while maintaining clean and manageable code architecture. This is not
finished yet, and should be extended.
All the standard objects needs to be migrated and all the module using
the old decorators too.

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-04-29 16:47:42 +02:00
hnrykm
6e87554445
updated: removed gradient from onboarding buttons (#5178)
Fixes #5168

- Added primaryInverted and primaryInvertedHover to design system.
- Changed primary button background with a gradient to inverted-flat for
both light and dark themes.
- Hover added to go lighter (consistent with tertiary color of +5 step
on GRAY_SCALE).
- Font color changed from primary to inverted.
- Modified button border from light to strong.

Two components are still utilizing the button with gradient background -
email and chrome extension.
Figma design guidelines show them to be inverted and flat (not
gradient).

- Should I change those as well?
- Should the gradient style be removed altogether after this has been
completed?

Co-authored-by: Henry Kim <henrykim@Henrys-iMac.local>
2024-04-29 16:11:42 +02:00