Add nsfw flag on guild channel records

Persist age-restricted channel marking for sidebar badges and P2P gossip sync.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-22 22:35:52 -04:00
co-authored by Cursor
parent 19d23bde7f
commit f7a7129422
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ Create and load guilds in local storage, join peers on `pearcord:guild:{guildId}
| `PearcordGuild#reorderChannelsInParent` | Reassign `position` for siblings under one category/root |
| `PearcordGuild#moveChannelToParent` | Move channel into category (v0.8.168) |
| `PearcordGuild#reorderCategories` | Reassign `position` for category rows |
| `PearcordGuild#updateChannel`, `#ingestChannel` | Upsert + thread meta; voice/stage channels support optional `userLimit` (099, v0.8.172) |
| `PearcordGuild#updateChannel`, `#ingestChannel` | Upsert + thread meta; voice/stage `userLimit` (099); `nsfw` flag (v0.8.173) |
| `PearcordGuild#setMessageHandler(fn)` | Inbound `RPC.MESSAGE_CREATE` persistence hook (platform sets this) |
| `PearcordGuild#gossip*` / `#sendVoiceMedia` / `#sendScreenMedia` | Outbound RPC (see `index.js` for full list) |
| `PearcordGuild#simulateGossip(method, payload)` | Bare smoke injection without live peers |
+4 -2
View File
@@ -104,7 +104,8 @@ class PearcordGuild extends EventEmitter {
userLimit:
type === CHANNEL_TYPES.VOICE || type === CHANNEL_TYPES.STAGE
? Math.max(0, Math.min(99, Number(extra.userLimit) || 0))
: 0
: 0,
nsfw: !!extra.nsfw
}
await this.db.insert(COLLECTIONS.CHANNELS, channel)
if (type === CHANNEL_TYPES.THREAD && extra.rootMessageId) {
@@ -1057,7 +1058,8 @@ class PearcordGuild extends EventEmitter {
topic: channel.topic ?? null,
userLimit: channel.userLimit !== undefined
? Math.max(0, Math.min(99, Number(channel.userLimit) || 0))
: Math.max(0, Math.min(99, Number(prev?.userLimit) || 0))
: Math.max(0, Math.min(99, Number(prev?.userLimit) || 0)),
nsfw: channel.nsfw !== undefined ? !!channel.nsfw : !!prev?.nsfw
}
await this.db.insert(COLLECTIONS.CHANNELS, base)
if (channel.type === CHANNEL_TYPES.THREAD) {