Skip to content

Commit

Permalink
fix: broken feature after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
MAXOUXAX committed Apr 9, 2024
1 parent 8448fa1 commit 640df22
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/src/socketio/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class Room {

this.queue.push({
...track,
addedBy: "TODO", // TODO: Add the id of the user who added the track
addedBy: accountId,
votes: [],
});
if (this.queue.length !== 1) return;
Expand Down
7 changes: 4 additions & 3 deletions commons/backend-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ export interface JSONTrack {
/** An array of all genres of this song */
genres: string[];
id: string;
votes?: string[]; // array of user ids
addedBy: string;
}

export interface RoomJSONTrack extends JSONTrack {
/**
* The user id of the user who added the track to the queue
*/
addedBy: string;
votes: string[]; // array of user ids
/**
* An array of user ids of users who have voted to skip this track
*/
votes: string[];
}

export interface PlayingJSONTrack extends RoomJSONTrack {
Expand Down
6 changes: 5 additions & 1 deletion expo/app/(tabs)/rooms/[id]/add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ export default function AddTrack() {
"Les utilisateurs anonymes ne sont pas autorisés à accéder à cette fonctionnalité. Veuillez vous connecter."
);
try {
socket.emit("queue:add", new URL(url).toString(), userProfile.account_id);
socket.emit(
"queue:add",
new URL(url).toString(),
userProfile.user_profile_id
);
} catch {
setSearchBar("");
setResult(null);
Expand Down
5 changes: 2 additions & 3 deletions expo/components/room/TrackItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default function TrackItem(prop: {
handleDislike: () => void;
disliked: boolean;
addedBy: string;
accountId: string;
}) {
const {
title,
Expand Down Expand Up @@ -48,8 +47,8 @@ export default function TrackItem(prop: {
artistsName={artists}
imgUrl={rawImageUrl}
profilePictureImage={
prop.accountId ? (
<Avatar id={prop.accountId} style={itemStyles.profileImage} />
prop.addedBy ? (
<Avatar id={prop.addedBy} style={itemStyles.profileImage} />
) : (
<Image
source={require("../../assets/images/album-cover.jpg")}
Expand Down

0 comments on commit 640df22

Please sign in to comment.