-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Share an email thread to workspace members chip and dropdown (#4199) #5640
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Introduced
EmailThreadMembersChip
component to display email thread visibility. - Added new fields to
fetchAllThreadMessagesOperationSignatureFactory.ts
for message thread members. - Updated
RightDrawerEmailThread.tsx
to manage message thread state with Recoil. - Created new types
MessageThread
andMessageThreadMember
. - Added
MessageThreadMembersBar
component to show email thread members in the right drawer.
messageThread: MessageThread | null; | ||
}) => { | ||
const renderChip = () => { | ||
if (!messageThread) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming isEveryone
to isVisibleToEveryone
for better clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't feel the need for this change, as we wanted the variable to be consistent with the database table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to agree with that I also didn't understand what Everyone was
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop everything related to "everyone" and focus on 1-to-1 sharing for v1. Maybe "everyone" should be managed through the permission layer instead. And here we'll manage something a bit more fine-grained with product implications which would be "thread subscribers" (people who would receive notifications when a new message is received for example)
packages/twenty-front/src/modules/activities/emails/components/EmailThreadMembersChip.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/activities/emails/components/EmailThreadMembersChip.tsx
Outdated
Show resolved
Hide resolved
...wenty-front/src/modules/activities/emails/right-drawer/components/RightDrawerEmailThread.tsx
Show resolved
Hide resolved
|
||
export type MessageThread = { | ||
id: string; | ||
everyone: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming everyone
to something more descriptive like isVisibleToAll
for better clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We think everyone is fine for this case.
packages/twenty-front/src/modules/ui/layout/dropdown/components/SharedDropdownMenu.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/database/typeorm-seeds/workspace/message-thread-members.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/database/typeorm-seeds/workspace/message-thread-members.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/database/typeorm-seeds/workspace/message-thread-members.ts
Outdated
Show resolved
Hide resolved
Thanks so much @pereira0x! From a design perspective, there is an unwanted top bar on the following component: |
Hey @Bonapara. Me and @pereira0x will take care of removing the unwanted top bar from the Dropdown component. Additionally, we'll review the bot suggestions and apply them to our patch. |
Good afternoon everyone! Just pushed some changes, please tell us if we missed something. |
Hi everyone. Regarding shared emails visibility change, me and @pereira0x were told on Discord that we could not leverage useFindManyRecords to change the visibility on shared email threads, given that nested query filters are not supported yet. Any ideas how we can move forward now @charlesBochet? |
Hey thanks for this and apologies for the slow review! We'll review and try to get it merged this week. |
No worries!! The merge conflicts will be solved by the end of tomorrow. |
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: José Pereira <jose.a.pereira@tecnico.ulisboa.pt>
Co-authored-by: José Pereira <jose.a.pereira@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: José Pereira <jose.a.pereira@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: José Pereira <jose.a.pereira@tecnico.ulisboa.pt>
Co-authored-by: José Pereira <jose.a.pereira@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: José Pereira <jose.a.pereira@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: José Pereira <jose.a.pereira@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Co-authored-by: Simão Sanguinho <simao.sanguinho@tecnico.ulisboa.pt>
Hey, just letting you guys know that the new conflicts are now fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey apologies it took months to review!!! That's great work you did here
packages/twenty-front/src/modules/ui/layout/right-drawer/components/RightDrawerTopBar.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/layout/dropdown/components/SharedDropdownMenu.tsx
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,132 @@ | |||
import { useTheme } from '@emotion/react'; | |||
import { offset } from '@floating-ui/react'; | |||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you hide the frontend logic behind a feature flag? That would allow merging this intermediate PR before we do a second one
@@ -0,0 +1,78 @@ | |||
import { useTheme } from '@emotion/react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every component should have a storybook story :)
}) | ||
@WorkspaceIsNotAuditLogged() | ||
@WorkspaceIsSystem() | ||
export class MessageThreadMemberWorkspaceEntity extends BaseWorkspaceEntity { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we rename this object to MessageThreadSubscriber?
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service'; | ||
|
||
@Injectable() | ||
export class MessageThreadMemberRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI We've now introduced TwentyORM which allows doing this elegantly. We're trying to cleanup the code base from sql raw query (but still a LOT of work ahead)
MESSAGE_THREAD_1: '20202020-8bfa-453b-b99b-bc435a7d4da8', | ||
MESSAGE_THREAD_2: '20202020-634a-4fde-aa7c-28a0eaf203ca', | ||
MESSAGE_THREAD_3: '20202020-1b56-4f10-a2fa-2ccaddf81f6c', | ||
MESSAGE_THREAD_4: '20202020-d51c-485a-b1b6-ed7c63e05d72', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any message in my local database for 20202020-d51c-485a-b1b6-ed7c63e05d72
, did I miss anything?
} | ||
|
||
return ( | ||
<Chip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/twenty-front/src/modules/ui/layout/dropdown/components/SharedDropdownMenu.tsx
Outdated
Show resolved
Hide resolved
Thanks @pereira0x for your contribution! |
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
messageThreadMembers
and the relevant existing tables (MessageThread
andWorkspaceMembers
)MessageThread table
:everyone
- to indicate that all workspace members can see the email threadMultiChip
, that shows a group of user avatars, instead of just oneShareDropdownMenu
, that shows up once theEmailThreadMembersChip
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://private-user-images.githubusercontent.com/26422084/334591663-80d75cdc-656f-490d-9eb1-a07346aad75c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4NTE3OTksIm5iZiI6MTczOTg1MTQ5OSwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE2NjMtODBkNzVjZGMtNjU2Zi00OTBkLTllYjEtYTA3MzQ2YWFkNzVjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDA0MDQ1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIxZmJmODUxMTE0NThmMThmNWFjNDQwNGYzZGViYTY5NGNkMzM2MDY4YWFmMWViYWMwZjI5NTM0OTNlNDhhNGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.J5ZAfhHntcg87Prw3DlHSeSGkPS_SN6WyCsUJsGPDiM)
Chip with just one member of the workspace (the owner) being part of the message thread:
![image](https://private-user-images.githubusercontent.com/26422084/334591701-c26677c6-ab93-4149-8201-b110d7346a28.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4NTE3OTksIm5iZiI6MTczOTg1MTQ5OSwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3MDEtYzI2Njc3YzYtYWI5My00MTQ5LTgyMDEtYjExMGQ3MzQ2YTI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDA0MDQ1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFkZjE5NjIxNzJhN2JkZGZmMTc1NjY5OTM2YjczNzBkMjMxMjc2OTM3ZTU1ZDVkM2JmZGQ4NWQwYjVmMWY0ZDImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Wxd4g8SJElup5Ic75b4URT65bxC6scMocOk1xcxpkNc)
Chip with some members of the workspace being part of the message thread:
![image](https://private-user-images.githubusercontent.com/26422084/334591727-9eccf5f8-134c-4c62-9145-5d5aa2346071.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4NTE3OTksIm5iZiI6MTczOTg1MTQ5OSwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3MjctOWVjY2Y1ZjgtMTM0Yy00YzYyLTkxNDUtNWQ1YWEyMzQ2MDcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDA0MDQ1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZjYzllMWM0NjgwOWFiMTQzMmVlNTFjNDQ1MjgxMDRiMWY0YTVhMmM0YjYxNjVlMGJiOTJkN2VlMmFmOTU2MGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.kRa-uRg_afOofj1eWisWlh1n_onO2grM6GT1K45duSA)
How the chip looks in a message thread:
![image](https://private-user-images.githubusercontent.com/26422084/334591750-a9de981d-7288-4aed-8616-c1cb7de524e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4NTE3OTksIm5iZiI6MTczOTg1MTQ5OSwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3NTAtYTlkZTk4MWQtNzI4OC00YWVkLTg2MTYtYzFjYjdkZTUyNGUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDA0MDQ1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk0YjgxMmMyZjI4N2RhYzMyZTdlN2FkYzUwOTZhNTc3MGQ2MDdlMGRkZDRkZjU2NjE1YWU0ZTA0OWEwZGFmMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.M7Ok1yPe_u87ZWg1v_VepTUYpwYrSbAeoeXPpTe_upI)
Dropdown that opens when you click on the chip:
![image](https://private-user-images.githubusercontent.com/26422084/334591769-a1bb9cd4-01bb-45c5-bf8b-b31c2f3d85e0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4NTE3OTksIm5iZiI6MTczOTg1MTQ5OSwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3NjktYTFiYjljZDQtMDFiYi00NWM1LWJmOGItYjMxYzJmM2Q4NWUwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDA0MDQ1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMwMzQ0MmU3NDI1MjA1ZWJiMzBjZGM4ZjMyZjAxYmY4OWM0YzlhN2FhODAyNWRkZTE0ZTMxZTZiMDgyNGIyMjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qvXjaEU2H-twZqdrQ_MCYw2CI3uXoMe9a5z22BkdA9A)
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 :)