mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2024-11-26 22:30:25 +00:00
[bugfix/frontend] Fix 'steal this look' emoji promise mapping (#2270)
* [bugfix/frontend] Fix 'steal this look' emoji promise mapping * indent a bit nicer
This commit is contained in:
parent
637f188ebe
commit
0dfb26097d
1 changed files with 26 additions and 17 deletions
|
@ -169,10 +169,10 @@ const extended = gtsApi.injectEndpoints({
|
|||
|
||||
// Search for each listed emoji with the admin
|
||||
// api to get the version that includes an ID.
|
||||
const withIDs: CustomEmoji[] = [];
|
||||
const errors: FetchBaseQueryError[] = [];
|
||||
|
||||
withoutIDs.forEach(async(emoji) => {
|
||||
const withIDs: CustomEmoji[] = (
|
||||
await Promise.all(
|
||||
withoutIDs.map(async(emoji) => {
|
||||
// Request admin view of this emoji.
|
||||
const emojiRes = await fetchWithBQ({
|
||||
url: `/api/v1/admin/custom_emojis`,
|
||||
|
@ -181,12 +181,21 @@ const extended = gtsApi.injectEndpoints({
|
|||
limit: 1
|
||||
}
|
||||
});
|
||||
|
||||
if (emojiRes.error) {
|
||||
// Put error in separate array so
|
||||
// the null can be filtered nicely.
|
||||
errors.push(emojiRes.error);
|
||||
} else {
|
||||
// Got it!
|
||||
withIDs.push(emojiRes.data as CustomEmoji);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Got it!
|
||||
return emojiRes.data as CustomEmoji;
|
||||
})
|
||||
)
|
||||
).flatMap((emoji) => {
|
||||
// Remove any nulls.
|
||||
return emoji || [];
|
||||
});
|
||||
|
||||
if (errors.length !== 0) {
|
||||
|
|
Loading…
Reference in a new issue