sforkowany z mirror/soapbox
Fix 'View context' button
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>deduplicate
rodzic
e9a2b65963
commit
519c4fb252
|
@ -9,6 +9,7 @@ import Icon from 'soapbox/components/icon';
|
||||||
import IconButton from 'soapbox/components/icon-button';
|
import IconButton from 'soapbox/components/icon-button';
|
||||||
import Audio from 'soapbox/features/audio';
|
import Audio from 'soapbox/features/audio';
|
||||||
import Video from 'soapbox/features/video';
|
import Video from 'soapbox/features/video';
|
||||||
|
import { useAppDispatch } from 'soapbox/hooks';
|
||||||
|
|
||||||
import ImageLoader from '../image-loader';
|
import ImageLoader from '../image-loader';
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
||||||
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const [index, setIndex] = useState<number | null>(null);
|
const [index, setIndex] = useState<number | null>(null);
|
||||||
const [navigationHidden, setNavigationHidden] = useState(false);
|
const [navigationHidden, setNavigationHidden] = useState(false);
|
||||||
|
@ -94,8 +96,14 @@ const MediaModal: React.FC<IMediaModal> = (props) => {
|
||||||
const handleStatusClick: React.MouseEventHandler = e => {
|
const handleStatusClick: React.MouseEventHandler = e => {
|
||||||
if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
if (status && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||||
e.preventDefault();
|
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();
|
onClose();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue