twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
Other
19.43k stars 2.18k forks source link

⏳ New Timeline Activities #3130

Closed Bonapara closed 6 months ago

Bonapara commented 10 months ago

This issue aims to enhance the timeline by adding various types of activities.

Optimistic rendering should be utilized for immediate activity display on the timeline.

### Tasks
- [ ] https://github.com/twentyhq/twenty/issues/3131
- [ ] https://github.com/twentyhq/twenty/issues/3132
- [ ] https://github.com/twentyhq/twenty/issues/3133
- [ ] https://github.com/twentyhq/twenty/issues/3134
Kanav-Arora commented 10 months ago

Hi @Bonapara Is this timeline tech spec decided I was trying to understand the code and in the code the time line is showing the entries of activity and on deleting the note instead of creating a timeline entry that a note has been deleted, its deleting the activity of note due to which timeline is getting blank.

So have you guys decided the approach that a new Object?

FelixMalfait commented 10 months ago

Note this task is very complex with a lot of underlying work that needs to be done (several weeks). I'd recommend we focus on fewer items

Here's how I would do it and split it from an eng point of view: (1) Email (ongoing) (2) Calendar (will be prioritized soon) (3) Audit Logs (not prioritized) (4) Activity refactoring

The tricky part is (4). I think the right path is to do what Salesforce does which is to only display activities in the timeline, no related objects like we're doing with messages short-term for example. But the Salesforce experience is really bad (e.g. email aren't logged unless you ask Salesforce to automatically create a task for every email) - it's not that easy to solve cleanly.

We could introduce "calendarEventId, messageId, auditLogId" columns on Activity. Then introduce new types: "calendar_event", "audit_log", "message", "call" with non null constraints on calendarEventId, AuditLogId, messageId, callId. Also introduce a "manual" channel/type on events/calls/messages table to enable manual logging. We need then to introduce mechanism to create the activities from their parent objects. For example for the AuditLog not every item will create an activity. We also need to propagate some changes (e.g. event date change -> change activity date). Keeping an object with its activities in sync will be a challenge and we'll need to have robust mechanisms to mitigate this (indempotency, good sql constraints, etc.)

Note: calendar event could be an activity type instead of its own table (that's what most CRMs do). This comes with pros/cons that will need to be evaluated.

FelixMalfait commented 6 months ago

We made good progress on Timeline, I will create new dedicated issues after my PR gets merged