From 19b697366746753ba186ce76a2ef66fe80db1520 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 13 Aug 2022 10:27:12 -0500 Subject: [PATCH 1/3] Notifications: StatusContainer --> Status, fix not being able to mute a conversation --- app/soapbox/components/status.tsx | 4 +++- app/soapbox/containers/status_container.tsx | 15 ++++++++++----- .../notifications/components/notification.tsx | 16 ++++++---------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/soapbox/components/status.tsx b/app/soapbox/components/status.tsx index 37cf7a24ba..04f42a546c 100644 --- a/app/soapbox/components/status.tsx +++ b/app/soapbox/components/status.tsx @@ -47,6 +47,7 @@ export interface IStatus { featured?: boolean, hideActionBar?: boolean, hoverable?: boolean, + withDismiss?: boolean, } const Status: React.FC = (props) => { @@ -63,6 +64,7 @@ const Status: React.FC = (props) => { unread, group, hideActionBar, + withDismiss, } = props; const intl = useIntl(); const history = useHistory(); @@ -374,7 +376,7 @@ const Status: React.FC = (props) => { {!hideActionBar && (
- +
)} diff --git a/app/soapbox/containers/status_container.tsx b/app/soapbox/containers/status_container.tsx index c6196638af..985251c655 100644 --- a/app/soapbox/containers/status_container.tsx +++ b/app/soapbox/containers/status_container.tsx @@ -4,15 +4,13 @@ import Status, { IStatus } from 'soapbox/components/status'; import { useAppSelector } from 'soapbox/hooks'; import { makeGetStatus } from 'soapbox/selectors'; -interface IStatusContainer extends Omit { +interface IStatusContainer extends Omit { id: string, /** @deprecated Unused. */ contextType?: any, /** @deprecated Unused. */ otherAccounts?: any, /** @deprecated Unused. */ - withDismiss?: any, - /** @deprecated Unused. */ getScrollPosition?: any, /** @deprecated Unused. */ updateScrollBottom?: any, @@ -24,11 +22,18 @@ const getStatus = makeGetStatus(); * Legacy Status wrapper accepting a status ID instead of the full entity. * @deprecated Use the Status component directly. */ -const StatusContainer: React.FC = ({ id, onMoveUp, onMoveDown }) => { +const StatusContainer: React.FC = ({ id, onMoveUp, onMoveDown, withDismiss }) => { const status = useAppSelector(state => getStatus(state, { id })); if (status) { - return ; + return ( + + ); } else { return null; } diff --git a/app/soapbox/features/notifications/components/notification.tsx b/app/soapbox/features/notifications/components/notification.tsx index cbf67c4dda..aa428c24ce 100644 --- a/app/soapbox/features/notifications/components/notification.tsx +++ b/app/soapbox/features/notifications/components/notification.tsx @@ -10,15 +10,15 @@ import { getSettings } from 'soapbox/actions/settings'; import { hideStatus, revealStatus } from 'soapbox/actions/statuses'; import Icon from 'soapbox/components/icon'; import Permalink from 'soapbox/components/permalink'; +import Status from 'soapbox/components/status'; import { HStack, Text, Emoji } from 'soapbox/components/ui'; import AccountContainer from 'soapbox/containers/account_container'; -import StatusContainer from 'soapbox/containers/status_container'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import { makeGetNotification } from 'soapbox/selectors'; import { NotificationType, validType } from 'soapbox/utils/notification'; import type { ScrollPosition } from 'soapbox/components/status'; -import type { Account, Status, Notification as NotificationEntity } from 'soapbox/types/entities'; +import type { Account, Status as StatusEntity, Notification as NotificationEntity } from 'soapbox/types/entities'; const getNotification = makeGetNotification(); @@ -143,7 +143,7 @@ interface INotificaton { notification: NotificationEntity, onMoveUp?: (notificationId: string) => void, onMoveDown?: (notificationId: string) => void, - onReblog?: (status: Status, e?: KeyboardEvent) => void, + onReblog?: (status: StatusEntity, e?: KeyboardEvent) => void, getScrollPosition?: () => ScrollPosition | undefined, updateScrollBottom?: (bottom: number) => void, } @@ -216,7 +216,7 @@ const Notification: React.FC = (props) => { if (e?.shiftKey || !boostModal) { dispatch(reblog(status)); } else { - dispatch(openModal('BOOST', { status, onReblog: (status: Status) => { + dispatch(openModal('BOOST', { status, onReblog: (status: StatusEntity) => { dispatch(reblog(status)); } })); } @@ -303,16 +303,12 @@ const Notification: React.FC = (props) => { case 'update': case 'pleroma:emoji_reaction': return status && typeof status === 'object' ? ( - // @ts-ignore -