Browse Source

Some fixes to Reports

theflametrooper 8 years ago
parent
commit
f76695f42b

+ 0 - 2
backend/logic/actions/queueSongs.js

@@ -10,9 +10,7 @@ const request = require('request');
 const hooks = require('./hooks');
 
 cache.sub('queue.newSong', songId => {
-	console.log(123321);
 	db.models.queueSong.findOne({_id: songId}, (err, song) => {
-		console.log(err, song);
 		utils.emitToRoom('admin.queue', 'event:admin.queueSong.added', song);
 	});
 });

+ 1 - 1
backend/logic/actions/reports.js

@@ -32,7 +32,7 @@ module.exports = {
 			(next) => {
 				songs.getSong(data.songId, (err, song) => {
 					if (err) return next(err);
-					if (!song) return next('Song does not exist in our Database.');
+					if (!song) return next('Song does not exist in our Database');
 					next();
 				});
 			},

+ 1 - 3
backend/logic/stations.js

@@ -235,9 +235,7 @@ module.exports = {
 																		thumbnail: song.thumbnail
 																	};
 																	station.playlist = newPlaylist;
-																} else {
-																	$set.currentSong = _this.defaultSong;
-																}
+																} else $set.currentSong = _this.defaultSong;
 																$set.startedAt = Date.now();
 																$set.timePaused = 0;
 																next(null, $set);

+ 4 - 0
frontend/components/Admin/Reports.vue

@@ -9,6 +9,7 @@
 						<td>Created At</td>
 						<td>Description</td>
 						<td>Issues</td>
+						<td>Options</td>
 					</tr>
 				</thead>
 				<tbody>
@@ -22,6 +23,9 @@
 						<td>
 							<span>{{ report.createdAt }}</span>
 						</td>
+						<td>
+							<span>{{ report.description }}</span>
+						</td>
 						<td>
 							<span>{{ report.issues }}</span>
 						</td>

+ 7 - 6
frontend/components/Modals/Report.vue

@@ -8,7 +8,7 @@
 			</header>
 			<section class='modal-card-body'>
 				<div class='columns song-types'>
-					<div class='column song-type' v-if='$parent.previousSong !== null && $parent.previousSong.likes !== -1 && $parent.previousSong.dislikes !== -1'>
+					<div class='column song-type' v-if='$parent.previousSong !== null'>
 						<div class='card is-fullwidth' :class="{ 'is-highlight-active': isPreviousSongActive }" @click="highlight('previousSong')">
 							<header class='card-header'>
 								<p class='card-header-title'>
@@ -35,7 +35,7 @@
 							</div>
 						</div>
 					</div>
-					<div class='column song-type' v-if='$parent.currentSong !== null && $parent.currentSong.likes !== -1 && $parent.currentSong.dislikes !== -1'>
+					<div class='column song-type' v-if='$parent.currentSong !== {}'>
 						<div class='card is-fullwidth'  :class="{ 'is-highlight-active': isCurrentSongActive }" @click="highlight('currentSong')">
 							<header class='card-header'>
 								<p class='card-header-title'>
@@ -63,8 +63,7 @@
 						</div>
 					</div>
 				</div>
-				<h4 v-if='($parent.currentSong === null || ($parent.currentSong.likes === -1 && $parent.currentSong.dislikes === -1)) && ($parent.previousSong === null || ($parent.previousSong.likes === -1 || $parent.previousSong.dislikes === -1))'>There are currently no songs to report.</h4>
-				<div class='edit-report-wrapper' v-else>
+				<div class='edit-report-wrapper'>
 					<div class='columns is-multiline'>
 						<div class='column is-half' v-for='issue in issues'>
 							<label class='label'>{{ issue.name }}</label>
@@ -84,7 +83,7 @@
 				</div>
 			</section>
 			<footer class='modal-card-foot'>
-				<a class='button is-success' @click='create()' v-if='!(($parent.currentSong === null || ($parent.currentSong.likes === -1 && $parent.currentSong.dislikes === -1)) && ($parent.previousSong === null || ($parent.previousSong.likes === -1 || $parent.previousSong.dislikes === -1)))'>
+				<a class='button is-success' @click='create()'>
 					<i class='material-icons save-changes'>done</i>
 					<span>&nbsp;Create</span>
 				</a>
@@ -163,8 +162,10 @@
 		},
 		methods: {
 			create: function () {
-				this.socket.emit('reports.create', this.report, res => {
+				let _this = this;
+				_this.socket.emit('reports.create', _this.report, res => {
 					Toast.methods.addToast(res.message, 4000);
+					if (res.status == 'success') _this.$parent.modals.report = !_this.$parent.modals.report;
 				});
 			},
 			updateCharactersRemaining: function () {

+ 1 - 1
frontend/components/Station/CommunityHeader.vue

@@ -9,7 +9,7 @@
 					<i class='material-icons'>settings</i>
 				</span>
 			</a>
-			<a v-if='$parent.$parent.loggedIn' class='nav-item' href='#' @click='$parent.modals.report = !$parent.modals.report'>
+			<a v-if='$parent.$parent.loggedIn && !$parent.noSong && !$parent.simpleSong' class='nav-item' href='#' @click='$parent.modals.report = !$parent.modals.report'>
 				<span class='icon'>
 					<i class='material-icons'>report</i>
 				</span>

+ 1 - 1
frontend/components/Station/OfficialHeader.vue

@@ -14,7 +14,7 @@
 					<i class='material-icons'>queue_music</i>
 				</span>
 			</a>
-			<a v-if='$parent.$parent.loggedIn' class='nav-item' href='#' @click='$parent.modals.report = !$parent.modals.report'>
+			<a v-if='$parent.$parent.loggedIn && !$parent.noSong' class='nav-item' href='#' @click='$parent.modals.report = !$parent.modals.report'>
 				<span class='icon'>
 					<i class='material-icons'>report</i>
 				</span>