From c531c26078f652eee7f8c40c577f1ce51dd8d7aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 3 Dec 2022 20:49:43 +0100 Subject: [PATCH 1/4] maybe fix links in modals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/components/modal-root.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/soapbox/components/modal-root.tsx b/app/soapbox/components/modal-root.tsx index f3cdac7da..a51b54a12 100644 --- a/app/soapbox/components/modal-root.tsx +++ b/app/soapbox/components/modal-root.tsx @@ -105,8 +105,10 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) const handleModalOpen = () => { modalHistoryKey.current = Date.now(); - unlistenHistory.current = history.listen((_, action) => { - if (action === 'POP') { + unlistenHistory.current = history.listen(({ state }, action) => { + if (!(state as any)?.soapboxModalKey) { + onClose(); + } else if (action === 'POP') { handleOnClose(); if (onCancel) onCancel(); @@ -118,11 +120,9 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) if (unlistenHistory.current) { unlistenHistory.current(); } - if (!['FAVOURITES', 'MENTIONS', 'REACTIONS', 'REBLOGS', 'MEDIA'].includes(type)) { - const { state } = history.location; - if (state && (state as any).soapboxModalKey === modalHistoryKey.current) { - history.goBack(); - } + const { state } = history.location; + if (state && (state as any).soapboxModalKey === modalHistoryKey.current) { + history.goBack(); } }; @@ -174,7 +174,7 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) ensureHistoryBuffer(); } - }); + }, [children]); if (!visible) { return ( From c792cc25497974c475aada4a7db1bc70e4a3a035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 22 Dec 2022 19:58:20 +0100 Subject: [PATCH 2/4] Do not include link to profile in ReplyMentionsModal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/components/account.tsx | 13 ++++++++++--- app/soapbox/features/reply-mentions/account.tsx | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/soapbox/components/account.tsx b/app/soapbox/components/account.tsx index 5618b8cf8..7ea8f43f9 100644 --- a/app/soapbox/components/account.tsx +++ b/app/soapbox/components/account.tsx @@ -15,14 +15,17 @@ import type { Account as AccountEntity } from 'soapbox/types/entities'; interface IInstanceFavicon { account: AccountEntity, + disabled?: boolean, } -const InstanceFavicon: React.FC = ({ account }) => { +const InstanceFavicon: React.FC = ({ account, disabled }) => { const history = useHistory(); const handleClick: React.MouseEventHandler = (e) => { e.stopPropagation(); + if (disabled) return; + const timelineUrl = `/timeline/${account.domain}`; if (!(e.ctrlKey || e.metaKey)) { history.push(timelineUrl); @@ -32,7 +35,11 @@ const InstanceFavicon: React.FC = ({ account }) => { }; return ( - ); @@ -219,7 +226,7 @@ const Account = ({ @{username} {account.favicon && ( - + )} {(timestamp) ? ( diff --git a/app/soapbox/features/reply-mentions/account.tsx b/app/soapbox/features/reply-mentions/account.tsx index 5facac7a8..db3dbce8f 100644 --- a/app/soapbox/features/reply-mentions/account.tsx +++ b/app/soapbox/features/reply-mentions/account.tsx @@ -52,7 +52,7 @@ const Account: React.FC = ({ composeId, accountId, author }) => { return (
- +
{!author && button}
From 519c4fb25298e62f94578d5a1df2090299be0ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 8 Jan 2023 21:37:20 +0100 Subject: [PATCH 3/4] Fix 'View context' button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../account-gallery/components/media-item.tsx | 2 +- .../features/ui/components/modals/media-modal.tsx | 14 +++++++++++--- .../service-worker/web-push-notifications.ts | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/soapbox/features/account-gallery/components/media-item.tsx b/app/soapbox/features/account-gallery/components/media-item.tsx index 4242094b5..6752bcdab 100644 --- a/app/soapbox/features/account-gallery/components/media-item.tsx +++ b/app/soapbox/features/account-gallery/components/media-item.tsx @@ -56,7 +56,7 @@ const MediaItem: React.FC = ({ attachment, displayWidth, onOpenMedia const width = `${Math.floor((displayWidth - 4) / 3) - 4}px`; const height = width; const status = attachment.get('status'); - const title = status.get('spoiler_text') || attachment.get('description'); + const title = status.get('spoiler_text') || attachment.get('description'); let thumbnail: React.ReactNode = ''; let icon; diff --git a/app/soapbox/features/ui/components/modals/media-modal.tsx b/app/soapbox/features/ui/components/modals/media-modal.tsx index ff8b6b467..5b5ff0dc9 100644 --- a/app/soapbox/features/ui/components/modals/media-modal.tsx +++ b/app/soapbox/features/ui/components/modals/media-modal.tsx @@ -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 = (props) => { const intl = useIntl(); const history = useHistory(); + const dispatch = useAppDispatch(); const [index, setIndex] = useState(null); const [navigationHidden, setNavigationHidden] = useState(false); @@ -94,8 +96,14 @@ const MediaModal: React.FC = (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}`); - onClose(); + + 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(); + }); } }; @@ -113,7 +121,7 @@ const MediaModal: React.FC = (props) => { let pagination: React.ReactNode[] = []; - const leftNav = media.size > 1 && ( + const leftNav = media.size > 1 && (