Fix 'View context' button
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e9a2b65963
commit
519c4fb252
|
@ -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();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue