Fetch "am I" list at startup.

This is the list of channels that authorized me as a moderator.

Similar to `moderation.BlockList`, this will only be fetched at startup/reload for now. I don't think there is a need to constantly monitor this. Users just need to refresh to see the moderator GUI elements after the delegator has granted them access.
This commit is contained in:
infinite-persistence 2021-06-04 14:43:36 +08:00 committed by jessopb
parent b4b45ffbdc
commit 60780db94b
2 changed files with 5 additions and 2 deletions

View file

@ -34,7 +34,7 @@ import {
doSetActiveChannel,
doSetIncognito,
} from 'redux/actions/app';
import { doFetchModBlockedList } from 'redux/actions/comments';
import { doFetchModBlockedList, doFetchCommentModAmIList } from 'redux/actions/comments';
import App from './view';
const select = (state) => ({
@ -72,6 +72,7 @@ const perform = (dispatch) => ({
setIncognito: () => dispatch(doSetIncognito()),
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
resolveUris: (uris) => dispatch(doResolveUris(uris)),
fetchModAmIList: () => dispatch(doFetchCommentModAmIList()),
});
export default hot(connect(select, perform)(App));

View file

@ -80,7 +80,6 @@ type Props = {
isAuthenticated: boolean,
socketConnect: () => void,
syncLoop: (?boolean) => void,
syncEnabled: boolean,
currentModal: any,
syncFatalError: boolean,
activeChannelClaim: ?ChannelClaim,
@ -90,6 +89,7 @@ type Props = {
setIncognito: (boolean) => void,
fetchModBlockedList: () => void,
resolveUris: (Array<string>) => void,
fetchModAmIList: () => void,
};
function App(props: Props) {
@ -124,6 +124,7 @@ function App(props: Props) {
fetchModBlockedList,
resolveUris,
subscriptions,
fetchModAmIList,
} = props;
const appRef = useRef();
@ -261,6 +262,7 @@ function App(props: Props) {
if (hasMyChannels) {
fetchModBlockedList();
fetchModAmIList();
}
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setActiveChannelIfNotSet, setIncognito]);