Commit Graph

3545 Commits

Author SHA1 Message Date
Félix Malfait
5f88caf409
Refacto default value (#6507)
A quick followup of #6506 to add clarity and differentiate emptyValue
from defaultValue
2024-08-03 16:43:53 +02:00
Jérémy M
6432ad39b9
feat: add new ACTOR field type and createdBy standard fields (#6324)
This pull request introduces a new `FieldMetadataType` called `ACTOR`.
The primary objective of this new type is to add an extra column to the
following objects: `person`, `company`, `opportunity`, `note`, `task`,
and all custom objects.

This composite type contains three properties:

- `source`
    ```typescript
    export enum FieldActorSource {
      EMAIL = 'EMAIL',
      CALENDAR = 'CALENDAR',
      API = 'API',
      IMPORT = 'IMPORT',
      MANUAL = 'MANUAL',
    }
    ```
- `workspaceMemberId`
- This property can be `undefined` in some cases and refers to the
member who created the record.
- `name`
- Serves as a fallback if the `workspaceMember` is deleted and is used
for other source types like `API`.

### Functionality

The pre-hook system has been updated to allow real-time argument
updates. When a record is created, a pre-hook can now compute and update
the arguments accordingly. This enhancement enables the `createdBy`
field to be populated with the correct values based on the
`authContext`.

The `authContext` now includes:
- An optional User entity
- An optional ApiKey entity
- The workspace entity

This provides access to the necessary data for the `createdBy` field.

In the GraphQL API, only the `source` can be specified in the
`createdBy` input. This allows the front-end to specify the source when
creating records from a CSV file.

### Front-End Handling

On the front-end, `orderBy` and `filter` are only applied to the name
property of the `ACTOR` composite type. Currently, we are unable to
apply these operations to the workspace member relation. This means that
if a workspace member changes their first name or last name, there may
be a mismatch because the name will differ from the new one. The name
displayed on the screen is based on the workspace member entity when
available.

### Missing Components

Currently, this PR does not include a `createdBy` value for the `MAIL`
and `CALENDAR` sources. These records are created in a job, and at
present, we only have access to the workspaceId within the job. To
address this, we should use a function similar to
`loadServiceWithContext`, which was recently removed from `TwentyORM`.
This function would allow us to pass the `authContext` to the jobs
without disrupting existing jobs.
Another PR will be created to handle these cases.

### Related Issues

Fixes issue #5155.

### Additional Notes

This PR doesn't include the migrations of the current records and views.
Everything works properly when the database is reset but this part is
still missing for now. We'll add that in another PR.

- There is a minor issue: front-end tests are broken since this commit:
[80c0fc7ff1).

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2024-08-03 15:43:31 +02:00
Weiko
9cf08d912a
Fix migration search path (#6520) 2024-08-02 21:34:20 +02:00
Aditya Pimpalkar
1f5c25ac0a
fix: navigate with arrow keys in select/multi-select (#5983)
closes: #4977



https://github.com/twentyhq/twenty/assets/13139771/8121814c-9a8a-4a8d-9290-1aebe145220f

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-08-02 20:12:46 +02:00
Weiko
c5d95dc4c8
Add logs to migration runner (#6518) 2024-08-02 19:13:39 +02:00
Thomas Trompette
277c51d58e
Add note and task target relation creation for customs (#6515)
As title

Urgent bug to fix, I will take the time to refacto this code next week

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-08-02 18:04:32 +02:00
Marie
268a0b09e0
Revert "Add skip option at sign-up (#6495)" (#6516)
This reverts commit eba6806594.
2024-08-02 16:27:08 +02:00
Marie
eba6806594
Add skip option at sign-up (#6495)
Closes #5925.

<img width="440" alt="Capture d’écran 2024-08-01 à 15 35 08"
src="https://github.com/user-attachments/assets/9a190b38-8e6a-46e6-8bf8-80a60cd52016">
2024-08-02 15:20:41 +02:00
Weiko
5870979bfa
Fix missing encoding in workspace-logo, members, person (#6510) 2024-08-02 15:18:48 +02:00
Thomas Trompette
0c036efcc4
Remove duplicated index from view picker (#6514)
<img width="815" alt="Capture d’écran 2024-08-02 à 15 15 51"
src="https://github.com/user-attachments/assets/0b192091-39f9-46c4-80b8-3c1a97f00480">
2024-08-02 15:18:29 +02:00
Thomas Trompette
950882d9fa
Fix title padding and style on task and attachment (#6509)
Fix https://github.com/twentyhq/twenty/issues/5923

<img width="593" alt="Capture d’écran 2024-08-02 à 12 09 24"
src="https://github.com/user-attachments/assets/a1c84060-9b32-4780-beb7-f44b85e49d07">
<img width="593" alt="Capture d’écran 2024-08-02 à 12 09 29"
src="https://github.com/user-attachments/assets/641cab31-723c-4253-9c3c-00fef70f2d06">
<img width="593" alt="Capture d’écran 2024-08-02 à 12 09 33"
src="https://github.com/user-attachments/assets/ba2adcb6-7651-4288-91f3-304d13c3e7bd">
2024-08-02 15:01:54 +02:00
Thomas Trompette
931a19260f
Fix label fonts in timeline events (#6511)
As title
2024-08-02 14:53:59 +02:00
Marie
489e8def9c
Fix icons not showing in sign-in background (#6513) 2024-08-02 14:34:33 +02:00
Prateek Jain
281bf689fa
Make api name editable and add expiry (#6473)
Fixes #6302

---------

Co-authored-by: martmull <martmull@hotmail.fr>
2024-08-02 13:31:06 +02:00
Lucas Bordeau
68120d529c
Add sort feature for Links type (#6503)
Closes https://github.com/twentyhq/twenty/issues/5741

Filtering was already working.

I just added the required logic in the frontend to allow sorting by
primary link url (because label can be empty)
2024-08-02 11:10:54 +02:00
Lucas Bordeau
f0ca3439a8
Fixed sort bug when two select values were null (#6493)
Fixes https://github.com/twentyhq/twenty/issues/5762

The problem was only happening with a sort on a select type field, also
appears with currency type and maybe other types.

This was because NULL values were sorted in a random order because the
sort function was comparing two NULL values as not equal, so I just
added a case for when A === B === NULL.
2024-08-02 10:48:36 +02:00
Félix Malfait
0dcdda3928
Add updated at column (#6506)
Introduced `updatedAt` column. and fix an existing bug where the field
edition page was crashing because we were trying to compute Date('now')
(param coming from the default value)
2024-08-02 10:03:36 +02:00
Weiko
676c902731
Fix timelineActivity updated fields (#6494)
## Context
We recently introduced the new twenty ORM and used it in the update
methods in the query runner.
Initially we were using pg_graphql to fetch the record before updating
it allowing us to compare the before and the after and create a diff.
This diff is then used for the timeline activity creation. Now,
twentyORM is doing the fetch and pg_graphql is still doing the update
and their responses are not exactly the same, which means the diff is
not working as intended (e.g date types were always in the diff due to
one being in Date format and the other as a string)

This PR introduces a updatedFields property to the update event which
comes from the input. This is not ideal as this won't work for API users
that send the whole payload but will be sufficient enough for our FE
that only sends modified fields. We then compare only those fields in
the diff.
2024-08-01 18:41:28 +02:00
rostaklein
a424c63476
file storage workspace id prefix (#6230)
closes https://github.com/twentyhq/twenty/issues/6155

just an idea, i guess this could work well, but im open for discussion

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-08-01 18:07:22 +02:00
Charles Bochet
5c92ab937e
Leverage workspace activationStatus to decide if a workspace is activated or not (#6497)
An ACTIVE workspace is a workspace that has a complete workspaceSchema
and is authorized to be browsed by users.

In this PR, I'm:
- introducing a new activationStatus: PENDING_CREATION (existing ACTIVE
/ INACTIVE)
- removing workspaceService.isWorkspaceActivated (based on
workspaceSchema existence which is not robust and checking
activationStatus.ACTIVE instead)
- removing dynamic activationStatus field on worksapce resolver (we can
use the postgres column directly now that data has been migrated)
- on user sign up creating the workspace in PENDING_CREATION, and on
workspace activation setting it to ACTIVE
- only re-activating a workspace if the current activationStatus is
INACTIVE through billing webhooks (a PENDING_CREATION should stay
PENDING and ACTIVE should stay ACTIVE)
2024-08-01 17:05:15 +02:00
Marie
1a90df8961
Create a new entry directly from a many picker (#6478)
Closes #6091
2024-08-01 15:08:07 +02:00
Thomas Trompette
8c8f192765
Trigger workflow on database event (#6480)
- Add global listener on database event
- Fetch event listener associated
- Trigger associated workflow

Also updated the runner so it expects the input to be in the payload
rather than the trigger
2024-08-01 11:57:44 +02:00
martmull
ae423f5e75
Improve typing definition (#6481)
- added typing for workflow-runner results
- fix workflow typing
- add a `workflow-action-runner` submodule that contains factories for
action runners
- added code-action-runner
- simplified code
2024-08-01 11:38:31 +02:00
SIDDAM VINAY
0f69106558
Fix row background not changing to blue on selection (#6479)
[Screencast from 2024-07-31
21-57-49.webm](https://github.com/user-attachments/assets/d2d80b10-def9-4d0e-8bcc-53555742db19)
@Bonapara Please review
Closes #6461 - fixed , on selection the background is now changing to
blue
2024-08-01 11:29:06 +02:00
Félix Malfait
3a1576bc22
Fix 2 small bugs following tasks migration (#6483)
This PR fixes two bugs:
- A broken link to the task page that had been left on the mobile
version
- On Kanban cards, the badge for notes/tasks wasn't properly displayed
because the title wasn't loaded from the backend
2024-08-01 11:28:09 +02:00
nitin
8c7ae9e07f
Adjusted empty tag style (#6465)
Fixed Issue #6307  

corrected 
- border style
- font color
- font weight

added
- Empty Tag story
2024-08-01 10:29:05 +02:00
gitstart-app[bot]
d9dcd63a1c
Expose duplicate check on REST API and enable batch duplicate checks (#6328)
This PR was created by [GitStart](https://gitstart.com/) to address the
requirements from this ticket:
[TWNTY-5472](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-5472).
This ticket was imported from:
[TWNTY-5472](https://github.com/twentyhq/twenty/issues/5472)

 --- 

### Description:
- Following what is already done in the code, we create a REST endpoint
that generates the Graphql query and returns its result.

### Refs: #5472


### Demo:

<https://www.loom.com/share/e0b1030f056945a0bf93bdd88ea01d8f?sid=6f128e8c-370b-4079-958e-0ea2d073a241>

FIxes #5472

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: gitstart-twenty <140154534+gitstart-twenty@users.noreply.github.com>
Co-authored-by: martmull <martmull@hotmail.fr>
2024-08-01 10:08:22 +02:00
pereira0x
c3417ddba1
Share an email thread to workspace members chip and dropdown (#4199) (#5640)
# Feature: Email thread members visibility

For this feature we implemented a chip and a dropdown menu that allows
users to check which workspace members can see an email thread, as
depicted on issue (#4199).

## Implementations

- create a new database table (messageThreadMember)
- relations between `messageThreadMembers` and the relevant existing
tables (`MessageThread` and `WorkspaceMembers`)
- added a new column to the `MessageThread table`: `everyone` - to
indicate that all workspace members can see the email thread
- create a new repository for the new table, including new queries
- edit the queries so that the new fields could be fetched from the
frontend
- created a component `MultiChip`, that shows a group of user avatars,
instead of just one
- created a component, `ShareDropdownMenu`, that shows up once the
`EmailThreadMembersChip` is clicked. On this menu you can see which
workspace members can view the email thread.

## Screenshots

Here are some screenshots of the frontend components that were created:

Chip with everyone in the workspace being part of the message thread:

![image](https://github.com/twentyhq/twenty/assets/26422084/80d75cdc-656f-490d-9eb1-a07346aad75c)

Chip with just one member of the workspace (the owner) being part of the
message thread:

![image](https://github.com/twentyhq/twenty/assets/26422084/c26677c6-ab93-4149-8201-b110d7346a28)

Chip with some members of the workspace being part of the message
thread:

![image](https://github.com/twentyhq/twenty/assets/26422084/9eccf5f8-134c-4c62-9145-5d5aa2346071)

How the chip looks in a message thread:

![image](https://github.com/twentyhq/twenty/assets/26422084/a9de981d-7288-4aed-8616-c1cb7de524e2)

Dropdown that opens when you click on the chip:

![image](https://github.com/twentyhq/twenty/assets/26422084/a1bb9cd4-01bb-45c5-bf8b-b31c2f3d85e0)

## Testing and Mock data

We also added mock data (TypeORM seeds), focusing on adding mock data
related to message thread members.

## Conclusion

As some of the changes that we needed to do, regarding the change of
visibility of the message thread, were not covered by the existing
documentation, we were told to open a PR and ask for feedback on this
part of the implementation. Right now, our implementation is focused on
displaying who is part of an email thread.

Feel free to let us know which steps we should follow next :)

---------

Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-07-31 18:50:27 +02:00
Charles Bochet
ae7821ce70
Fast follows on new task/note behaviors (#6477)
In this PR, I'm fixing two issues that we have faced:
- computing a rich text first line in case of the first block content is
not a text
- migrating existing timelineActivities tied to tasks / notes to
linked-tasks / linked-notes during migration command
2024-07-31 17:49:56 +02:00
Félix Malfait
ff74623dbb
Add opportunities to search and fix a small bug (#6476) 2024-07-31 16:50:16 +02:00
Félix Malfait
80c0fc7ff1
Activity as standard object (#6219)
In this PR I layout the first steps to migrate Activity to a traditional
Standard objects

Since this is a big transition, I'd rather split it into several
deployments / PRs

<img width="1512" alt="image"
src="https://github.com/user-attachments/assets/012e2bbf-9d1b-4723-aaf6-269ef588b050">

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: bosiraphael <71827178+bosiraphael@users.noreply.github.com>
Co-authored-by: Weiko <corentin@twenty.com>
Co-authored-by: Faisal-imtiyaz123 <142205282+Faisal-imtiyaz123@users.noreply.github.com>
Co-authored-by: Prateek Jain <prateekj1171998@gmail.com>
2024-07-31 15:36:11 +02:00
Thomas des Francs
defcee2a02
0.23 changelog (#6472) 2024-07-31 15:04:41 +02:00
Marie
64763fb70c
Revert update of workspaceMember standard id (#6475) 2024-07-31 15:04:26 +02:00
martmull
424225943c
Add missing break (#6474) 2024-07-31 14:01:18 +02:00
martmull
6b4c79ff0d
Add workflow runner (#6458)
- add workflow runner module
- add an endpoint to trigger a workflow via api
- improve error handling for serverless functions

## Testing
- create 2 serverless functions
- create a workflow
- create this workflow Version
```
{
  "type": "MANUAL",
  "input": {"b": "bb"},
  "nextAction": {
    "name": "step_1",
    "displayName": "Code",
    "type": "CODE",
    "valid": true,
    "settings": {
      "serverlessFunctionId": "Serverless function 1 Id",
      "errorHandlingOptions": {
        "retryOnFailure": {
          "value": false
        },
        "continueOnFailure": {
          "value": false
        }
      }
    },
    "nextAction": {
      "name": "step_1",
      "displayName": "Code",
      "type": "CODE",
      "valid": true,
      "settings": {
        "serverlessFunctionId": "Serverless function 1 Id",
        "errorHandlingOptions": {
          "retryOnFailure": {
            "value": false
          },
          "continueOnFailure": {
            "value": false
          }
        }
      },
      "nextAction": {
        "name": "step_1",
        "displayName": "Code",
        "type": "CODE",
        "valid": true,
        "settings": {
          "serverlessFunctionId": "Serverless function 2 Id",
          "errorHandlingOptions": {
            "retryOnFailure": {
              "value": false
            },
            "continueOnFailure": {
              "value": false
            }
          }
        }
      }
    }
  }
}

`
``
- call 
```
mutation Trigger {
  triggerWorkflow(workflowVersionId: "WORKFLOW_VERSION_ID") {
    result
  }
}
```
- try when errors are injected in serverless function
2024-07-31 12:48:33 +02:00
Marie
b8496d22b6
Do not add 'https' prefix while migrating domainName if source url is empty (#6471) 2024-07-31 12:03:49 +02:00
Lucas Bordeau
db2cb2bc2d
Fixed format date unit test (#6469)
With the introduction of the new function formatToHumanReadableTime, we
had to modify a unit test that wasn't using a UTC date as input data.
2024-07-31 11:50:55 +02:00
Marie
7fe00b163e
Add logs and fix timestamps in migrate domain command (#6468) 2024-07-31 11:23:19 +02:00
AbdulQader Qassab
50f1cd352d
Add description for Developers/webhook page (#6327)
- Add optional description field to webhook page in developer settings.

Fix https://github.com/twentyhq/twenty/issues/6236

---------

Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
2024-07-31 10:59:30 +02:00
Prateek Jain
ee4f1da956
Fix total count in show page (#6462)
Fixes #6405 

We need to take into account both the totalCount of **before cursor**
results and **after cursor** results.
2024-07-30 19:16:36 +02:00
Faisal-imtiyaz123
70f9df7dc4
Fixes Remove Compact View From Kanban View Sub Options Menu's ( #6116 ) (#6453)
fixes  #6116
2024-07-30 18:39:04 +02:00
Weiko
3fa758e59a
Fix background mock (#6463)
## Before

<img width="1284" alt="Screenshot 2024-07-30 at 18 24 04"
src="https://github.com/user-attachments/assets/3c8d2ee9-daa0-4b32-ac90-7124252bc79c">

## After
<img width="1317" alt="Screenshot 2024-07-30 at 18 23 57"
src="https://github.com/user-attachments/assets/5dd36510-cf42-4698-a395-8435e6552810">
2024-07-30 18:33:05 +02:00
bosiraphael
77152a10b1
Fix company creation duplicate on email sync after introducing links type (#6460)
- Introduce `extractDomainFromLink`
- Use is inside `create-company.service`
2024-07-30 18:10:36 +02:00
Weiko
b85ae7e1ac
Fix googleApisSetRequestExtraParams (#6455) 2024-07-30 16:08:59 +02:00
Thomas Trompette
68e3730be1
Fix base graphql error message (#6457)
Display error message instead of name

<img width="762" alt="Capture d’écran 2024-07-30 à 15 51 07"
src="https://github.com/user-attachments/assets/a6b49254-a99e-42fc-8704-089f38bf8e7b">
2024-07-30 15:55:57 +02:00
Marie
3a37dfc7d5
Fix domainName seeds (#6454) 2024-07-30 15:14:36 +02:00
Lucas Bordeau
ccf4d1eeec
Date formatting per workspace member settings (#6408)
Implement date formatting per workspace member settings

We'll need another round to maybe initialize all workspaces on the
default settings.

For now the default behavior is to take system settings if nothing is
found in DB.

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-07-30 14:52:10 +02:00
Charles Bochet
45ebb0b824 Seed workspaces as active 2024-07-30 14:49:14 +02:00
Thomas Trompette
e3496a19b5
Move folder (#6451)
Fix folder mistake
2024-07-30 14:16:23 +02:00
Thomas Trompette
ee14f25996
Add enable workflow trigger endpoint (#6443)
Basic endpoint that only returns a boolean currently and overrides the
previous listener.
2024-07-30 14:00:37 +02:00