From 2a3fb705d0296266e3cd7e9976a47459c69653a9 Mon Sep 17 00:00:00 2001 From: izexi <43889168+izexi@users.noreply.github.com> Date: Wed, 28 Aug 2019 10:13:09 +0100 Subject: [PATCH] fix(ChannelStore): return existing DMChannels within add() (#3438) * fix: return existing DMChannels * ref: group nested conditions --- src/stores/ChannelStore.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stores/ChannelStore.js b/src/stores/ChannelStore.js index d0e1caa77..762f0e193 100644 --- a/src/stores/ChannelStore.js +++ b/src/stores/ChannelStore.js @@ -54,9 +54,9 @@ class ChannelStore extends DataStore { add(data, guild, cache = true) { const existing = this.get(data.id); - if (existing && existing._patch && cache) existing._patch(data); - if (existing && guild) { - guild.channels.add(existing); + if (existing) { + if (existing._patch && cache) existing._patch(data); + if (guild) guild.channels.add(existing); return existing; }