Skip to content

Commit

Permalink
fix(ChannelDelete): mark messages of a deleted channel as deleted (#3572
Browse files Browse the repository at this point in the history
)
  • Loading branch information
SpaceEEC authored Jan 5, 2020
1 parent 367c800 commit d1d0d75
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/client/actions/ChannelDelete.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Action = require('./Action');
const DMChannel = require('../../structures/DMChannel');

class ChannelDeleteAction extends Action {
constructor(client) {
Expand All @@ -17,7 +18,14 @@ class ChannelDeleteAction extends Action {
} else {
channel = this.deleted.get(data.id) || null;
}
if (channel) channel.deleted = true;
if (channel) {
if (channel.messages && !(channel instanceof DMChannel)) {
for (const message of channel.messages.values()) {
message.deleted = true;
}
}
channel.deleted = true;
}

return { channel };
}
Expand Down

0 comments on commit d1d0d75

Please # to comment.