Fix moderator data misalignment. (#7139)
## Issue Closes 7121 Missing mod block option (large number of moderated channels?) ## Notes It was bad to assume `channelSignatures` would be the same length as the promise result -- any failure in signing would cause a misalignment. For my case, an accidentally-merged channel couldn't be signed due to a missing private key. I think it's the same for Drew.
This commit is contained in:
parent
fcea4005eb
commit
63fd867757
1 changed files with 10 additions and 14 deletions
|
@ -21,6 +21,7 @@ import { doAlertWaitingForSync } from 'redux/actions/app';
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV !== 'production';
|
const isDev = process.env.NODE_ENV !== 'production';
|
||||||
const FETCH_API_FAILED_TO_FETCH = 'Failed to fetch';
|
const FETCH_API_FAILED_TO_FETCH = 'Failed to fetch';
|
||||||
|
const PROMISE_FULFILLED = 'fulfilled';
|
||||||
|
|
||||||
declare type CommentronErrorMap = {
|
declare type CommentronErrorMap = {
|
||||||
[string]: {
|
[string]: {
|
||||||
|
@ -1377,9 +1378,7 @@ export function doFetchCommentModAmIList(channelClaim: ChannelClaim) {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const myChannels = selectMyChannelClaims(state);
|
const myChannels = selectMyChannelClaims(state);
|
||||||
|
|
||||||
dispatch({
|
dispatch({ type: ACTIONS.COMMENT_MODERATION_AM_I_LIST_STARTED });
|
||||||
type: ACTIONS.COMMENT_MODERATION_AM_I_LIST_STARTED,
|
|
||||||
});
|
|
||||||
|
|
||||||
let channelSignatures = [];
|
let channelSignatures = [];
|
||||||
|
|
||||||
|
@ -1399,13 +1398,13 @@ export function doFetchCommentModAmIList(channelClaim: ChannelClaim) {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((results) => {
|
||||||
const delegatorsById = {};
|
const delegatorsById = {};
|
||||||
|
|
||||||
channelSignatures.forEach((chanSig, index) => {
|
results.forEach((result, index) => {
|
||||||
if (chanSig && res[index]) {
|
if (result.status === PROMISE_FULFILLED) {
|
||||||
const value = res[index].value;
|
const value = result.value;
|
||||||
delegatorsById[chanSig.claim_id] = {
|
delegatorsById[value.channel_id] = {
|
||||||
global: value ? value.type === 'Global' : false,
|
global: value ? value.type === 'Global' : false,
|
||||||
delegators: value && value.authorized_channels ? value.authorized_channels : {},
|
delegators: value && value.authorized_channels ? value.authorized_channels : {},
|
||||||
};
|
};
|
||||||
|
@ -1418,15 +1417,12 @@ export function doFetchCommentModAmIList(channelClaim: ChannelClaim) {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
dispatch({
|
devToast(dispatch, `AmI: ${err}`);
|
||||||
type: ACTIONS.COMMENT_MODERATION_AM_I_LIST_FAILED,
|
dispatch({ type: ACTIONS.COMMENT_MODERATION_AM_I_LIST_FAILED });
|
||||||
});
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
dispatch({
|
dispatch({ type: ACTIONS.COMMENT_MODERATION_AM_I_LIST_FAILED });
|
||||||
type: ACTIONS.COMMENT_MODERATION_AM_I_LIST_FAILED,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue