v3: start cleaning up TODO comemnts

This commit is contained in:
Matteo Pagliazzi
2016-05-06 20:24:53 +02:00
parent b687a6bf9d
commit afb7d1d627
21 changed files with 40 additions and 43 deletions

View File

@@ -12,6 +12,7 @@ import _ from 'lodash';
import { removeFromArray } from '../../libs/api-v3/collectionManipulators';
import { sendTxn } from '../../libs/api-v3/email';
import nconf from 'nconf';
import Q from 'q';
const FLAG_REPORT_EMAILS = nconf.get('FLAG_REPORT_EMAIL').split(',').map((email) => {
return { email, canSend: true };
@@ -87,12 +88,14 @@ api.postChat = {
group.sendChat(req.body.message, user);
let toSave = [group.save()];
if (group.type === 'party') {
user.party.lastMessageSeen = group.chat[0].id;
user.save(); // TODO why this is non-blocking? must catch?
toSave.push(user.save());
}
let savedGroup = await group.save();
let [savedGroup] = await Q.all(toSave);
if (chatUpdated) {
res.respond(200, {chat: Group.toJSONCleanChat(savedGroup, user).chat});
} else {