Quellcode durchsuchen

Fixed some more issues with Reports

theflametrooper vor 8 Jahren
Ursprung
Commit
7cde10510b
2 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 4 4
      backend/logic/actions/reports.js
  2. 2 0
      frontend/components/Admin/Reports.vue

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

@@ -93,12 +93,12 @@ module.exports = {
 	resolve: hooks.adminRequired((session, reportId, cb, userId) => {
 		async.waterfall([
 			(next) => {
-				db.models.report.findOne({ _id: reportId }).sort({ released: 'desc' }).exec(next);
+				db.models.report.findOne({ _id: reportId }).exec(next);
 			},
 
 			(report, next) => {
 				if (!report) return next('Report not found.');
-				db.models.update({ _id: reportId }, next);
+				report.update({ _id: reportId }, next);
 			}
 		], (err) => {
 			if (err) {
@@ -135,10 +135,10 @@ module.exports = {
 					if (reportableIssues.filter(issue => { return issue.name == data.issues[z].name; }).length > 0) {
 						for (let r = 0; r < reportableIssues.length; r++) {
 							if (reportableIssues[r].reasons.every(reason => data.issues[z].reasons.indexOf(reason) < -1)) {
-								return cb({ 'status': 'failure', 'message': 'Invalid data' });
+								return cb({ status: 'failure', message: 'Invalid data' });
 							}
 						}
-					} else return cb({ 'status': 'failure', 'message': 'Invalid data' });
+					} else return cb({ status: 'failure', message: 'Invalid data' });
 				}
 
 				next();

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

@@ -60,8 +60,10 @@
 				if (this.modals.reportIssues) this.editing = report;
 			},
 			resolve: function (reportId) {
+				let _this = this;
 				this.socket.emit('reports.resolve', reportId, res => {
 					Toast.methods.addToast(res.message, 3000);
+					if (res.status == 'success' && this.modals.reportIssues) _this.toggleModal();
 				});
 			}
 		},