Commit Graph

3459 Commits

Author SHA1 Message Date
martmull
b9c8d607aa
Test revert crm integration (#6321)
PR to test revert integration in production
2024-07-25 09:38:55 +02:00
martmull
7c6ca0e841
Fix api timeout (#6401) 2024-07-25 08:38:05 +02:00
Marie
082d55beac
[fix] Migrated links field should be standard (#6387)
Fixing script + ading logs to sync-metadata
2024-07-24 12:16:14 +02:00
Marie
001e698bbe
Use LinksMetadata right type for Links fields (#6380) 2024-07-24 10:48:15 +02:00
Pacifique LINJANJA
6785a2b92c
chore: remove the passwordResetToken field from the database (#6377)
# This PR

- Fix #6305
2024-07-24 10:44:11 +02:00
nitin
895910e1d1
Fix RecordTableHeaderCell (#6383)
@Bonapara

Fixed! the issue (#6365) where the `background-color` style was not set,
causing the bug. Now, the background color is properly applied.



https://github.com/user-attachments/assets/668bd3cc-77ea-42a9-84d4-071fca497e07
2024-07-24 10:41:03 +02:00
Marie
b0b2281fc5
Fix mocks for unlogged users (#6376) 2024-07-24 10:08:54 +02:00
brendanlaschke
ea4d051c4e
Fix task text overflow (#6351)
closes #5552

<img width="754" alt="Bildschirmfoto 2024-07-19 um 23 35 25"
src="https://github.com/user-attachments/assets/715192cd-679d-430a-95f1-8bc1d8fd26f4">
2024-07-24 10:04:10 +02:00
Aryan Singh
5c8fe027f9
5425 - Introducing support for all Composite Fields Import (#5470)
Adding support for all Composite Fields while using the "import"
functionality. This includes:
- Currency
- Address

Edit : 
- Refactored a lot of types in the spreadsheet import module
- Renamed a lot of functions, hooks and types that were not
self-explanatory enough

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-07-23 18:02:23 +02:00
Charles Bochet
2cc0597ee4 Update seed links format 2024-07-23 14:48:26 +02:00
Charles Bochet
6c34ef9a14
Simplify ORM (#6373)
This PR refactors the ORM-Manager to simplify and unify the datasource
creation. I'm deprecating all usages if InjectWorkspaceDatasource and
InjectWorkspaceRepository as we can't be sure they are up-to-date
2024-07-23 14:13:16 +02:00
Marie
794e73eeb6
Migrate conferenceLink to type Links (#6372) 2024-07-23 14:09:52 +02:00
Marie
8d33264a7d
Migrate fields of deprecated type LINK to type LINKS (#6332)
Closes #5909.

Adding a command to migrate fields of type Link to fields of type Links,
including their data.
2024-07-23 09:57:30 +02:00
Charles Bochet
c69d665114
Fix reset PasswordToken (#6366)
## Bug Description

We are facing a bug in case recaptcha is enabled.
To reproduce:
- Create your recaptcha: https://www.google.com/recaptcha/about/
- update your server .env with the following variables:

```
CAPTCHA_SECRET_KEY=REPLACE_ME
CAPTCHA_SITE_KEY=REPLACE_ME
CAPTCHA_DRIVER=google-recaptcha
```

- Go to the login page, enter an existing user email and hit 'Reset your
password'.

- Add a console.log in emailPasswordResetLink in auth.resolver.ts to get
the token that would be sent by email if you don't have the mailer setup

- Browse: /reset-password/{passwordToken}

- Update the password:
<img width="1446" alt="image"
src="https://github.com/user-attachments/assets/dd5b077f-293e-451a-8630-22d24ac66c42">

- See that the token is invalid

You should see two calls in your developer network tab. A successful one
to update the password and another to log you in. This 2nd call
(Challenge) does not have the captcha token provided. It should be

## Fix

- Refreshing the token on page load
- providing it to the Challenge graphql call
2024-07-22 17:36:31 +02:00
brendanlaschke
01fe3b673e
Datamodel overview show other fields (#6352)
<img width="638" alt="Bildschirmfoto 2024-07-19 um 23 49 00"
src="https://github.com/user-attachments/assets/57b600c4-d985-4e4c-afc0-e0c6dd5bc9f6">

---------

Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
2024-07-22 16:13:49 +02:00
brendanlaschke
4545ba2737
Update blocknote (#6349)
Updating blocknote providing bugfixes & new block types

---------

Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
2024-07-22 16:00:14 +02:00
Charles Bochet
d212aedf81
Fix ORM (#6363)
This PR fixes a few bugs on TwentyORM:
- fix many to one relations that were not properly queries
- fix many to one relations that were not properly parsed
- compute datasource (or use from cache) at run-time and do not use
injected one that could be outdated

We still need to refactor it to simplify, I feel the API are too complex
and we have too many cache layers. Also the relation computation part is
very complex and bug prone
2024-07-22 15:07:35 +02:00
Faisal-imtiyaz123
284e75791c
Fixes Strange behaviour when reordering options of select field (#6103) (#6339)
fixes #6103

---------

Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
2024-07-22 14:33:02 +02:00
falko100
f24536c115
Add Confirmation Modal for Deletion Action and Map All Action Bar Entries (#6357)
This pull request addresses an issue where the delete button, placed
closely to the export button, could lead to accidental deletions without
confirmation. The problem was that the confirmation modal for the delete
action, being the second action, was not displayed. The code was updated
to map all action bar entries and display their respective confirmation
modals correctly.

### Changes Made:
- Updated the rendering of action bar entries to ensure all confirmation
modals are shown.
Changed from displaying only the first action bar entry's confirmation
modal to mapping through all entries and displaying each modal if it
exists.
- Removed the delete from the onClick because it is present in the
onConfirmClick.
2024-07-22 14:22:10 +02:00
Marie
14fcd5f900
Fix display of boolean fields in timeline activities (#6361)
before
<img width="556" alt="Capture d’écran 2024-07-22 à 11 29 59"
src="https://github.com/user-attachments/assets/c3f76698-77f8-411f-8488-c3b119184f91">

after
<img width="963" alt="Capture d’écran 2024-07-22 à 11 31 07"
src="https://github.com/user-attachments/assets/29248677-16c6-49f5-8a86-cfe8aa677d86">
2024-07-22 14:15:10 +02:00
Faisal-imtiyaz123
4f249df831
Fixes data importer showing incorrect unmatched fields (# 6138) (#6311)
fixes #6138

---------

Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
2024-07-22 14:13:00 +02:00
gitstart-app[bot]
41931c53e8
Record board columns design fix (full height borders) (#6350)
This PR was created by [GitStart](https://gitstart.com/) to address the
requirements from this ticket:
[TWNTY-5273](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-5273).
This ticket was imported from:
[TWNTY-5273](https://github.com/twentyhq/twenty/issues/5273)

 --- 


## Description:

- We added a min-height to fix the main issue, in two components, one of
them needs \`calc\` because the border causes the creation of a
scrollbar
- The change on the overflow fixes the issue mentioned
[here](https://github.com/twentyhq/twenty/issues/5273#issuecomment-2232945913)

## Refs: #5273

## Demo:

\
<https://jam.dev/c/01cac1e5-ed66-439c-88fb-9406a06429c5>\
\
Fixes #5273

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
2024-07-22 13:58:55 +02:00
brendanlaschke
936994ff44
Fix demo opportunities name (#6347)
closes #5129
2024-07-22 12:22:32 +02:00
Ashmash100
52c6320f74
Fixed reset rating field to "no value" on star re-click (#6296)
### Description
Resolves Issue:  [https://github.com/twentyhq/twenty/issues/6224](#6224)

### Additional Consideration
I have changed the default start rating value from 1 star to no star
since clicking on the selected start was reverting the filed to 1 star
which didn't seem like the appropriate behaviour. Let me know if this
change is fine

---------

Co-authored-by: JosephAshwin23 <joseph.sanjivi@anywhere.co>
Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
2024-07-22 12:17:10 +02:00
Priyank Sevak
33fc4ff907
New "inverted" Background Colors (#6354)
- Added 2 new Inverted background colors as requested under issue#4726

Co-authored-by: Marie Stoppa <marie.stoppa@essec.edu>
2024-07-22 12:03:23 +02:00
Charles Bochet
d8cadad0fa
Deprecate inject workspace repo (#6353) 2024-07-20 00:43:29 +02:00
Charles Bochet
2e38c3bbc1
Refactor raw queries to use prepared query to avoid security vuln. (#6348)
As per title, we should avoid at all cost using non-prepared query and
NEVER use them whenever the input come from the user.
2024-07-19 22:32:40 +02:00
Charles Bochet
cac0d22285 Fix chromatic pixel tests 2024-07-19 19:42:04 +02:00
Lucas Bordeau
b64e8096d6
Fixed scoped hotkeys (#6322)
- Removed enabled props from useScopedHotkeys becayse it doesn't work
- Moved enter useScopedHotkeys in a handler that we drill down to the
text inputs on the settings form

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-07-19 19:25:12 +02:00
Jérémy M
de20c564c7
feat: add eslint rule for enforcing WorkspaceService naming convention (#6308)
### Description

This PR introduces a custom ESLint rule named
`inject-workspace-repository`. The purpose of this rule is to enforce
naming conventions for files and classes that use the
`@InjectWorkspaceRepository` decorator or include services ending with
`WorkspaceService` in their constructors.

### Rule Overview

The new ESLint rule checks for the following conditions:

1. **File Naming**:
- Only file ending with `.service.ts` or `.workspace-service.ts` are
checked.
- If a file contains a class using the `@InjectWorkspaceRepository`
decorator or a service ending with `WorkspaceService` in the
constructor, the file name must end with `.workspace-service.ts`.

2. **Class Naming**:
- Classes that use the `@InjectWorkspaceRepository` decorator or include
services ending with `WorkspaceService` in their constructors must have
names that end with `WorkspaceService`.

### How It Works

The rule inspects each TypeScript file to ensure that the naming
conventions are adhered to. It specifically looks for:

- Constructor parameters with the `@InjectWorkspaceRepository`
decorator.
- Constructor parameters with a type annotation ending with
`WorkspaceService`.

When such parameters are found, it checks the class name and the file
name to ensure they conform to the expected patterns.

### Example Code

#### Valid Cases

1. **Correct File and Class Name with Decorator**:
    ```typescript
    // Filename: my.workspace-service.ts
    class MyWorkspaceService {
      constructor(@InjectWorkspaceRepository() private repository) {}
    }
    ```

2. **Service Dependency**:
    ```typescript
    // Filename: another.workspace-service.ts
    class AnotherWorkspaceService {
      constructor(private myWorkspaceService: MyWorkspaceService) {}
    }
    ```

#### Invalid Cases

1. **Incorrect Class Name**:
    ```typescript
    // Filename: my.workspace-service.ts
    class MyService {
      constructor(@InjectWorkspaceRepository() private repository) {}
    }
    // Error: Class name should end with 'WorkspaceService'.
    ```

2. **Incorrect File Name**:
    ```typescript
    // Filename: my.service.ts
    class MyWorkspaceService {
      constructor(@InjectWorkspaceRepository() private repository) {}
    }
    // Error: File name should end with '.workspace-service.ts'.
    ```

3. **Incorrect File and Class Name**:
    ```typescript
    // Filename: my.service.ts
    class MyService {
      constructor(@InjectWorkspaceRepository() private repository) {}
    }
    // Error: Class name should end with 'WorkspaceService'.
    // Error: File name should end with '.workspace-service.ts'.
    ```

4. **Incorrect File Type**:
    ```typescript
    // Filename: another.service.ts
    class AnotherService {
      constructor(private myWorkspaceService: MyWorkspaceService) {}
    }
    // Error: Class name should end with 'WorkspaceService'.
    // Error: File name should end with '.workspace-service.ts'.

    ```

5. **Incorrect Class Name with Dependency**:
    ```typescript
    // Filename: another.workspace-service.ts
    class AnotherService {
      constructor(private myWorkspaceService: MyWorkspaceService) {}
    }
    // Error: Class name should end with 'WorkspaceService'.
    ```

### First step

This rule is only a warning for now, and then we'll migrate all the code
that need to be migrated and move from `warn` to `error`.

Fix #6309

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-07-19 19:17:57 +02:00
Charles Bochet
41211dc1a6 Fix linter and yarn.lock not being synced 2024-07-19 18:57:38 +02:00
Lucas Bordeau
187b6f9335
Fix record show page request errors (#6345)
- Removed getCursorFromRecordId
- Get cursor from request
- Fixed problem with navigation and optimistic rendering
2024-07-19 18:43:46 +02:00
Faisal-imtiyaz123
12c33159e0
Fixes Default View Ordering (#6114) (#6326)
fixes #6114

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-07-19 18:27:33 +02:00
Jérémy M
088d061b3e
feat: twenty orm for standard and custom objects (#6178)
### Overview

This PR builds upon #5153, adding the ability to get a repository for
custom objects. The `entitySchema` is now generated for both standard
and custom objects based on metadata stored in the database instead of
the decorated `WorkspaceEntity` in the code. This change ensures that
standard objects with custom fields and relations can also support
custom objects.

### Implementation Details

#### Key Changes:

- **Dynamic Schema Generation:** The `entitySchema` for standard and
custom objects is now dynamically generated from the metadata stored in
the database. This shift allows for greater flexibility and
adaptability, particularly for standard objects with custom fields and
relations.
  
- **Custom Object Repository Retrieval:** A repository for a custom
object can be retrieved using `TwentyORMManager` based on the object's
name. Here's an example of how this can be achieved:

  ```typescript
const repository = await this.twentyORMManager.getRepository('custom');
  /*
* `repository` variable will be typed as follows, ensuring that standard
fields and relations are properly typed:
   * const repository: WorkspaceRepository<CustomWorkspaceEntity & {
   *    [key: string]: any;
   * }>
   */
  const res = await repository.find({});
  ```

Fix #6179

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: Weiko <corentin@twenty.com>
2024-07-19 18:23:52 +02:00
Antar Das
a86cc5cb9c
fix: icon visibility on horizontal scroll #6304 (#6315)
https://github.com/user-attachments/assets/5f8741ad-bdab-4ef3-8741-dacbd2381ea3

fix: When scrolling horizontally, table header goes behind the first
frozen column #6304
2024-07-19 18:00:31 +02:00
Weiko
a374922902
Cannot delete label identifier associated field (#6340)
## Context
An object should always have a labelIdentifier (would be its primary key
at least). If the associated field is deleted by a user, it will break
the app. Ideally we should handle that on the DB level but we don't have
a FK for this column yet.
In the meantime I'm adding the validation check in the backend, note
that this is already handle on the FE side since the "archive/delete"
buttons don't appear for such fields so you need to reassign it to
another field first which is the desired behaviour.
2024-07-19 15:57:40 +02:00
Jérémy M
cfb36ec0fb
feat: bump yarn to last stable version (#6081)
This PR bump yarn version to latest stable version
2024-07-19 15:38:03 +02:00
Lucas Bordeau
b38006455d
Fixed sort for Currency type (#6333)
Fixes : #6056 

- Refactored the logic to get order by query variables for field types
- Added a case for Currency field type
2024-07-19 15:27:28 +02:00
Charles Bochet
d488b7f80f Linter fix post merge conflicts 2024-07-19 15:20:25 +02:00
Sandab Gharti GC
7e80cd5366
mod: entrypoint for docker to setup db even in server with less memory (#5815)
Hello team,

- Modified File: `packages/twenty-docker/twenty/entrypoint.sh`
- Reason: The current `entrypoint.sh` works fine for server with RAM
more than 8GB. But the server with less RAM will give error while
running `scripts/setup-db.ts`.

![setup-db-failed](https://github.com/twentyhq/twenty/assets/52379037/5e27240a-23ef-4d52-93bb-337e1a004feb)

- My commit: It will set `NODE_OPTIONS="--max-old-space-size=8192"` in
docker entrypoint which guarantee to run the script successfully.

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-07-19 14:54:00 +02:00
RobertoSimonini1
7b615cf97e
truncate the string if overlow the text (#6166)
This PR aims to fix #6102 

I think we should dicuss a bit about how we should manage the lenght and
set the variables globally

Edit : 

@RobertoSimonini1 I used this PR to fix various problems that were left
unsolved :
- Refactor TextDisplay component, EllipsisDisplay was redundant with
OverflowingTextWithTooltip
- Removed maxWidth on TextDisplay for all other components, as it wasn't
the right way to do it, the parent container should be responsible for
width not the TextDisplay (code smell)
- Drilled-down isCentered to respect its intent in the RecordInlineCell
display of the record show page title
- Fixed RecordInlineCellEditMode so that the portal is well centered
above the record show page title
- Fixed DoubleTextInput width so that it expands normally and takes all
its parent available space.

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-07-19 14:25:57 +02:00
Lucas Bordeau
1b0759ef2f
Fix post merge revamp navigation bar (#6297)
Closes #6285 

@charlesBochet Also added some more utils for our component state v2.
2024-07-19 14:24:47 +02:00
Weiko
67e2d5c73a
Add label identifier to object decorator (#6227)
## Context
LabelIdentifier and ImageIdentifier are metadata info attached to
objectMetadata that are used to display a record in a more readable way.
Those columns point to existing fields that are part of the object.
For example, for a relation picker of a person, we will show a record
using the "name" labelIdentifier and the "avatarUrl" imageIdentifier.
<img width="215" alt="Screenshot 2024-07-11 at 18 45 51"
src="https://github.com/twentyhq/twenty/assets/1834158/488f8294-0d7c-4209-b763-2499716ef29d">

Currently, the FE has a specific logic for company and people objects
and we have a way to update this value via the API for custom objects,
but the code is not flexible enough to change other standard objects.

This PR updates the WorkspaceEntity API so we can now provide the
labelIdentifier and imageIdentifier in the WorkspaceEntity decorator.

Example:
```typescript
@WorkspaceEntity({
  standardId: STANDARD_OBJECT_IDS.activity,
  namePlural: 'activities',
  labelSingular: 'Activity',
  labelPlural: 'Activities',
  description: 'An activity',
  icon: 'IconCheckbox',
  labelIdentifierStandardId: ACTIVITY_STANDARD_FIELD_IDS.title,
})
@WorkspaceIsSystem()
export class ActivityWorkspaceEntity extends BaseWorkspaceEntity {
  @WorkspaceField({
    standardId: ACTIVITY_STANDARD_FIELD_IDS.title,
    type: FieldMetadataType.TEXT,
    label: 'Title',
    description: 'Activity title',
    icon: 'IconNotes',
  })
  title: string;
...
```
2024-07-19 14:24:04 +02:00
Sanidhya Singh
8a1af3a2ff
Fix: Number of records design on kanban (#6313)
Fixes #6306 

On hover, the VerticalDots icons will appear but the number of records
won't disappear.
2024-07-18 18:45:05 +02:00
Weiko
65e8503da8
Fix Metadata GQL server hook (#6323)
## Context
We've created a yoga (gql server) hook that catches requests and cache
them when needed. In practice we use it on the "objects" query because
this is often queried on the FE and it should never return something
different unless the schema has been intentionally changed by the user
when editing their data model (updating objects, fields, etc).

The issue here is we always cache the response regardless of its result,
even when it fails. This PR fixes that behaviour by only caching the
query response if it is successful.

I'm also fixing the cache key because the signature let users put
multiple operations and the cache key was not taking this into account
(we always use it on only one operation but we might have issues in the
future because another operation response could have erased the cached
response of another). Now the cache key contains the name of the
operation as well.

## Test
tested locally by manually throwing an error in the JWT auth guard
2024-07-18 16:51:50 +02:00
Marie
a4e82d643a
Support custom composite field deletion (#6320)
as per title
Fixes #6033 and closes #4841
2024-07-18 15:28:32 +02:00
Charles Bochet
37720eab13 Add typescript to prod dependency as required by serverless-function module 2024-07-18 09:39:54 +02:00
Charles Bochet
62e9492e8b Fix email and calendar settings not displayed when only one channel is present 2024-07-18 09:23:14 +02:00
Weiko
efd932e99b
Add rating filter/sort + fix isEmpty/isNotEmpty + fix combinedViewFilters (#6310)
## Context
- Adding RATING sort and filter capabilities.
- Fixing isEmpty/isNotEmpty filters
- Fixing combined view filters so it combines filters per field metadata
and not per filter id. This is more a product question but to me it does
not make sense to apply multiples filters on the same field IF the
operations is wrapped in a AND. If at some point we want to put a OR
instead then that would make more sense
2024-07-17 17:54:37 +02:00
martmull
47ddc7be83
6181 workflows create a custom code executor (#6235)
Closes #6181

## Testing
- download Altair graphql dev tool https://altairgraphql.dev/#download
- create a file locally `test.ts` containing:
```
export const handler = async (event: object, context: object) => {
  return { test: 'toto', data: event['data'] };
}
```
- play those requests in Altair:
mutation UpsertFunction($file: Upload!) {
  upsertFunction(name: "toto", file: $file)
}

mutation ExecFunction {
  executeFunction(name:"toto", payload: {data: "titi"})
}
- it will run the local driver, add those env variable to test with
lambda driver
```
CUSTOM_CODE_ENGINE_DRIVER_TYPE=lambda
LAMBDA_REGION=eu-west-2
LAMBDA_ROLE=<ASK_ME>
```
2024-07-17 17:53:01 +02:00