Browse Source

Fixed issue where you couldn't play playlists and you couldn't see which playlists were playing.

KrisVos130 7 years ago
parent
commit
6448675bd2
1 changed files with 11 additions and 4 deletions
  1. 11 4
      frontend/app/js/views/Station/Views/Playlists/PlaylistItem.jsx

+ 11 - 4
frontend/app/js/views/Station/Views/Playlists/PlaylistItem.jsx

@@ -8,9 +8,16 @@ import { openOverlay2 } from "actions/stationOverlay";
 import io from "io";
 
 @connect(state => ({
+	user: {
+		loggedIn: state.session.get("loggedIn"),
+		userId: state.session.get("userId"),
+		role: state.session.get("role"),
+	},
 	station: {
 		stationId: state.station.info.get("stationId"),
+		ownerId: state.station.info.get("ownerId"),
 		mode: state.station.info.get("mode"),
+		privatePlaylist: state.station.info.get("privatePlaylist"),
 	},
 }))
 export default class PlaylistItem extends Component {
@@ -19,15 +26,15 @@ export default class PlaylistItem extends Component {
 	}
 
 	isOwner = () => {
-		if (this.props.loggedIn) {
-			if (this.props.user.userId === this.props.stationOwner) return true;
+		if (this.props.user.loggedIn) {
+			if (this.props.user.userId === this.props.station.ownerId) return true;
 		}
 
 		return false;
 	};
 
 	playPlaylist = (playlistId) => {
-		this.messages.clearErrorSuccess();
+		//this.messages.clearErrorSuccess();
 		io.getSocket((socket) => {
 			socket.emit("stations.selectPrivatePlaylist", this.props.station.stationId, playlistId, (res) => {
 				if (res.status === "success") {
@@ -46,7 +53,7 @@ export default class PlaylistItem extends Component {
 				//const stop = <span onClick={ () => { this.stopPlaylist(playlistId) } }>STOP!</span>;
 				const stop = null; // There's currently no backend functionality to stop a playlist from playing
 
-				if (this.props.privatePlaylist === playlistId) return stop;
+				if (this.props.station.privatePlaylist === playlistId) return stop;
 				else return play;
 			}
 		}