Merge remote-tracking branch 'soapbox/develop' into lexical

This commit is contained in:
marcin mikołajczak 2023-08-03 16:04:38 +02:00
commit 206a8d40e0
6 changed files with 6 additions and 7 deletions

View File

@ -6,7 +6,7 @@ interface IToggle extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'id'
} }
/** A glorified checkbox. */ /** A glorified checkbox. */
const Toggle: React.FC<IToggle> = ({ id, size = 'md', name, checked, onChange, required, disabled }) => { const Toggle: React.FC<IToggle> = ({ id, size = 'md', name, checked = false, onChange, required, disabled }) => {
const input = useRef<HTMLInputElement>(null); const input = useRef<HTMLInputElement>(null);
const handleClick: React.MouseEventHandler<HTMLButtonElement> = () => { const handleClick: React.MouseEventHandler<HTMLButtonElement> = () => {

View File

@ -41,7 +41,7 @@ export const HashtagTimeline: React.FC<IHashtagTimeline> = ({ params }) => {
useEffect(() => { useEffect(() => {
dispatch(expandHashtagTimeline(id)); dispatch(expandHashtagTimeline(id));
dispatch(fetchHashtag(id)); dispatch(fetchHashtag(id));
}, []); }, [id]);
useEffect(() => { useEffect(() => {
dispatch(clearTimeline(`hashtag:${id}`)); dispatch(clearTimeline(`hashtag:${id}`));

View File

@ -62,7 +62,7 @@ const ProfilePage: React.FC<IProfilePage> = ({ params, children }) => {
if (account) { if (account) {
const ownAccount = account.id === me; const ownAccount = account.id === me;
if (ownAccount || account.pleroma?.hide_favorites !== true) { if (ownAccount || account.pleroma?.hide_favorites === false) {
tabItems.push({ tabItems.push({
text: <FormattedMessage id='navigation_bar.favourites' defaultMessage='Likes' />, text: <FormattedMessage id='navigation_bar.favourites' defaultMessage='Likes' />,
to: `/@${account.acct}/favorites`, to: `/@${account.acct}/favorites`,

View File

@ -145,8 +145,7 @@ const minifyReport = (report: AdminReportRecord): ReducerAdminReport => {
target_account: normalizeId(report.getIn(['target_account', 'id'])), target_account: normalizeId(report.getIn(['target_account', 'id'])),
action_taken_by_account: normalizeId(report.getIn(['action_taken_by_account', 'id'])), action_taken_by_account: normalizeId(report.getIn(['action_taken_by_account', 'id'])),
assigned_account: normalizeId(report.getIn(['assigned_account', 'id'])), assigned_account: normalizeId(report.getIn(['assigned_account', 'id'])),
statuses: report.get('statuses').map((status: any) => normalizeId(status.get('id'))),
statuses: report.get('statuses').map((status: any) => normalizeId(status.id)),
}) as ReducerAdminReport; }) as ReducerAdminReport;
}; };

View File

@ -32,7 +32,7 @@ export default function listAdderReducer(state: State = ReducerRecord(), action:
return ReducerRecord(); return ReducerRecord();
case LIST_ADDER_SETUP: case LIST_ADDER_SETUP:
return state.withMutations(map => { return state.withMutations(map => {
map.set('accountId', action.account.get('id')); map.set('accountId', action.account.id);
}); });
case LIST_ADDER_LISTS_FETCH_REQUEST: case LIST_ADDER_LISTS_FETCH_REQUEST:
return state.setIn(['lists', 'isLoading'], true); return state.setIn(['lists', 'isLoading'], true);

View File

@ -10,7 +10,7 @@ export const makeEmojiMap = (emojis: any) => emojis.reduce((obj: any, emoji: any
/** Normalize entity ID */ /** Normalize entity ID */
export const normalizeId = (id: any): string | null => { export const normalizeId = (id: any): string | null => {
return typeof id === 'string' ? id : null; return z.string().nullable().catch(null).parse(id);
}; };
export type Normalizer<V, R> = (value: V) => R; export type Normalizer<V, R> = (value: V) => R;