Disallow commenting if failed to determine if commented before.

If we can't confirm that user has not used another channel to comment, then don't allow commenting at all. Otherwise, there's no point doing the check.
This commit is contained in:
infinite-persistence 2022-05-06 14:13:58 +08:00 committed by Thomas Zarebczan
parent 2bdae7637b
commit 3bb7e21d3c

View file

@ -284,11 +284,16 @@ export function doFetchMyCommentedChannels(claimId: ?string) {
// $FlowFixMe // $FlowFixMe
return Promise.allSettled(params.map((p) => Comments.comment_list(p))) return Promise.allSettled(params.map((p) => Comments.comment_list(p)))
.then((response) => { .then((response) => {
response.forEach((res, i) => { for (let i = 0; i < response.length; ++i) {
if (res.status === 'fulfilled' && res.value.total_items > 0) { if (response[i].status !== 'fulfilled') {
// Meaningless if it couldn't confirm history for all own channels.
return;
}
if (response[i].value.total_items > 0) {
commentedChannelIds.push(params[i].author_claim_id); commentedChannelIds.push(params[i].author_claim_id);
} }
}); }
dispatch({ dispatch({
type: ACTIONS.COMMENT_FETCH_MY_COMMENTED_CHANNELS_COMPLETE, type: ACTIONS.COMMENT_FETCH_MY_COMMENTED_CHANNELS_COMPLETE,