feat(ThreadChannel): add ThreadChannel#viewable (#6975)

This commit is contained in:
Suneet Tipirneni
2021-11-18 01:58:05 -05:00
committed by GitHub
parent 0c5c7210e7
commit db09d79423
3 changed files with 22 additions and 1 deletions

View File

@@ -551,7 +551,15 @@ class Message extends Base {
* @readonly
*/
get editable() {
return Boolean(this.author.id === this.client.user.id && !this.deleted && (!this.guild || this.channel?.viewable));
const precheck = Boolean(
this.author.id === this.client.user.id && !this.deleted && (!this.guild || this.channel?.viewable),
);
// Regardless of permissions thread messages cannot be edited if
// the thread is locked.
if (this.channel?.isThread()) {
return precheck && !this.channel.locked;
}
return precheck;
}
/**