-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: main
Are you sure you want to change the base?
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.
const renderChip = () => { | ||
if (!messageThread) { | ||
return null; | ||
} |
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.
Avoid using optional chaining (?.
) when the variable is already checked for null.
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.
This is correct, we will be fixing this in our next commit.
switch (isEveryone) { | ||
case false: | ||
if (numberOfMessageThreadMembers === 1) { | ||
return ( |
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.
The label
prop for SharedDropdownMenu
is missing when numberOfMessageThreadMembers
is not 1. Consider adding a default label.
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.
Label already has a default value (empty string).
@@ -10,6 +11,7 @@ import { useRightDrawerEmailThread } from '@/activities/emails/right-drawer/hook | |||
import { emailThreadIdWhenEmailThreadWasClosedState } from '@/activities/emails/states/lastViewableEmailThreadIdState'; | |||
import { EmailThreadMessage as EmailThreadMessageType } from '@/activities/emails/types/EmailThreadMessage'; | |||
import { RIGHT_DRAWER_CLICK_OUTSIDE_LISTENER_ID } from '@/ui/layout/right-drawer/constants/RightDrawerClickOutsideListener'; | |||
import { messageThreadState } from '@/ui/layout/right-drawer/states/messageThreadState'; |
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.
Move the declaration of setMessageThread above the useEffect hook for better readability.
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 will apply this change as well.
|
||
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.
avatarUrl={getImageAbsoluteURIOrBase64( | ||
messageThreadMembersAvatarUrls?.[0], | ||
)} | ||
entityId={messageThreadMembers?.[0].workspaceMember.id} |
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 extracting the avatar rendering logic into a separate function to improve readability.
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 think that this is necessary for this case.
@@ -0,0 +1,103 @@ | |||
import { EntityManager } from 'typeorm'; |
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 adding a comment explaining the purpose of this seed script for future maintainers.
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.
This is not an existing practice in the codebase. We don't think this is relevant here.
'updatedAt', | ||
'deletedAt', | ||
'messageThreadId', | ||
'workspaceMemberId', |
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.
Add error handling for the database insertion to manage potential failures gracefully.
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 followed the same approach as with the other files, so we don't believe this is necessary.
]) | ||
.orIgnore() | ||
.values([ | ||
{ |
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.
The field 'workspaceUserId' should be 'workspaceMemberId' to match the table schema.
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.
Same as above. We will be fixing this..
avatarUrls = [], | ||
LeftIcon, | ||
RightIcon, | ||
className, |
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 nAvatars
to additionalAvatarsCount
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 can change this variable name, but we think that a better name would be numberOfAvatars
.
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. |
903e191
to
69026e1
Compare
69026e1
to
c3bfed6
Compare
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: José Pereira <[email protected]>
Co-authored-by: José Pereira <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: José Pereira <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: José Pereira <[email protected]>
Co-authored-by: José Pereira <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: José Pereira <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: José Pereira <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
Co-authored-by: Simão Sanguinho <[email protected]>
c3bfed6
to
0e94dc5
Compare
Hey, just letting you guys know that the new conflicts are now fixed! |
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3MDk2MzQsIm5iZiI6MTcxOTcwOTMzNCwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE2NjMtODBkNzVjZGMtNjU2Zi00OTBkLTllYjEtYTA3MzQ2YWFkNzVjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDAxMDIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFiOWJhMWUwZTIxMzgwODZjY2M3Y2U4MWVjNjkyMDAwYTY3OTQyZTc0Y2M4NDk1Y2E3OTE0NDAxZTAwNjYyZmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hHI6QW05Il7J4NJhXb5XqEPwxrSepuojkIzVuV5TDpM)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3MDk2MzQsIm5iZiI6MTcxOTcwOTMzNCwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3MDEtYzI2Njc3YzYtYWI5My00MTQ5LTgyMDEtYjExMGQ3MzQ2YTI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDAxMDIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlOWFlNzAwNGFiNzY2MDk0ZmM3MjEyZTU5MWMxYjExMGJjYjgyYjE2OGM0NjIyNGExMjQxZTIzMGVmNGM4YTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.BDkFnQX_WUQXAE8piFvf38mcPcjRQO-wN5sSp3iV3Bo)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3MDk2MzQsIm5iZiI6MTcxOTcwOTMzNCwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3MjctOWVjY2Y1ZjgtMTM0Yy00YzYyLTkxNDUtNWQ1YWEyMzQ2MDcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDAxMDIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI4Zjc2MmMyNThmMjZiOTY4Y2M1YmIxYzk0OWI2NDRiNTUzMGVhZmU2NDZmYWU3MmM1N2U4YWU4NTllM2IyNjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.DO42YZ1O55k3rC2u6OQQVmPcZxdAMGAFPJ9EIOakU3g)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3MDk2MzQsIm5iZiI6MTcxOTcwOTMzNCwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3NTAtYTlkZTk4MWQtNzI4OC00YWVkLTg2MTYtYzFjYjdkZTUyNGUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDAxMDIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZmY2RmZGZjMzNkNTM5M2VhYTMyZjRlZWE4ZWQyNzg4OTE5MDEyNTE1NzBkNzhjMGMyM2QzYjgxN2E1NWJiZTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ARMh9vVzPTvqFSvHWVAtnlAgQC7Io3De78AFsaZaNzk)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3MDk2MzQsIm5iZiI6MTcxOTcwOTMzNCwicGF0aCI6Ii8yNjQyMjA4NC8zMzQ1OTE3NjktYTFiYjljZDQtMDFiYi00NWM1LWJmOGItYjMxYzJmM2Q4NWUwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDAxMDIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY0MjYyOTlkNjI5MmViMDI1NDFhYTAxN2YzNTM1ZDkzY2RkZjRlMTQyYTQyZWI2MTI3NWE0N2RkOWM1YzIzYTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ptHT_E5KAqUXy07REeb-0n4cOJ13ZA4hECrSFtXt8Jg)
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 :)