Notifications: StatusContainer --> Status, fix not being able to mute a conversation

This commit is contained in:
Alex Gleason 2022-08-13 10:27:12 -05:00
parent c279e41eb2
commit 19b6973667
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 19 additions and 16 deletions

View file

@ -47,6 +47,7 @@ export interface IStatus {
featured?: boolean,
hideActionBar?: boolean,
hoverable?: boolean,
withDismiss?: boolean,
}
const Status: React.FC<IStatus> = (props) => {
@ -63,6 +64,7 @@ const Status: React.FC<IStatus> = (props) => {
unread,
group,
hideActionBar,
withDismiss,
} = props;
const intl = useIntl();
const history = useHistory();
@ -374,7 +376,7 @@ const Status: React.FC<IStatus> = (props) => {
{!hideActionBar && (
<div className='pt-4'>
<StatusActionBar status={actualStatus} />
<StatusActionBar status={actualStatus} withDismiss={withDismiss} />
</div>
)}
</div>

View file

@ -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<IStatus, 'id'> {
interface IStatusContainer extends Omit<IStatus, 'status'> {
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<IStatusContainer> = ({ id, onMoveUp, onMoveDown }) => {
const StatusContainer: React.FC<IStatusContainer> = ({ id, onMoveUp, onMoveDown, withDismiss }) => {
const status = useAppSelector(state => getStatus(state, { id }));
if (status) {
return <Status status={status} onMoveUp={onMoveUp} onMoveDown={onMoveDown} />;
return (
<Status
status={status}
onMoveUp={onMoveUp}
onMoveDown={onMoveDown}
withDismiss={withDismiss}
/>
);
} else {
return null;
}

View file

@ -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<INotificaton> = (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<INotificaton> = (props) => {
case 'update':
case 'pleroma:emoji_reaction':
return status && typeof status === 'object' ? (
// @ts-ignore
<StatusContainer
id={status.id}
<Status
status={status}
withDismiss
hidden={hidden}
onMoveDown={handleMoveDown}
onMoveUp={handleMoveUp}
contextType='notifications'
getScrollPosition={props.getScrollPosition}
updateScrollBottom={props.updateScrollBottom}
/>
) : null;
default: