X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=server%2Fmodels%2FChallenge.js;h=fabeb7aeca79989a0511b22dfe6f2e8cea3c05c7;hp=7ccaa76fbf135bcf64a24c2c9906a9e535e1ca07;hb=fe4c7e67075416c48aafe9e307bef5afea7937bc;hpb=cf7fac89918e50d8c93f9a09842c9eb53e8841d6 diff --git a/server/models/Challenge.js b/server/models/Challenge.js index 7ccaa76f..fabeb7ae 100644 --- a/server/models/Challenge.js +++ b/server/models/Challenge.js @@ -56,14 +56,17 @@ const ChallengeModel = }); }, - // All challenges except where target is defined and not me + // All challenges except where target is defined and not me, + // and I'm not the sender. getByUser: function(uid, cb) { db.serialize(function() { const query = "SELECT * " + "FROM Challenges " + - "WHERE target IS NULL OR target = " + uid; + "WHERE target IS NULL" + + " OR uid = " + uid + + " OR target = " + uid; db.all(query, (err,challenges) => { return cb(err, challenges); });