Merge pull request #7767 from diegobenetti/issue7751-feedback-errors
Fixes exception in meteor log when the meeting is ended
This commit is contained in:
commit
6e09b836b8
@ -9,6 +9,7 @@ import Logger from './logger';
|
||||
import Redis from './redis';
|
||||
import setMinBrowserVersions from './minBrowserVersion';
|
||||
import userLeaving from '/imports/api/users/server/methods/userLeaving';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
const parse = Npm.require('url').parse;
|
||||
const AVAILABLE_LOCALES = fs.readdirSync('assets/app/locales');
|
||||
@ -147,8 +148,18 @@ WebApp.connectHandlers.use('/feedback', (req, res) => {
|
||||
meetingId,
|
||||
userId,
|
||||
authToken,
|
||||
userName: reqUserName,
|
||||
comment,
|
||||
rating,
|
||||
} = body;
|
||||
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
check(authToken, String);
|
||||
check(reqUserName, String);
|
||||
check(comment, String);
|
||||
check(rating, Number);
|
||||
|
||||
const user = Users.findOne({
|
||||
meetingId,
|
||||
userId,
|
||||
@ -157,24 +168,19 @@ WebApp.connectHandlers.use('/feedback', (req, res) => {
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
Logger.error(`Feedback failed, user with id=${userId} wasn't found`);
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.writeHead(500);
|
||||
res.end(JSON.stringify({ status: 'ok' }));
|
||||
return;
|
||||
Logger.warn('Couldn\'t find user for feedback');
|
||||
}
|
||||
|
||||
const feedback = {
|
||||
userName: user.name,
|
||||
...body,
|
||||
};
|
||||
Logger.info('FEEDBACK LOG:', feedback);
|
||||
}));
|
||||
|
||||
req.on('end', Meteor.bindEnvironment(() => {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.writeHead(200);
|
||||
res.end(JSON.stringify({ status: 'ok' }));
|
||||
|
||||
body.userName = user ? user.name : `[unconfirmed] ${reqUserName}`;
|
||||
|
||||
const feedback = {
|
||||
...body,
|
||||
};
|
||||
Logger.info('FEEDBACK LOG:', feedback);
|
||||
}));
|
||||
});
|
||||
|
||||
|
@ -125,9 +125,12 @@ class MeetingEnded extends React.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const { fullname } = Auth.credentials;
|
||||
|
||||
const message = {
|
||||
rating: selected,
|
||||
userId: Auth.userID,
|
||||
userName: fullname,
|
||||
authToken: Auth.token,
|
||||
meetingId: Auth.meetingID,
|
||||
comment: MeetingEnded.getComment(),
|
||||
|
Loading…
Reference in New Issue
Block a user