Commit 0d22d4c8 authored by Cédric Moreau's avatar Cédric Moreau

Fix: missing 'multiple' flag for keys/links updates

parent 9cf59871
......@@ -131,35 +131,35 @@ KeySchema.statics.findMembersWithUpdates = function(done){
KeySchema.statics.addMember = function(fingerprint, done){
var Key = this.model('Key');
Key.update({ fingerprint: fingerprint }, { member: true }, function (err) {
Key.update({ fingerprint: fingerprint }, { member: true }, { multi: true }, function (err) {
done(err);
});
};
KeySchema.statics.removeMember = function(fingerprint, done){
var Key = this.model('Key');
Key.update({ fingerprint: fingerprint }, { member: false }, function (err) {
Key.update({ fingerprint: fingerprint }, { member: false }, { multi: true }, function (err) {
done(err);
});
};
KeySchema.statics.setKicked = function(fingerprint, distancedKeys, notEnoughLinks, done){
var Key = this.model('Key');
Key.update({ fingerprint: fingerprint }, { kick: (distancedKeys.length > 0 || notEnoughLinks), distanced: distancedKeys }, function (err) {
Key.update({ fingerprint: fingerprint }, { kick: (distancedKeys.length > 0 || notEnoughLinks), distanced: distancedKeys }, { multi: true }, function (err) {
done(err);
});
};
KeySchema.statics.unsetKicked = function(fingerprint, done){
var Key = this.model('Key');
Key.update({ fingerprint: fingerprint }, { kick: false }, function (err) {
Key.update({ fingerprint: fingerprint }, { kick: false }, { multi: true }, function (err) {
done(err);
});
};
KeySchema.statics.undistanceEveryKey = function(done){
var Key = this.model('Key');
Key.update({}, { kick: false, distanced: [] }, function (err) {
Key.update({}, { kick: false, distanced: [] }, { multi: true }, function (err) {
done(err);
});
};
......
......@@ -33,7 +33,7 @@ LinkSchema.statics.currentValidLinks = function (fpr, done) {
**/
LinkSchema.statics.obsoletes = function (minTimestamp, done) {
var Link = this.model('Link');
Link.update({ timestamp: { $lte: minTimestamp } }, { obsolete: true }, function (err) {
Link.update({ timestamp: { $lte: minTimestamp } }, { obsolete: true }, { multi: true }, function (err) {
done(err);
});
}
......@@ -43,7 +43,7 @@ LinkSchema.statics.obsoletes = function (minTimestamp, done) {
**/
LinkSchema.statics.unobsoletesAllLinks = function (done) {
var Link = this.model('Link');
Link.update({}, { obsolete: false }, function (err) {
Link.update({}, { obsolete: false }, { multi: true }, function (err) {
done(err);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment