Fix 'View context' button

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
deduplicate
marcin mikołajczak 2023-01-08 21:37:20 +01:00
rodzic e9a2b65963
commit 519c4fb252
3 zmienionych plików z 13 dodań i 5 usunięć

Wyświetl plik

@ -9,6 +9,7 @@ import Icon from 'soapbox/components/icon';
import IconButton from 'soapbox/components/icon-button';
import Audio from 'soapbox/features/audio';
import Video from 'soapbox/features/video';
import { useAppDispatch } from 'soapbox/hooks';
import ImageLoader from '../image-loader';
@ -39,6 +40,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
const intl = useIntl();
const history = useHistory();
const dispatch = useAppDispatch();
const [index, setIndex] = useState<number | null>(null);
const [navigationHidden, setNavigationHidden] = useState(false);
@ -94,8 +96,14 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
const handleStatusClick: React.MouseEventHandler = e => {
if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
history.push(`/@${status.getIn(['account', 'acct'])}/posts/${status?.id}`);
dispatch((_, getState) => {
const account = typeof status.account === 'string' ? getState().accounts.get(status.account) : status.account;
if (!account) return;
history.push(`/@${account.acct}/posts/${status?.id}`);
onClose();
});
}
};