From 79cc3a7d3fd6a3510be1887275b268609b515263 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 30 Jul 2023 18:41:45 -0500 Subject: [PATCH 1/5] Fix "Add or remove from list" crashing the page Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1493 --- app/soapbox/reducers/list-adder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/soapbox/reducers/list-adder.ts b/app/soapbox/reducers/list-adder.ts index f2ff96324..81e9bd644 100644 --- a/app/soapbox/reducers/list-adder.ts +++ b/app/soapbox/reducers/list-adder.ts @@ -32,7 +32,7 @@ export default function listAdderReducer(state: State = ReducerRecord(), action: return ReducerRecord(); case LIST_ADDER_SETUP: return state.withMutations(map => { - map.set('accountId', action.account.get('id')); + map.set('accountId', action.account.id); }); case LIST_ADDER_LISTS_FETCH_REQUEST: return state.setIn(['lists', 'isLoading'], true); From ef42144896bdaf9fecb3f1d3a7cf2e72dff64f3c Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 30 Jul 2023 18:37:48 -0500 Subject: [PATCH 2/5] Fix reported statuses not showing up Fixes https://gitlab.com/soapbox-pub/soapbox/-/issues/1494 --- app/soapbox/reducers/admin.ts | 3 +-- app/soapbox/utils/normalizers.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/soapbox/reducers/admin.ts b/app/soapbox/reducers/admin.ts index bf2fd0818..b8b11cd17 100644 --- a/app/soapbox/reducers/admin.ts +++ b/app/soapbox/reducers/admin.ts @@ -145,8 +145,7 @@ const minifyReport = (report: AdminReportRecord): ReducerAdminReport => { target_account: normalizeId(report.getIn(['target_account', 'id'])), action_taken_by_account: normalizeId(report.getIn(['action_taken_by_account', 'id'])), assigned_account: normalizeId(report.getIn(['assigned_account', 'id'])), - - statuses: report.get('statuses').map((status: any) => normalizeId(status.id)), + statuses: report.get('statuses').map((status: any) => normalizeId(status.get('id'))), }) as ReducerAdminReport; }; diff --git a/app/soapbox/utils/normalizers.ts b/app/soapbox/utils/normalizers.ts index 343b1103b..b450a15d8 100644 --- a/app/soapbox/utils/normalizers.ts +++ b/app/soapbox/utils/normalizers.ts @@ -10,7 +10,7 @@ export const makeEmojiMap = (emojis: any) => emojis.reduce((obj: any, emoji: any /** Normalize entity ID */ export const normalizeId = (id: any): string | null => { - return typeof id === 'string' ? id : null; + return z.string().nullable().catch(null).parse(id); }; export type Normalizer = (value: V) => R; From 0a7d0105ff04c22fc79a1ea4e31245e8529203b1 Mon Sep 17 00:00:00 2001 From: oakes Date: Mon, 31 Jul 2023 13:29:27 -0400 Subject: [PATCH 3/5] Default to hiding Likes tab --- app/soapbox/pages/profile-page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/soapbox/pages/profile-page.tsx b/app/soapbox/pages/profile-page.tsx index b2351e05b..75c4c7ecc 100644 --- a/app/soapbox/pages/profile-page.tsx +++ b/app/soapbox/pages/profile-page.tsx @@ -62,7 +62,7 @@ const ProfilePage: React.FC = ({ params, children }) => { if (account) { const ownAccount = account.id === me; - if (ownAccount || account.pleroma?.hide_favorites !== true) { + if (ownAccount || account.pleroma?.hide_favorites === false) { tabItems.push({ text: , to: `/@${account.acct}/favorites`, From efb3097c800c26847c50c1794ddf9fc805650011 Mon Sep 17 00:00:00 2001 From: oakes Date: Wed, 2 Aug 2023 15:29:01 -0400 Subject: [PATCH 4/5] Set default for 'checked' property --- app/soapbox/components/ui/toggle/toggle.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/soapbox/components/ui/toggle/toggle.tsx b/app/soapbox/components/ui/toggle/toggle.tsx index abf7933c5..1b34dde3c 100644 --- a/app/soapbox/components/ui/toggle/toggle.tsx +++ b/app/soapbox/components/ui/toggle/toggle.tsx @@ -6,7 +6,7 @@ interface IToggle extends Pick, 'id' } /** A glorified checkbox. */ -const Toggle: React.FC = ({ id, size = 'md', name, checked, onChange, required, disabled }) => { +const Toggle: React.FC = ({ id, size = 'md', name, checked = false, onChange, required, disabled }) => { const input = useRef(null); const handleClick: React.MouseEventHandler = () => { From c384aa6db2ce02c80a8bb2ec158387c9ddd66d07 Mon Sep 17 00:00:00 2001 From: oakes Date: Wed, 2 Aug 2023 15:38:50 -0400 Subject: [PATCH 5/5] Pass id to useEffect so it runs when id changes --- app/soapbox/features/hashtag-timeline/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/soapbox/features/hashtag-timeline/index.tsx b/app/soapbox/features/hashtag-timeline/index.tsx index 69cc0cd60..df0c05236 100644 --- a/app/soapbox/features/hashtag-timeline/index.tsx +++ b/app/soapbox/features/hashtag-timeline/index.tsx @@ -41,7 +41,7 @@ export const HashtagTimeline: React.FC = ({ params }) => { useEffect(() => { dispatch(expandHashtagTimeline(id)); dispatch(fetchHashtag(id)); - }, []); + }, [id]); useEffect(() => { dispatch(clearTimeline(`hashtag:${id}`));