Deprecate share email thread (#9319)
## Context Following this https://github.com/twentyhq/twenty/issues/4199 This has not been fully implemented, after 5months of dead code I'm removing the feature for the time being until we re-prioritise the feature (unlikely during these next 6 months) to keep the codebase a bit cleaner (no need to maintain dead features) Feel free to reopen / revert this PR once feature is ready ## Test locally after importing emails
This commit is contained in:
@ -2,13 +2,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
|
||||
import { RecordGqlOperationSignatureFactory } from '@/object-record/graphql/types/RecordGqlOperationSignatureFactory';
|
||||
|
||||
export const fetchAllThreadMessagesOperationSignatureFactory: RecordGqlOperationSignatureFactory =
|
||||
({
|
||||
messageThreadId,
|
||||
isSubscribersEnabled,
|
||||
}: {
|
||||
messageThreadId: string;
|
||||
isSubscribersEnabled: boolean;
|
||||
}) => ({
|
||||
({ messageThreadId }: { messageThreadId: string }) => ({
|
||||
objectNameSingular: CoreObjectNameSingular.Message,
|
||||
variables: {
|
||||
filter: {
|
||||
@ -33,15 +27,6 @@ export const fetchAllThreadMessagesOperationSignatureFactory: RecordGqlOperation
|
||||
receivedAt: true,
|
||||
messageThread: {
|
||||
id: true,
|
||||
subscribers: isSubscribersEnabled
|
||||
? {
|
||||
workspaceMember: {
|
||||
id: true,
|
||||
name: true,
|
||||
avatarUrl: true,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
messageParticipants: {
|
||||
id: true,
|
||||
|
||||
@ -14,9 +14,7 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||
import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord';
|
||||
import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
|
||||
import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
|
||||
export const useRightDrawerEmailThread = () => {
|
||||
const viewableRecordId = useRecoilValue(viewableRecordIdState);
|
||||
@ -38,14 +36,9 @@ export const useRightDrawerEmailThread = () => {
|
||||
},
|
||||
});
|
||||
|
||||
const isMessageThreadSubscribersEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IsMessageThreadSubscriberEnabled,
|
||||
);
|
||||
|
||||
const FETCH_ALL_MESSAGES_OPERATION_SIGNATURE =
|
||||
fetchAllThreadMessagesOperationSignatureFactory({
|
||||
messageThreadId: viewableRecordId,
|
||||
isSubscribersEnabled: isMessageThreadSubscribersEnabled,
|
||||
});
|
||||
|
||||
const {
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { EmailThreadMembersChip } from '@/activities/emails/components/EmailThreadMembersChip';
|
||||
import { messageThreadState } from '@/ui/layout/right-drawer/states/messageThreadState';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
|
||||
const StyledButtonContainer = styled.div`
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: ${({ theme }) => theme.spacing(2)};
|
||||
`;
|
||||
|
||||
export const MessageThreadSubscribersTopBar = () => {
|
||||
const isMessageThreadSubscriberEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IsMessageThreadSubscriberEnabled,
|
||||
);
|
||||
|
||||
const messageThread = useRecoilValue(messageThreadState);
|
||||
|
||||
const numberOfSubscribers = messageThread?.subscribers?.length ?? 0;
|
||||
|
||||
const shouldShowMembersChip = numberOfSubscribers > 0;
|
||||
|
||||
if (
|
||||
!isMessageThreadSubscriberEnabled ||
|
||||
!isDefined(messageThread) ||
|
||||
!shouldShowMembersChip
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledButtonContainer>
|
||||
<EmailThreadMembersChip messageThread={messageThread} />
|
||||
</StyledButtonContainer>
|
||||
);
|
||||
};
|
||||
@ -9,7 +9,6 @@ import { isNewViewableRecordLoadingState } from '@/object-record/record-right-dr
|
||||
import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState';
|
||||
import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState';
|
||||
import { RightDrawerTopBarCloseButton } from '@/ui/layout/right-drawer/components/RightDrawerTopBarCloseButton';
|
||||
import { RightDrawerTopBarDropdownButton } from '@/ui/layout/right-drawer/components/RightDrawerTopBarDropdownButton';
|
||||
import { RightDrawerTopBarExpandButton } from '@/ui/layout/right-drawer/components/RightDrawerTopBarExpandButton';
|
||||
import { RightDrawerTopBarMinimizeButton } from '@/ui/layout/right-drawer/components/RightDrawerTopBarMinimizeButton';
|
||||
import { StyledRightDrawerTopBar } from '@/ui/layout/right-drawer/components/StyledRightDrawerTopBar';
|
||||
@ -118,7 +117,6 @@ export const RightDrawerTopBar = () => {
|
||||
</StyledMinimizeTopBarTitleContainer>
|
||||
)}
|
||||
<StyledTopBarWrapper>
|
||||
<RightDrawerTopBarDropdownButton />
|
||||
{!isMobile && !isRightDrawerMinimized && (
|
||||
<RightDrawerTopBarMinimizeButton />
|
||||
)}
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
import { MessageThreadSubscribersTopBar } from '@/activities/right-drawer/components/MessageThreadSubscribersTopBar';
|
||||
import { isRightDrawerMinimizedState } from '@/ui/layout/right-drawer/states/isRightDrawerMinimizedState';
|
||||
import { rightDrawerPageState } from '@/ui/layout/right-drawer/states/rightDrawerPageState';
|
||||
import { ComponentByRightDrawerPage } from '@/ui/layout/right-drawer/types/ComponentByRightDrawerPage';
|
||||
import { RightDrawerPages } from '@/ui/layout/right-drawer/types/RightDrawerPages';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
|
||||
const RIGHT_DRAWER_TOP_BAR_DROPDOWN_BUTTON_CONFIG: ComponentByRightDrawerPage =
|
||||
{
|
||||
[RightDrawerPages.ViewEmailThread]: <MessageThreadSubscribersTopBar />,
|
||||
};
|
||||
|
||||
export const RightDrawerTopBarDropdownButton = () => {
|
||||
const [isRightDrawerMinimized] = useRecoilState(isRightDrawerMinimizedState);
|
||||
|
||||
const [rightDrawerPage] = useRecoilState(rightDrawerPageState);
|
||||
|
||||
if (isRightDrawerMinimized || !isDefined(rightDrawerPage)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const dropdownButtonComponent =
|
||||
RIGHT_DRAWER_TOP_BAR_DROPDOWN_BUTTON_CONFIG[rightDrawerPage];
|
||||
|
||||
return dropdownButtonComponent ?? <></>;
|
||||
};
|
||||
Reference in New Issue
Block a user