+// TODO: chats deletion here, but could/should be elsewhere.
+// Moves update also could, although logical unit in a game.
+router.delete("/chats", access.logged, access.ajax, (req,res) => {
+ const gid = req.query["gid"];
+ GameModel.getPlayers(gid, (err,players) => {
+ if (players.some(p => p.uid == req.userId))
+ {
+ GameModel.update(gid, {delchat: true}, () => {
+ res.json({});
+ });
+ }
+ });
+});
+