Fix remote timeline pages
This commit is contained in:
parent
3b630ed8fb
commit
17bcd68d73
2 changed files with 5 additions and 8 deletions
|
@ -8,10 +8,8 @@ import { useInstance } from 'soapbox/hooks';
|
|||
import type { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
const hasRestrictions = (remoteInstance: ImmutableMap<string, any>): boolean => {
|
||||
return remoteInstance
|
||||
.get('federation')
|
||||
.deleteAll(['accept', 'reject_deletes', 'report_removal'])
|
||||
.reduce((acc: boolean, value: boolean) => acc || value, false);
|
||||
const { accept, reject_deletes, report_removal, ...federation } = remoteInstance.get('federation');
|
||||
return !!Object.values(federation).reduce((acc, value) => Boolean(acc || value), false);
|
||||
};
|
||||
|
||||
interface IRestriction {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { Map as ImmutableMap } from 'immutable';
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||
|
||||
|
@ -31,10 +30,10 @@ const EditFederationModal: React.FC<IEditFederationModal> = ({ host, onClose })
|
|||
const getRemoteInstance = useCallback(makeGetRemoteInstance(), []);
|
||||
const remoteInstance = useAppSelector(state => getRemoteInstance(state, host));
|
||||
|
||||
const [data, setData] = useState(ImmutableMap<string, any>());
|
||||
const [data, setData] = useState({} as any);
|
||||
|
||||
useEffect(() => {
|
||||
setData(remoteInstance.get('federation') as any);
|
||||
setData(remoteInstance.get('federation'));
|
||||
}, [remoteInstance]);
|
||||
|
||||
const handleDataChange = (key: string): React.ChangeEventHandler<HTMLInputElement> => {
|
||||
|
@ -69,7 +68,7 @@ const EditFederationModal: React.FC<IEditFederationModal> = ({ host, onClose })
|
|||
media_nsfw,
|
||||
media_removal,
|
||||
reject,
|
||||
} = data.toJS() as Record<string, boolean>;
|
||||
} = data;
|
||||
|
||||
const fullMediaRemoval = avatar_removal && banner_removal && media_removal;
|
||||
|
||||
|
|
Loading…
Reference in a new issue