Commit Graph

4838 Commits

Author SHA1 Message Date
6e0002b874 Add NX commands to twenty-e2e-testing package (#9222)
Related to #8469
2024-12-31 15:49:52 +01:00
2c7f40ab1d Fix NavigationDrawer story (#9235)
Closes https://github.com/twentyhq/twenty/issues/7492

## Description
This PR will fix NavigationDrawer story.

## Testing
<img width="1407" alt="スクリーンショット 2024-12-25 23 27 25"
src="https://github.com/user-attachments/assets/d9ee4363-f2b2-408f-b2b8-c4dd92cfd66b"
/>
<img width="1326" alt="スクリーンショット 2024-12-26 0 28 47"
src="https://github.com/user-attachments/assets/b21fbe02-9d56-4b9b-8631-ee4530e5a5d1"
/>

---------

Co-authored-by: Takuya Kurimoto <takuya004869@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-12-31 14:00:45 +00:00
97f5a5b8a5 Pass Billing Checkout var in url to bypass credit card (#9283) 2024-12-31 14:48:00 +01:00
45f14c8020 Refactored table unnamed cells behaviour (#9264)
Closes: #7851 

[Screencast from 2024-12-28
00-53-55.webm](https://github.com/user-attachments/assets/17b05ebf-d375-4e19-a4e8-699bce876f5d)

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-12-31 14:32:32 +01:00
09cdfaa254 Add cursor rules (#9268)
Add rules for AI code editor
2024-12-31 14:13:23 +01:00
2b82347fdc Refactor File Download Logic and Streamline Test Suite (#9281)
Closes #9277 

## Summary of Changes
- Updated the file-download functionality to use the `saveAs` method
from the `file-saver` library, ensuring a more reliable and consistent
implementation.
- Removed redundant tests to streamline the test suite and reduce
maintenance overhead.

## Testing Performed
- [x] Verified that exporting the view to a CSV file works as expected.
2024-12-31 14:08:22 +01:00
cdc2dfe709 Fix text color issue in CustomSlashMenu for dark mode (#9280)
fixes #9265 

#### Summary
The menu options appear in black color in dark mode, making text hard to
read because there is very little contrast between text and background.

#### Solution
Added `color: ${({ theme }) => theme.font.color.secondary};` to the
dropdown menu container, so the menu options inherit the correct text
color from their containers.

### Screenshots
![CleanShot 2024-12-30 at 09 37
26](https://github.com/user-attachments/assets/a709b785-75a4-408d-9517-d3cab2c1fee6)
2024-12-31 14:05:35 +01:00
03370b4a1b Change Apollo cache policy (#9296)
Set the default cache policy to 'cache-and-network' to make sure user
get more fresh data without refreshing the browser. Better for workspace
with several users working at the same time.

It will put more load on the server...

Note: I don't think the previous setting was taken into account
<img width="829" alt="Screenshot 2024-12-31 at 10 59 56"
src="https://github.com/user-attachments/assets/30ea74be-0907-422f-8e84-6c352d379337"
/>
2024-12-31 12:12:07 +01:00
2277952403 forget defaultworkspace update (#9292)
fix #9229

see issue for more info
2024-12-31 10:54:05 +01:00
5bd685ef2a Fix Navigation drawer design for object path (#9290)
Navigation drawer design is broken for object path, we always see
elipsis. Comes from the fact we only use padding 2px on right while
using 4px on the left.
<img width="242" alt="Capture d’écran 2024-12-31 à 08 27 11"
src="https://github.com/user-attachments/assets/bbc673f3-9c61-4df9-999e-d4a2d93276a9"
/>

Using 2px padding only makes sense when there is a right element, to
match figma.
<img width="242" alt="Capture d’écran 2024-12-31 à 08 29 07"
src="https://github.com/user-attachments/assets/db5fe19c-5074-4f5c-a1b5-af183c0eb745"
/>

Adding a condition to using 4px padding if no right element.
<img width="224" alt="Capture d’écran 2024-12-31 à 08 22 53"
src="https://github.com/user-attachments/assets/9909fd10-75a6-43ee-ae3d-c7124e5421b9"
/>

Co-authored-by: ehconitin <nitinkoche03@gmail.com>
2024-12-31 09:24:06 +01:00
c3c07e08c8 Fix use as draft redirection (#9284)
When hitting use as draft in workflow version action, redirects to
workflow newly created
2024-12-30 18:17:02 +01:00
7388f2bcff Fix command menu action click (#9285)
- Fix typing
- Fix onClick
2024-12-30 17:10:58 +00:00
e1c99beaa4 Fix shrinked horizontal separator (#9192)
Related issue:
https://discord.com/channels/1130383047699738754/1317185369577492532/1317185369577492532.

TL;DR: When used in a flex container, the separators gets hidden when
the container becomes scrollable. We must ensure they can't shrink.

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-12-30 17:03:21 +00:00
e153168edb Fix go to draft link (#9282)
Redirect to workflow instead of version
2024-12-30 16:03:49 +00:00
1091bc657d Command menu refactoring (#9257)
Refactored the `CommandMenu` component to make it more readable and
easier to refactor.
The file was way too big so I introduced a few hooks and eliminated code
duplication.

Introduced:
- `useMatchCommands` hook to match commands with the search
- `useCommandMenuCommands` which returns all command menu commands
- `useMatchingCommandMenuCommands` to return the commands matched with
the search
- `CommandMenuContainer` to simplify the `DefaultLayout`

- Unmounted the `CommandMenu` when it wasn't opened to improve
performances

I also introduced a new behavior: Automatically select the first item
when opening the command menu:

https://github.com/user-attachments/assets/4b683d49-570e-47c9-8939-99f42ed8691c
2024-12-30 15:22:49 +01:00
0fa59d7718 Refactor SnackBar API (#9276)
Resolves #9259

## Changes
- Simplified API by removing `title` prop in favor of required `message`
prop
- Added `detailedMessage` prop for supporting additional context
- Updated styling for improved message display
- Renamed `defaultTitleByVariant` to `defaultAriaLabelByVariant` for
clarity
- Adjusted header alignment and icon styling

## Testing
- [x] Verified all SnackBar variants display correctly
- [x] Tested with and without detailed messages
- [x] Checked responsive behavior

## Screenshots

![SnackBar1](https://github.com/user-attachments/assets/fd0e222e-54c1-4cd7-b685-6d18efd6a681)

![SnackBar2](https://github.com/user-attachments/assets/bd1598b4-0f99-44c0-9ba1-6801b2959e3b)

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-12-30 11:19:04 +00:00
578ba97dad Clicking a phone number should copy its value (#9069)
https://github.com/user-attachments/assets/7ce595fa-be90-4ec7-81e5-075dafee6422

I have added the functionality of copying the phone number to clipboard
according to the issue #8905 . If anything needed to change just comment
in my PR

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-12-30 10:11:03 +00:00
c52a4924b9 Add throttling on workflow execution (#9263)
We want to avoid infinite loops using workflows. Adding a throttler with
a limit of 10 executions / sec by default for each workflow.

We were not emitting events on workflow actions so loops could not
happen. Since throttler is there we can now and these.

Adding an error message so the user knows when it happens.
<img width="1284" alt="Capture d’écran 2024-12-27 à 17 05 20"
src="https://github.com/user-attachments/assets/dafa837b-5b4c-48be-8207-c90f5c71a236"
/>
2024-12-30 10:52:33 +01:00
ba2f55a627 Export Notes to PDF/Word Feature Implementation (#8439) (#9269)
Closes #8439

## Overview
This PR implements functionality to export notes/tasks to PDF and Word
formats.


https://github.com/user-attachments/assets/67eaf4eb-cabc-45ba-8727-13f22ba31067

## Testing
- [x] Verified that the export functionality works for both notes and
tasks, whether exporting immediately after opening the editor or after
editing.
- [x] Ensured the export button appears in the action menu only when the
object is a note/task.
- [x] Ensured the export button appears in the
RightDrawerActionMenuDropdown for a note/task.

## Notes
- The code already supports exporting to Word, but only PDF export is
currently available. To enable Word export, we just need a UI option
allowing users to choose between PDF and Word.
- After upgrading the Blocknote packages to the latest version,
dependency conflicts arose with tiptap and prosemirror-model. To address
this, all tiptap dependencies were consolidated in the root
package.json, and a resolution was added for prosemirror-model. Also,
some methods in CustomAddBlockItem.tsx were missing in the newer
version, so I updated the code to accommodate these changes.
- Exporting a note with an image works only if the image is embedded, as
Blocknote doesn’t support actual image uploads. Uploaded images are
omitted in the PDF export, while the text is retained.

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
2024-12-30 09:16:44 +01:00
4e496a9025 Delete .github/ISSUE_TEMPLATE/oss-gg-hack-submission.yml (#9271) 2024-12-29 14:32:47 +01:00
74755c8bef docs: console.log invaluable typo (#9234)
Console.logs are valuable in development so changed `invaluable` to
`valuable`

---------

Co-authored-by: ehconitin <nitinkoche03@gmail.com>
Co-authored-by: Félix Malfait <felix@twenty.com>
2024-12-29 14:17:25 +01:00
df12ba6e98 Webhook Secret Field Implementation and Security Enhancements (#9187) (#9219)
Closes #9187

This pull request introduces a new feature and several enhancements for
managing webhook security by adding a secret field and enabling HMAC
signature-based authentication. Below is a detailed breakdown of the
changes made:

## Frontend Updates
### Secret Field on Webhook Edit Page
- Added a new **Secret** section on the webhook edit page.
  - Includes a text input field for entering a webhook secret.
- Added a descriptive note explaining the purpose of the secret for
webhook authentication.

### State Management and Persistence
- Integrated the secret field into the Webhook type definition and state
management.
- Connected the secret field UI to the data layer, ensuring seamless
persistence of the secret field.

### Validation Improvement
- Trims leading and trailing whitespace from webhook secret inputs to
avoid potential validation issues.

## Backend Updates
### Database and Entity Changes
- Introduced a nullable `secret` field to the `WebhookWorkspaceEntity`
for securely storing webhook signing secrets.
- Field uses a standard field ID:
`20202020-97ce-410f-bff9-e9ccb038fb67`.

### Signature Generation
- Implemented HMAC-SHA256 signature generation for webhook payloads when
a secret is present:
- Signatures are added as a custom `X-Twenty-Webhook-Signature` header.
  - Secret is excluded from the payload to maintain security.

### Enhanced Security Measures
- Added additional headers for enhanced security:
  - **Timestamp Header**: Prevents replay attacks.
  - **Nonce Header**: Mitigates duplicate requests.
- Updated the OpenAPI specification to include documentation on these
security-related headers and signature verification.

## Documentation Updates
- Updated OpenAPI documentation for webhook endpoints:
  - Described security-related headers (signature, timestamp, nonce).
- Included detailed instructions for verifying HMAC signatures to assist
consumers.

## Testing and Demonstration
- [Loom Video
Link](https://www.loom.com/share/bd827e4d045f46d99f3c8186e5e5676a?sid=a5e61904-0536-4e82-8055-3d05e4598393):
Demonstrating the functionality of the secret field and webhook security
features.
- [Script Example
Link](https://runkit.com/samyakpiya/676af044040c0400086d400a): A script
showing how consumers can verify webhook authenticity using the HMAC
signature.
- [Testing Site
Instance](https://webhook.site/#!/view/3472468b-ebcd-4b7f-a083-c4ba20825bb4/6885fdce-8843-4d3f-8fe0-1d8abdd53f68/1):
Contains the logged requests sent during testing and is available for
review.

## Steps for Review
1. Verify the secret field functionality on the webhook edit page,
including state persistence and UI updates.
2. Review the security enhancements, including header additions and HMAC
signature generation.
3. Validate OpenAPI documentation changes for completeness and clarity.

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
2024-12-28 11:47:14 +01:00
36bec4ed8b Fix: Make DropdownMenuSeparator background transparent based on theme (#9037)
This PR addresses issue #8993 by updating the `DropdownMenuSeparator` to
adjust its background color based on the current theme.

---------

Co-authored-by: guillim <guigloo@msn.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-12-27 18:32:04 +01:00
acc07f5bbd Fix csv import dropdown overlay (#9262)
## Context
Fixing https://github.com/twentyhq/twenty/issues/9245 using the new
OverlayContainer component instead of custom styled component

## Test
<img width="352" alt="Screenshot 2024-12-27 at 16 52 55"
src="https://github.com/user-attachments/assets/27ebcdd1-8fe4-425b-995b-bc4e7220192c"
/>
2024-12-27 17:07:37 +01:00
522b51581d Remove delete action from workflow versions and runs (#9261)
Updated the action configs for workflow versions and workflow runs.
2024-12-27 16:15:10 +01:00
d7cda0f1c1 fix(spreadsheet-import): add background and border styles to DropdownMenu inMatchColumnSelect (#9255)
Fixes #9245 - CSV import column selection dropdown was missing
background styles, making it difficult to read the options.

## Changes
- Add styled component for DropdownMenu with background color
- Include border and box shadow styles

## Screenshots
![Screenshot 2024-12-26 at 8 02
22 PM](https://github.com/user-attachments/assets/adb4c114-b819-4655-b628-9ad989593ffa)
![Screenshot 2024-12-26 at 8 03
58 PM](https://github.com/user-attachments/assets/76d7e3c1-9c51-48f2-85b3-1f81c61f9943)

## Testing

- [x] Verify column selection dropdown has proper background color
- [x] Confirm dropdown options are clearly visible
- [x] Check that dropdown appears above other elements correctly
2024-12-27 15:57:19 +01:00
a8bb3e6bdf Added all field types on pet custom object (#9248)
- Added all usable composite field types on pet custom object
- Fixed missing createdBy on people and company seeds
- DEFAULT_SUBDOMAIN is now used for login (could be improved for multi
workspace)
- Refactored ObjectMetadataStandardIdToIdMap to disambiguate from
ObjectMetadataMap
- Refactored seedCustomObjects
2024-12-27 15:01:09 +01:00
58c92e036b Add post hooks for workflow deletion (#9258)
Delete all workflow sub objects when workflow is deleted. Other sub
objects cannot be deleted otherwise.

We do not listen to deletion events so I am not adding them. Those post
hooks should be deleted Q1 once we properly handle cascade for soft
deletion
2024-12-27 13:40:19 +00:00
2bb71bb79a Fix glitch at aggregate operation update (#9253)
Before:

https://github.com/user-attachments/assets/6e76b19c-b99c-4870-9c93-b75e7cf86103

After:

https://github.com/user-attachments/assets/b5827d3e-5891-4204-bf91-6fa4504f30d3

Isolated the value change in a separate component to avoid re-renders of
the parent component that has the down chevron.
Also added a context at foot cell-level to centralize viewFieldId and
fieldMetadataId that were queried in children components calling heavy
hooks.
2024-12-27 14:36:24 +01:00
546a793aed fix: last field overflow (#8510)
Fixes: #7216 

The issue was caused by the ```min-width``` property of
```StyledEditableCellEditModeContainer```. So, I removed it.

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-12-27 12:30:35 +00:00
e1f8ac4a4c Allow multiple folder to be open at once (#9242) 2024-12-27 11:30:30 +01:00
8668fd2b94 Fix click outside on board (#9252)
Fixes #9246 
Exclude `page-action-container` from click outside listener
2024-12-27 10:04:32 +01:00
a653488b17 Fix filter by url (#9247)
Filters coming from url should be parsed properly when using the new
relation schema format
2024-12-27 09:02:12 +00:00
b91656eb5d Aggregate fast follows (1) (#9233)
Some fixes required: 

- [Aggregate value should not disappear when dropdown is
open](https://discord.com/channels/1130383047699738754/1319328950475817001/1319328950475817001)
- [Delay the apparition of the tooltip on
kanban](https://discord.com/channels/1130383047699738754/1319327824632352860/1319327824632352860)
- [Group options in
sub-menus](https://discord.com/channels/1130383047699738754/1319326443951362059/1319326443951362059)

![image](https://github.com/user-attachments/assets/b2b58cec-a042-4253-a185-01d273320960)
- Display the currently selected option with a checkmark

![image](https://github.com/user-attachments/assets/95270f9c-773e-4af7-aaf5-249469ae7d2d)
- [Loading -> Aggregates should appear at the same time that records,
not
before](https://discord.com/channels/1130383047699738754/1319329819749646456/1319329899630301318)
2024-12-26 16:00:56 +00:00
68d47e9543 Fix workflow activate last version (#9243)
Fix workflow activate last version being displayed when it shouldn't be.
2024-12-26 16:14:04 +01:00
a3788dc777 Scroll vertical-horizontal visibility seperation (#9221)
fixes #9208
2024-12-26 16:03:22 +01:00
fdfa0935a1 Fix see versions and runs hooks (#9244)
<img width="871" alt="Capture d’écran 2024-12-26 à 15 04 27"
src="https://github.com/user-attachments/assets/40a37230-59be-4d9b-ae43-cebbf94e1b47"
/>

Filters had been broken by this PR
86d74724fb (diff-eb3ca3591567c47e75165b8279bd2a51f8dd77810a643cba0d9c317d2f77107eR19)
2024-12-26 15:40:31 +01:00
522c6c2a8c Fix right drawer actions (#9241)
https://github.com/user-attachments/assets/107e6058-633f-4caa-967c-7017bef75d52
2024-12-26 14:16:36 +01:00
2da3d83a41 Fix creation of a new view duplicating existing filters (#9240)
Fixes #9239
2024-12-26 11:43:05 +01:00
f63b0a235a Make record name editable on show page (#9172)
When fields are not displayed in show page, title should be editable



https://github.com/user-attachments/assets/049c2998-6944-46c7-9e9e-f6d29da06c6c
2024-12-26 10:59:17 +01:00
29d364fa7b Floating inputs border radius fix (#9237)
closes #9230
2024-12-26 14:18:23 +05:30
1f789a8b95 search in settings phones (#9228)
tiny PR to add the search feature in the  phones settings dropdown

was a request from @Bonapara a month ago :)
2024-12-24 15:36:18 +00:00
cba38ab496 Fixed relations (#9227)
Follow-up : Fixed relations eager load on refactored hooks from PR
https://github.com/twentyhq/twenty/pull/8695
2024-12-24 15:59:25 +01:00
2dcfaeac73 Restore "Fix "Create profile" page not supporting dark mode (#8110)" & Fix string defaultValues during sync-metadata (#9220)
Restoring https://github.com/twentyhq/twenty/pull/9185
Also fixing sync-metadata with test values in jsonb

## Test
sync-metadata on existing workspaces should replace colorSchema in both
metadata and workspaceMember tables
2024-12-24 15:09:04 +01:00
e9717603f2 Refactored and improved seeds (#8695)
- Added a new Seeder service to help with custom object seeds
- Added RichTextFieldInput to edit a rich text field directly on the
table, but deactivated it for now.
2024-12-24 14:44:52 +01:00
4f329d6005 Ensure step is selected after creation when a new version has to be created (#9218)
Fixes
https://discord.com/channels/1130383047699738754/1318606664202715156/1318606664202715156
2024-12-24 14:43:10 +01:00
d2abd59a51 Make the workflow's visualizer layout more stable (#9203)
We no longer reset the state of Reactflow when the selected workflow
version changes. The viewport is not reset when discarding a draft
version but it looks better that way.


https://github.com/user-attachments/assets/0df9fa52-c44a-4aea-a504-4765542101fa

Fixes
https://discord.com/channels/1130383047699738754/1319626151768883300/1319626151768883300
2024-12-24 14:42:35 +01:00
53f0cd7205 refactor(workspace): clean up resolver and improve error handling (#9225)
Removed unused `LoginTokenService` imports and dependencies for better
code clarity. Enhanced error handling in
`getPublicWorkspaceDataBySubdomain` with a try-catch block, ensuring
consistent exception handling. This improves maintainability and
robustness of the resolver.
2024-12-24 14:41:20 +01:00
612f20e925 Add backup commands to documentation (#9224)
In documentation, there's mention to make a backup of database before
upgrading Twenty but there are no commands how to do it, so this PR
solves this problem by providing commands
2024-12-24 13:57:39 +01:00
cd2946b670 refacto(*): remove everything about default workspace (#9157)
## Summary
- [x] Remove defaultWorkspace in user
- [x] Remove all occurrence of defaultWorkspace and defaultWorkspaceId
- [x] Improve activate workspace flow
- [x] Improve security on social login
- [x] Add `ImpersonateGuard`
- [x] Allow to use impersonation with couple `User/Workspace`
- [x] Prevent unexpected reload on activate workspace
- [x] Scope login token with workspaceId 

Fix https://github.com/twentyhq/twenty/issues/9033#event-15714863042
2024-12-24 11:47:41 +00:00