feat: fix likes
This commit is contained in:
@@ -29,7 +29,7 @@ const Playback = ({ route, navigation }) => {
|
||||
|
||||
return (
|
||||
<Page headerType="NONE" backgroundImg={isWeb ? background.playbackWeb : background.playbackMobile}>
|
||||
<Image source={ai.theo} style={styles.img} resizeMode="contain" />
|
||||
{/* <Image source={ai.theo} style={styles.img} resizeMode="contain" /> */}
|
||||
<MusicLandHeader
|
||||
onPressBack={() => navigation.navigate(Routes.Home)}
|
||||
progress={25}
|
||||
|
||||
+7
-15
@@ -76,30 +76,22 @@ export const toggleProjectLike = async ({
|
||||
[likeFieldKey]: likeOperation,
|
||||
...(likedAtKey && currentUID
|
||||
? {
|
||||
[likedAtKey]: {
|
||||
[currentUID]: next ? serverTimestamp() : deleteField(),
|
||||
},
|
||||
}
|
||||
[likedAtKey]: {
|
||||
[currentUID]: next ? serverTimestamp() : deleteField(),
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
};
|
||||
const cleanupPayload =
|
||||
target === LIKE_TARGET.PLAYBACK
|
||||
? {
|
||||
// Remove any malformed top-level "likes.playback" key if it exists
|
||||
["likes.playback"]: deleteField(),
|
||||
}
|
||||
: {};
|
||||
await projectsRef.doc(projectId).set(
|
||||
{
|
||||
...(target === LIKE_TARGET.SONG
|
||||
? {
|
||||
// Keep legacy likedBy in sync for clients still reading this field
|
||||
likedBy: next ? arrayUnion(currentUID) : arrayRemove(currentUID),
|
||||
}
|
||||
// Keep legacy likedBy in sync for clients still reading this field
|
||||
likedBy: next ? arrayUnion(currentUID) : arrayRemove(currentUID),
|
||||
}
|
||||
: {}),
|
||||
...likesPayload,
|
||||
...cleanupPayload,
|
||||
},
|
||||
{ merge: true }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user