fix(send): @here/@everyone use parent perms in threads

Thread channels inherit mention permissions from the parent text
channel. refreshSearch no-ops when the query is shorter than two chars.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-23 07:57:44 -04:00
co-authored by Cursor
parent 84dc333b6f
commit 1389cdb172
+8 -2
View File
@@ -1236,7 +1236,7 @@ class PearcordPlatform extends EventEmitter {
} }
async refreshSearch () { async refreshSearch () {
if (!this._searchQuery || !this.guild?.guild?.id) { if (!this._searchQuery || this._searchQuery.length < 2 || !this.guild?.guild?.id) {
return { refreshed: false, meta: this._lastSearchMeshMeta } return { refreshed: false, meta: this._lastSearchMeshMeta }
} }
if (this._guildOpenNoViewableChannels) { if (this._guildOpenNoViewableChannels) {
@@ -8659,7 +8659,13 @@ class PearcordPlatform extends EventEmitter {
if (!this.messages) throw new Error('no channel') if (!this.messages) throw new Error('no channel')
if (this.mode === 'guild') await this._assertCanParticipate() if (this.mode === 'guild') await this._assertCanParticipate()
if (this.mode === 'guild' && contentHasEveryoneOrHereMention(content)) { if (this.mode === 'guild' && contentHasEveryoneOrHereMention(content)) {
const perms = await this._myPermissions(this.activeChannelId) let permChannelId = this.activeChannelId
if (this.guild) {
const channels = await this.guild.listChannels()
const ch = channels.find((c) => c.id === this.activeChannelId)
if (ch?.type === 'thread' && ch.parentId) permChannelId = ch.parentId
}
const perms = await this._myPermissions(permChannelId)
if (!perms?.mentionEveryone) { if (!perms?.mentionEveryone) {
if (contentHasHereMention(content) && !contentHasEveryoneMention(content)) { if (contentHasHereMention(content) && !contentHasEveryoneMention(content)) {
throw new Error('missing permission: mention here') throw new Error('missing permission: mention here')