Commit Graph

461 Commits

Author SHA1 Message Date
Charles Bochet
fafa56411c
Fix email sync (#5132) 2024-04-23 18:50:37 +02:00
Marie
ff39ba5a15
[fix] Support non latin characters in schema names (#5063)
Fixes #4943

## How was it tested?
Local (front + /metadata)
Unit tests for utils

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-04-23 13:37:29 +02:00
bosiraphael
824786ff04
4746 create created listener on blocklist for calendar (#5046)
Follows #5031.
Closes #4746
2024-04-23 11:46:27 +02:00
Dev
bd2a6cbbd3
Add company to default opportunity fields (#5075)
Fixes #4484 

<img width="1904" alt="Screenshot 2024-04-21 at 6 58 10 AM"
src="https://github.com/twentyhq/twenty/assets/21654351/dd1dcd3b-3bbe-48d9-8576-dc6e885fc11e">
2024-04-23 11:43:27 +02:00
Weiko
fa4670b14d
chore: extend root eslint config in twenty-server (#5101)
Reopening @thaisguigon work from
https://github.com/twentyhq/twenty/pull/4781

---------

Co-authored-by: Thaïs Guigon <guigon.thais@gmail.com>
2024-04-22 17:34:24 +02:00
Charles Bochet
3e8d42f2ed Fix standard field ids of timelineActivities relations 2024-04-20 19:29:42 +02:00
Charles Bochet
72b7d41cac Fix syncing of old event models 2024-04-20 18:12:27 +02:00
Charles Bochet
d77ad1052c Fix demo workspace seed 2024-04-20 00:11:04 +02:00
Thaïs
d3170fc1ea
fix: fix root start script (#5032)
Fixes #5022

See https://nx.dev/recipes/running-tasks/root-level-scripts#setup
2024-04-19 18:28:02 +02:00
Félix Malfait
d145684966
New Timeline (#4936)
Refactored the code to introduce two different concepts:
- AuditLogs (immutable, raw data)
- TimelineActivities (user-friendly, transformed data)

Still some work needed:
- Add message, files, calendar events to timeline (~2 hours if done
naively)
- Refactor repository to try to abstract concept when we can (tbd, wait
for Twenty ORM)
- Introduce ability to display child timelines on parent timeline with
filtering (~2 days)
- Improve UI: add links to open note/task, improve diff display, etc
(half a day)
- Decide the path forward for Task vs Notes: either introduce a new
field type "Record Type" and start going into that direction ; or split
in two objects?
- Trigger updates when a field is changed (will be solved by real-time /
websockets: 2 weeks)
- Integrate behavioral events (1 day for POC, 1 week for
clean/documented)

<img width="1248" alt="Screenshot 2024-04-12 at 09 24 49"
src="https://github.com/twentyhq/twenty/assets/6399865/9428db1a-ab2b-492c-8b0b-d4d9a36e81fa">
2024-04-19 17:52:57 +02:00
Weiko
3a959248f9
Fix billing check for trial sub status (#5054)
## Context
Sub status is not binary as you can also be in trial mode and still
should be able to share invite link. This PR should fix this issue
2024-04-19 15:16:08 +02:00
martmull
36d4c38c3d
Check password in signinup only when email/password signInUp (#5042)
- disable password check when signInUp from google (sso)
- check password when signInUp with email password
2024-04-18 17:52:01 +02:00
Weiko
220a0e91d2
[messaging/calendar] fix missing authFailedAt reset once refreshToken is updated (#5037) 2024-04-18 15:43:35 +02:00
bosiraphael
8702c71d45
4746 create created listener on blocklist (#5031)
Closes #4746 for messaging.

I will create another PR to implement the listener on calendar.
2024-04-18 15:06:13 +02:00
Thomas Trompette
b08e95494c
Move id column check before foreign table creation (#5029)
When distant table does not have an id column, syncing does not work.
Today the check is only made after creating the foreign table locally.
We should do it first, so we avoid having a foreign table created and
failing right after.

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-04-18 11:34:21 +02:00
Charles Bochet
977927af04
Disable audit log on system objects (#5018)
## Context

We have recently added an event listener to create audit logs on objects
update. However, we have only created the structure (relations on event
standard objects) for Company, Person, Opportunity and custom objects.
There is a larger effort in #4936 to refactor this.
For now, we are disabling log auditing on all other objects

## How
Add @IsNotAuditLogged() annotation on all standard objects except
Company, Person, Opportunity
2024-04-17 17:52:39 +02:00
Thomas Trompette
6cf3ade300
Make id available in remote table output (#5003)
Wrongly use `PrimaryGeneratedColumn` typeOrm decorator instead of the
nest query one.

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-04-17 17:05:47 +02:00
Weiko
979b8d29cc
UpdateSubscriptionJob should not be enqueued if billing is not enabled (#5007)
## Context
Adding this check to avoid enqueuing this job and following return-early
good practice

## Test
Without IS_BILLING_ENABLED env set

<img width="565" alt="Screenshot 2024-04-17 at 15 31 12"
src="https://github.com/twentyhq/twenty/assets/1834158/fcc43ce0-4455-4c4a-9889-02d99f0cd519">

With IS_BILLING_ENABLED env set
<img width="581" alt="Screenshot 2024-04-17 at 15 32 28"
src="https://github.com/twentyhq/twenty/assets/1834158/dc9756bd-2f6b-49bd-8897-84b6d8e09d56">
2024-04-17 17:04:48 +02:00
Weiko
6804a90f2f
Fix invite link sign-up with workspace without subcription and billing not enabled (#5006)
## Context

We recently introduced this verification but we didn't take into account
self-hosting that might not use billing.

## Test
tested locally with
- new workspace and new account
- existing workspace with new account and billing not enabled and status
incomplete => OK
- existing workspace with new account and billing enabled and status
incomplete => NOK
- existing workspace with new account and billing enabled and status
active => OK
2024-04-17 15:09:51 +02:00
bosiraphael
3024e04a1c
4971 add issyncenabled toggle in messaging settings (#4995)
- Closes #4971
- Fix calendar import to take isSyncEnabled into account
2024-04-17 13:35:23 +02:00
Weiko
6211f84de8
block invite link if workspace subscription is not active (#4991)
Fixes https://github.com/twentyhq/twenty/issues/4980

## Test
tested locally with incomplete and active
2024-04-17 10:55:47 +02:00
Thomas Trompette
6fa2aee624
Introduce remote table entity (#4994)
We will require remote table entity to map distant table name and local
foreign table name.
Introducing the entity:
- new source of truth to know if a table is sync or not
- created synchronously at the same time as metadata and foreign table

Adding a few more changes:
- exception rather than errors so the user can see these
- `pluralize` library that will allow to stop adding `Remote` suffix on
names

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-04-17 10:52:10 +02:00
Weiko
2efc794b43
[messaging] Add message deletion during partial sync (#4972)
## Context

- Rename remaining V2 services.
- Delete messages in DB when gmail history tells us they've been
deleted. I removed the logic where we store those in a cache since it's
a bit overkill because we don't need to query gmail and can use those
ids directly. The strategy is to delete the message channel message
association of the current channel, not the message or the thread since
they can still be linked to other channels. However, we will need to
call the threadCleaner service on the workspace to remove orphan
threads/non-associated messages.

Note: deletion for full-sync is a bit tricky because we need the full
list of message ids to compare with the DB and make sure we don't
over-delete. Currently, to keep memory, we don't have a variable that
holds all ids as we flush it after each page. Easier solution would be
to wipe everything before each full sync but it's probably not great for
the user experience if they are currently manipulating messages since
full-sync can happen without a user intervention (if a partial sync
fails due to historyId being invalidated by google for some reason)
2024-04-16 17:18:06 +02:00
bosiraphael
d63937ec6f
4988 dont import emails with ics attachments (#4990)
- Closes #4988 
- Fix parenthesis error in filter
2024-04-16 15:45:31 +02:00
Weiko
4bf23780a1
[calendar/messaging] fix google refresh token transaction (#4989)
## Context
The full-sync job was enqueued within a transaction, which means it
could be executed before the transaction was commit and
connected-account was not created yet.
This PR re-arrange the code a bit to avoid this

cc @bosiraphael thx for flagging this!
2024-04-16 15:06:37 +02:00
Weiko
cd6ed867be
fix google oauth guard (#4987)
## Context
Recent PR introduced a verifyTransientToken inside the
GoogleAPIsProviderEnabledGuard guard. This is used to extract the
workspaceId from the token. This is working fine for the first call sent
to google however the callback is calling the same guard which is
causing an issue because the transientToken is missing from the
callback.
Imho, the same guard shouldn't be used by the callback but for the time
being I'm adding a check to prevent using feature flag when
transientToken is absent. In fact, it is present in the request but not
in the same key. Because the scope is only relevant for the first call,
I'm simply adding a check there.
2024-04-16 12:47:59 +02:00
Weiko
0376a9b38f
[calendar] enabled calendar scope if feature flag enabled (#4984)
## Context
Currently the calendar scope is bound to an env variable. We want to
rollout this feature to some users so this PR adds a check on the
existing IS_CALENDAR_ENABLED flag
2024-04-16 11:07:37 +02:00
martmull
0ad9e94318
Fix google account login (#4969)
- Fixes Google account login 
- Fixes security issue
2024-04-15 20:08:19 +02:00
bosiraphael
691454ef3b
4745 move common logic between messaging and calendar in packagestwenty serversrcmodulesconnected account (#4962)
Closes #4745
2024-04-15 18:10:12 +02:00
bosiraphael
d7d9f0c16b
Fix ParticipantChip and stories imports (#4974)
- Fix ParticipantChip
- Fix stories imports after some component have been moved to twenty UI
2024-04-15 18:09:05 +02:00
Weiko
db2935b877
[message-queue] Add job auto-removal (#4973)
## Context

With the addition of cronjobs, the app is building a lot of jobs and
stores them indefinitely. There is no real point to keep all of them in
the queue once they have been processed (completed or failed) so we are
adding a new default option to the bull-mq driver

## Implementation
See bull-mq JobsOption doc
```typescript
    /**
     * If true, removes the job when it successfully completes
     * When given a number, it specifies the maximum amount of
     * jobs to keep, or you can provide an object specifying max
     * age and/or count to keep. It overrides whatever setting is used in the worker.
     * Default behavior is to keep the job in the completed set.
     */
    removeOnComplete?: boolean | number | KeepJobs;
    /**
     * If true, removes the job when it fails after all attempts.
     * When given a number, it specifies the maximum amount of
     * jobs to keep, or you can provide an object specifying max
     * age and/or count to keep. It overrides whatever setting is used in the worker.
     * Default behavior is to keep the job in the failed set.
     */
    removeOnFail?: boolean | number | KeepJobs;
```

removeOnFail should be a bit higher since they are the ones we are most
likely looking at when needed.
2024-04-15 17:33:27 +02:00
bosiraphael
11d928baa3
Seed calendar events (#4967)
Added seeds for: 
- `calendar-event-participants`
- `calendar-channel`
- `calendar-channel-event-association`
2024-04-15 15:47:23 +02:00
bosiraphael
764a3ebfde
4501 improve filters for emails imports (#4966)
- Reduce gmailSearchFilterNonPersonalEmails to the essential
- Filter out promotions, social media and forums emails
2024-04-15 15:45:38 +02:00
Thomas Trompette
756de8a31b
Add connection failed status (#4939)
1/ When the user inputs wrong connection informations, we do not inform
him. He will only see that no tables are available.
We will display a connection failed status if an error is raised testing
the connection

2/ If the connection fails, it should still be possible to delete the
server. Today, since we try first to delete the tables, the connection
failure throws an error that will prevent server deletion. Using the
foreign tables instead of calling the distant DB.

3/ Redirect to connection show page instead of connection list after
creation

4/ Today, foreign tables are fetched without the server name. This is a
mistake because we need to know which foreign table is linked with which
server. Updating the associated query.

<img width="632" alt="Capture d’écran 2024-04-12 à 10 52 49"
src="https://github.com/twentyhq/twenty/assets/22936103/9e8406b8-75d0-494c-ac1f-5e9fa7100f5c">

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-04-15 14:09:01 +02:00
Aditya Pimpalkar
3e65fbd3d5
bug: update revokedAt on PKCE flow (#4918)
The authorization token has an expiry of 5 minutes, we already have
checks in place to verify this and throw a Forbidden exception. We need
to revoke the token once it's used otherwise it could be used multiple
times to gain access to tokens till it expires.
2024-04-15 12:49:05 +02:00
Félix Malfait
acc2092b95
Disable audit logs on WorkspaceMember (#4960)
Having audit logs on workspace member causes a conflict on column name
2024-04-14 11:49:20 +02:00
Félix Malfait
9aa24ed803
Compile with swc on twenty-server (#4863)
Experiment using swc instead of tsc (as we did the switch on
twenty-front)

It's **much** faster (at least 5x) but has stricter requirements.
I fixed the build but there's still an error while starting the server,
opening this PR for discussion.

Checkout the branch and try `nx build:swc twenty-server`

Read: https://docs.nestjs.com/recipes/swc#common-pitfalls
2024-04-14 09:09:51 +02:00
martmull
7799d0efd8
Fix Google Login Invitation link (#4942)
close #4925

Before, for google-auth, if the user exists, we would simply returns a
login token, without checking the InvitationLink
Now, we just call the `authService.signUp` function that handle all
use-cases for us (user exists or not, invitationLink exists or not)
2024-04-12 17:22:38 +02:00
Jeet Chawda
280229bad6
Added isAuditLogged column to object-metadata-entity (#4898)
Added isAuditLogged column to object-metadata-entity.ts

This is my first open source pull request. Please do let me know if made
any mistake. I will be greatfull. Thank u

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
2024-04-12 15:28:07 +02:00
Weiko
f4fda221b7
Fix cron module structure (#4933)
This PR introduces a new folder structure for business modules.
Cron commands and jobs are now stored within the same module/folder at
the root of the business module
e.g: /modules/messaging/crons/commands instead of
/modules/messaging/commands/crons
Patterns are now inside their own cron-command files since they don't
need to be exported
Ideally cronJobs and cronCommands should have their logic within the
same class but it's a bit harder than expected due to how commanderjs
and our worker need both some class heritage check, hence the first
approach is to move them in the same folder

Also Messaging fullsync/partialsync V2 has been dropped since this is
the only used version => Breaking change for ongoing jobs and crons.
Jobs can be dropped but we will need to re-run our crons (only
cron:messaging:gmail-fetch-messages-from-cache)
2024-04-12 14:43:03 +02:00
Quentin G
a6b38d76ce
fix: sentry init is using the wrong environment (#4940)
In the previous PR #4912 it seems that I forgot to pass the environment
on the backend.
Here is a quick fix!

I also added some "doc" in the the .env.example
2024-04-12 12:27:35 +02:00
bosiraphael
c0b3a8715f
4810 display participants in the right drawer of the calendar event (#4896)
Closes #4810

- Introduces a new component `ExpandableList` which uses intersection
observers to display the maximum number of elements possible
2024-04-12 10:33:46 +02:00
Weiko
dc542a395e
fix default value for message channel enums (#4934) 2024-04-11 18:42:31 +02:00
Thomas Trompette
f332213e0d
Fix remote object read-only + remove relations (#4921)
- Set `readOnly` boolean in table row context. Preventing updates and
deletion
- Show page is null for remote objects. No need for complicated design
since this is temporary?
- Relation creations are now behind a feature flag for remote objects
- Refetch objects and views after syncing objects

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
2024-04-11 17:58:02 +02:00
Weiko
fc56775c2a
[calendar/messaging] fix connected account auth failed should skip sync (#4920)
- AuthFailedAt is set when a refreshToken is not valid and an
accessToken can't be generated, meaning it will need a manual action
from the user to provide a new refresh token.
- Calendar/messaging jobs should not be executed if authFailedAt is not
null.
2024-04-11 17:57:48 +02:00
bosiraphael
8853408264
4736 add listener on calendarchannel isautocontactcreationenabled (#4913)
Closes #4736
2024-04-11 17:57:19 +02:00
gitstart-app[bot]
7211730570
New field type: DATE (#4876)
### Description
New field type: DATE

### Refs
https://github.com/twentyhq/twenty/issues/4377

### Demo

https://jam.dev/c/d0b59883-593c-4ca3-966b-c12d5d2e1c32

Fixes #4377

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com>
Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2024-04-11 17:29:29 +02:00
Quentin G
bf60227d67
feat: add SENTRY_RELEASE env (#4912)
Add support for a new SENTRY_RELEASE and SENTRY_ENVIRONMENT env.
It is optional and allows to init sentry with a Release version and an
env (used internally at Twenty).
Docker image have been updated do intergrate the new env as an Argument
2024-04-11 16:53:15 +02:00
Lucas Bordeau
c69a3f01da
Use defaultValue in currency input (#4911)
- Fix default value sent to backend, using single quotes by default
- Use default value in field definition and column definition so that
field inputs can access it
- Used currency default value in CurrencyFieldInput

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-04-11 16:49:00 +02:00
martmull
a7fcc5d47e
4778 multi select field front implement multi select type (#4887) 2024-04-11 12:57:08 +02:00