Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Commit

Permalink
fix: bugfixes from #485
Browse files Browse the repository at this point in the history
  • Loading branch information
UnseenFaith committed Nov 11, 2018
1 parent 5f3aef6 commit c6593ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/events/coreSettingsDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ module.exports = class extends Event {
run(settings) {
if (gateways.includes(settings.gateway.name)) {
this.client.shard.broadcastEval(`
if (String(this.shard.id) === '${this.client.shard.id}') return;
const entry = this.gateways.get('${settings.gateway.name}').get('${settings.id}');
if (entry && entry.existenceStatus) {
this.emit('settingsDelete', settings);
entry.init(entry, entry.schema);
entry.existenceStatus = false;
if (String(this.shard.id) !== '${this.client.shard.id}') {
const entry = this.gateways.get('${settings.gateway.name}').get('${settings.id}');
if (entry && entry.existenceStatus) {
this.emit('settingsDelete', settings);
entry.init(entry, entry.schema);
entry.existenceStatus = false;
}
}
`);
}
Expand Down
13 changes: 7 additions & 6 deletions src/events/coreSettingsUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ module.exports = class extends Event {
run(settings) {
if (gateways.includes(settings.gateway.name)) {
this.client.shard.broadcastEval(`
if (String(this.shard.id) === '${this.client.shard.id}') return;
const entry = this.gateways.get('${settings.gateway.name}').get('${settings.id}');
if (entry) {
entry._patch(${JSON.stringify(settings)});
entry.existenceStatus = true;
this.emit('settingsSync', settings);
if (String(this.shard.id) !== '${this.client.shard.id}') {
const entry = this.gateways.get('${settings.gateway.name}').get('${settings.id}');
if (entry) {
entry._patch(${JSON.stringify(settings)});
entry.existenceStatus = true;
this.emit('settingsSync', settings);
}
}
`);
}
Expand Down

0 comments on commit c6593ee

Please sign in to comment.