mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 06:22:25 -05: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,24 +169,33 @@ const extended = gtsApi.injectEndpoints({ | ||||||
| 
 | 
 | ||||||
| 				// Search for each listed emoji with the admin
 | 				// Search for each listed emoji with the admin
 | ||||||
| 				// api to get the version that includes an ID.
 | 				// api to get the version that includes an ID.
 | ||||||
| 				const withIDs: CustomEmoji[] = []; |  | ||||||
| 				const errors: FetchBaseQueryError[] = []; | 				const errors: FetchBaseQueryError[] = []; | ||||||
|  | 				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`, | ||||||
|  | 								params: { | ||||||
|  | 									filter: `domain:${domain},shortcode:${emoji.shortcode}`, | ||||||
|  | 									limit: 1 | ||||||
|  | 								} | ||||||
|  | 							}); | ||||||
| 						 | 						 | ||||||
| 				withoutIDs.forEach(async(emoji) => { | 							if (emojiRes.error) { | ||||||
| 					// Request admin view of this emoji.
 | 								// Put error in separate array so
 | ||||||
| 					const emojiRes = await fetchWithBQ({ | 								// the null can be filtered nicely.
 | ||||||
| 						url: `/api/v1/admin/custom_emojis`, | 								errors.push(emojiRes.error); | ||||||
| 						params: { | 								return null; | ||||||
| 							filter: `domain:${domain},shortcode:${emoji.shortcode}`, | 							} | ||||||
| 							limit: 1 | 							 | ||||||
| 						} | 							// Got it!
 | ||||||
| 					}); | 							return emojiRes.data as CustomEmoji; | ||||||
| 					if (emojiRes.error) { | 						}) | ||||||
| 						errors.push(emojiRes.error); | 					) | ||||||
| 					} else { | 				).flatMap((emoji) => { | ||||||
| 						// Got it!
 | 					// Remove any nulls.
 | ||||||
| 						withIDs.push(emojiRes.data as CustomEmoji); | 					return emoji || []; | ||||||
| 					} |  | ||||||
| 				}); | 				}); | ||||||
| 
 | 
 | ||||||
| 				if (errors.length !== 0) { | 				if (errors.length !== 0) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue