jbilcke-hf HF staff commited on
Commit
99dcdd2
1 Parent(s): ee69336

now like detection works

Browse files
Files changed (1) hide show
  1. src/app/server/actions/stats.ts +3 -3
src/app/server/actions/stats.ts CHANGED
@@ -87,10 +87,10 @@ export async function getVideoRating(videoId: string, apiKey?: string): Promise<
87
  const credentials = { accessToken: apiKey }
88
 
89
  const user = await whoAmI({ credentials }) as unknown as WhoAmIUser
90
- const isLiked = await redis.get(`users:${user.id}:tastes:videos:${videoId}`)
91
  if (isLiked !== null) {
92
- isLikedByUser = Boolean(isLiked)
93
- isDislikedByUser = !isLikedByUser
94
  }
95
  } catch (err) {
96
  console.error("failed to get user like status")
 
87
  const credentials = { accessToken: apiKey }
88
 
89
  const user = await whoAmI({ credentials }) as unknown as WhoAmIUser
90
+ const isLiked = await redis.get<boolean>(`users:${user.id}:activity:videos:${videoId}:liked`)
91
  if (isLiked !== null) {
92
+ isLikedByUser = !!isLiked
93
+ isDislikedByUser = !isLiked
94
  }
95
  } catch (err) {
96
  console.error("failed to get user like status")