fix(route/threads): Handle getting a number back from the cache (#19958)

This commit is contained in:
Thomas 2025-09-04 00:45:36 +02:00 committed by GitHub
parent f969f638c7
commit 2145a1dd4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -78,10 +78,14 @@ const getUserId = (user: string): Promise<string> =>
throw new NotFoundError('User ID not found');
})
.then((result): string => {
if (!result || typeof result !== 'string') {
throw new TypeError('Invalid user ID type');
if (result) {
if (typeof result === 'string') {
return result;
} else if (typeof result === 'number') {
return result.toString();
}
}
return result;
throw new TypeError('Invalid user ID type');
});
const hasMedia = (post) => post.image_versions2 || post.carousel_media || post.video_versions;