- if (!!req.body.offlineOpp) //TODO: refresh this...
- UserModel.tryNotify(req.body.offlineOpp, "New move in game " + gid);
+ // Notify opponent if he enabled notifications:
+ GameModel.getPlayers(gid, (err2,players) => {
+ if (!!err2)
+ return res.json(err);
+ const oppid = (players[0].id == req.userId ? players[1].id : players[0].id);
+ UserModel.tryNotify(oppid,
+ "New move in game: " + params.siteURL + "/game/" + gid);
+ });