Explorar o código

Disabled ratings.

KrisVos130 %!s(int64=8) %!d(string=hai) anos
pai
achega
9591f2998e
Modificáronse 2 ficheiros con 9 adicións e 1 borrados
  1. 4 0
      backend/logic/actions/songs.js
  2. 5 1
      frontend/components/pages/Home.vue

+ 4 - 0
backend/logic/actions/songs.js

@@ -106,6 +106,7 @@ module.exports = {
 	}),
 
 	like: hooks.loginRequired((session, songId, cb, userId) => {
+		return cb({ status: 'failure', message: 'Ratings are currently disabled.' });
 		db.models.user.findOne({ _id: userId }, (err, user) => {
 			if (user.liked.indexOf(songId) !== -1) return cb({ status: 'failure', message: 'You have already liked this song.' });
 			let dislikes = 0;
@@ -128,6 +129,7 @@ module.exports = {
 	}),
 
 	dislike: hooks.loginRequired((session, songId, cb, userId) => {
+		return cb({ status: 'failure', message: 'Ratings are currently disabled.' });
 		db.models.user.findOne({_id: userId}, (err, user) => {
 			if (user.disliked.indexOf(songId) !== -1) return cb({ status: 'failure', message: 'You have already disliked this song.' });
 			let likes = 0;
@@ -150,6 +152,7 @@ module.exports = {
 	}),
 
 	undislike: hooks.loginRequired((session, songId, cb, userId) => {
+		return cb({ status: 'failure', message: 'Ratings are currently disabled.' });
 		db.models.user.findOne({_id: userId}, (err, user) => {
 			if (user.disliked.indexOf(songId) === -1) return cb({ status: 'failure', message: 'You have not disliked this song.' });
 			db.models.song.update({_id: songId}, {$inc: {dislikes: -1}}, (err) => {
@@ -170,6 +173,7 @@ module.exports = {
 	}),
 
 	unlike: hooks.loginRequired((session, songId, cb, userId) => {
+		return cb({ status: 'failure', message: 'Ratings are currently disabled.' });
 		db.models.user.findOne({_id: userId}, (err, user) => {
 			if (user.liked.indexOf(songId) === -1) return cb({ status: 'failure', message: 'You have not liked this song.' });
 			db.models.song.update({_id: songId}, {$inc: {likes: -1}}, (err) => {

+ 5 - 1
frontend/components/pages/Home.vue

@@ -49,7 +49,7 @@
 				<div v-if="station.privacy !== 'public'" title="This station is not visible to other users." class="station-status">
 					<i class='material-icons'>lock</i>
 				</div>
-				<div v-if="station.owner === userId && station.privacy === 'public'" title="This is your station." class="station-status">
+				<div v-if="isOwner(station)" title="This is your station." class="station-status">
 					<i class='material-icons'>home</i>
 				</div>
 			</div>
@@ -134,6 +134,10 @@
 					_this.socket.emit("apis.joinRoom", 'home', () => {
 					});
 				});
+			},
+			isOwner: function(station) {
+				let _this = this;
+				return station.owner === _this.$parent.userId && station.privacy === 'public';
 			}
 		},
 		components: { MainHeader, MainFooter }