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 Redis from './redis';
|
||||||
import setMinBrowserVersions from './minBrowserVersion';
|
import setMinBrowserVersions from './minBrowserVersion';
|
||||||
import userLeaving from '/imports/api/users/server/methods/userLeaving';
|
import userLeaving from '/imports/api/users/server/methods/userLeaving';
|
||||||
|
import { check } from 'meteor/check';
|
||||||
|
|
||||||
const parse = Npm.require('url').parse;
|
const parse = Npm.require('url').parse;
|
||||||
const AVAILABLE_LOCALES = fs.readdirSync('assets/app/locales');
|
const AVAILABLE_LOCALES = fs.readdirSync('assets/app/locales');
|
||||||
@ -147,8 +148,18 @@ WebApp.connectHandlers.use('/feedback', (req, res) => {
|
|||||||
meetingId,
|
meetingId,
|
||||||
userId,
|
userId,
|
||||||
authToken,
|
authToken,
|
||||||
|
userName: reqUserName,
|
||||||
|
comment,
|
||||||
|
rating,
|
||||||
} = body;
|
} = body;
|
||||||
|
|
||||||
|
check(meetingId, String);
|
||||||
|
check(userId, String);
|
||||||
|
check(authToken, String);
|
||||||
|
check(reqUserName, String);
|
||||||
|
check(comment, String);
|
||||||
|
check(rating, Number);
|
||||||
|
|
||||||
const user = Users.findOne({
|
const user = Users.findOne({
|
||||||
meetingId,
|
meetingId,
|
||||||
userId,
|
userId,
|
||||||
@ -157,24 +168,19 @@ WebApp.connectHandlers.use('/feedback', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
Logger.error(`Feedback failed, user with id=${userId} wasn't found`);
|
Logger.warn('Couldn\'t find user for feedback');
|
||||||
res.setHeader('Content-Type', 'application/json');
|
|
||||||
res.writeHead(500);
|
|
||||||
res.end(JSON.stringify({ status: 'ok' }));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const feedback = {
|
|
||||||
userName: user.name,
|
|
||||||
...body,
|
|
||||||
};
|
|
||||||
Logger.info('FEEDBACK LOG:', feedback);
|
|
||||||
}));
|
|
||||||
|
|
||||||
req.on('end', Meteor.bindEnvironment(() => {
|
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.setHeader('Content-Type', 'application/json');
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
res.end(JSON.stringify({ status: 'ok' }));
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { fullname } = Auth.credentials;
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
rating: selected,
|
rating: selected,
|
||||||
userId: Auth.userID,
|
userId: Auth.userID,
|
||||||
|
userName: fullname,
|
||||||
authToken: Auth.token,
|
authToken: Auth.token,
|
||||||
meetingId: Auth.meetingID,
|
meetingId: Auth.meetingID,
|
||||||
comment: MeetingEnded.getComment(),
|
comment: MeetingEnded.getComment(),
|
||||||
|
Loading…
Reference in New Issue
Block a user