Applied style rules to genocide all \t characters

This commit is contained in:
Stefan Zermatten
2022-10-09 16:01:36 +02:00
parent de598c70a7
commit 2fa913b09a
208 changed files with 6027 additions and 5801 deletions

View File

@@ -6,24 +6,24 @@ import getRootCreatureAncestor from '/imports/api/creature/creatureProperties/ge
const flipToggle = new ValidatedMethod({
name: 'creatureProperties.flipToggle',
validate({_id}){
if (!_id) throw new Meteor.Error('No _id', '_id is required');
validate({ _id }) {
if (!_id) throw new Meteor.Error('No _id', '_id is required');
},
mixins: [RateLimiterMixin],
rateLimit: {
numRequests: 5,
timeInterval: 5000,
},
run({_id}) {
run({ _id }) {
// Permission
let property = CreatureProperties.findOne(_id, {
fields: {type: 1, ancestors: 1, enabled: 1, disabled: 1}
fields: { type: 1, ancestors: 1, enabled: 1, disabled: 1 }
});
if (property.type !== 'toggle'){
if (property.type !== 'toggle') {
throw new Meteor.Error('wrong property',
'This method can only be applied to toggles');
}
if (!property.enabled && !property.disabled){
if (!property.enabled && !property.disabled) {
throw new Meteor.Error('Computed toggle',
'Can\'t flip a toggle that is computed')
}
@@ -32,13 +32,15 @@ const flipToggle = new ValidatedMethod({
// Invert the current value, disabled is the canonical store of value
const currentValue = !property.disabled;
CreatureProperties.update(_id, {$set: {
enabled: !currentValue,
disabled: currentValue,
dirty: true,
}}, {
selector: {type: 'toggle'},
});
CreatureProperties.update(_id, {
$set: {
enabled: !currentValue,
disabled: currentValue,
dirty: true,
}
}, {
selector: { type: 'toggle' },
});
},
});