Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Message): remove usage of .deleted #7109

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ class Message extends Base {
*/
get editable() {
const precheck = Boolean(
this.author.id === this.client.user.id && !this.deleted && (!this.guild || this.channel?.viewable),
this.author.id === this.client.user.id && !deletedMessages.has(this) && (!this.guild || this.channel?.viewable),
);
// Regardless of permissions thread messages cannot be edited if
// the thread is locked.
Expand All @@ -600,7 +600,7 @@ class Message extends Base {
* @readonly
*/
get deletable() {
if (this.deleted) {
if (deletedMessages.has(this)) {
return false;
}
if (!this.guild) {
Expand All @@ -625,7 +625,7 @@ class Message extends Base {
const { channel } = this;
return Boolean(
!this.system &&
!this.deleted &&
!deletedMessages.has(this) &&
(!this.guild ||
(channel?.viewable &&
channel?.permissionsFor(this.client.user)?.has(Permissions.FLAGS.MANAGE_MESSAGES, false))),
Expand Down Expand Up @@ -661,7 +661,7 @@ class Message extends Base {
this.type === 'DEFAULT' &&
channel.viewable &&
channel.permissionsFor(this.client.user)?.has(bitfield, false) &&
!this.deleted,
!deletedMessages.has(this),
);
}

Expand Down