Fix broken Comments API due to surfacing of error
## Issue The "Muted Words" PR elevated Comment-API errors so we can handle it (previously, it goes unnoticed). This broke the other Comment functions because the spammer mitigation might return an error, causing `Promise.all` to bail early. ## Fix Changed to `Promise.allSettled` and reconstructed the results. This will make it equivalent to the code prior to the "Muted Words" PR.
This commit is contained in:
parent
06c6018047
commit
f8e1274c38
1 changed files with 4 additions and 3 deletions
|
@ -537,7 +537,7 @@ export function doCommentModToggleBlock(channelUri: string, unblock: boolean = f
|
||||||
|
|
||||||
const commentAction = unblock ? Comments.moderation_unblock : Comments.moderation_block;
|
const commentAction = unblock ? Comments.moderation_unblock : Comments.moderation_block;
|
||||||
|
|
||||||
return Promise.all(
|
return Promise.allSettled(
|
||||||
channelSignatures.map((signatureData) =>
|
channelSignatures.map((signatureData) =>
|
||||||
commentAction({
|
commentAction({
|
||||||
mod_channel_id: signatureData.claim_id,
|
mod_channel_id: signatureData.claim_id,
|
||||||
|
@ -601,7 +601,7 @@ export function doFetchModBlockedList() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(
|
return Promise.allSettled(
|
||||||
channelSignatures.map((signatureData) =>
|
channelSignatures.map((signatureData) =>
|
||||||
Comments.moderation_block_list({
|
Comments.moderation_block_list({
|
||||||
mod_channel_id: signatureData.claim_id,
|
mod_channel_id: signatureData.claim_id,
|
||||||
|
@ -611,7 +611,8 @@ export function doFetchModBlockedList() {
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then((blockLists) => {
|
.then((res) => {
|
||||||
|
const blockLists = res.map((r) => r.value);
|
||||||
let globalBlockList = [];
|
let globalBlockList = [];
|
||||||
blockLists
|
blockLists
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
|
|
Loading…
Reference in a new issue