fix(commands): keep a staff-gated /guild answer private to the caller
/guild checked the caller's rung against the shard's guilds audience and then posted the permitted answer into the channel, where every member reads it. A moderator running /guild on a staff-gated shard published the guild list (or one guild's counts and leaders) to everyone. The list and detail envelopes now carry ephemeral: true whenever the guilds audience is above the public rung. This module's public rung is `anonymous` (shardVisibility LADDER), not `public`; a missing audience fails closed. Public shards keep public answers. Same rule as module-rust D127. Closes #46 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014HJEmd5sBSpNXicS4gmT1t
This commit is contained in:
@@ -61,6 +61,18 @@ function linkPrompt(actor, audience) {
|
||||
return 'Link your account on the site to see more — this shard shows guild information to linked players.'
|
||||
}
|
||||
|
||||
// **A permitted answer narrower than `public` goes to the caller alone (#46).**
|
||||
// The rung check above decides WHETHER to answer; it says nothing about WHO ELSE
|
||||
// reads the reply. A slash-command reply posted into a channel is read by every
|
||||
// member of it, so a staff-gated guild list a moderator asked for in a public
|
||||
// channel would reach people the shard's setting excludes. Same rule module-rust
|
||||
// adopted (D127): anything whose audience is narrower than public is ephemeral;
|
||||
// what the public may see stays public. This module's public rung is
|
||||
// `anonymous` (shardVisibility LADDER) — there is no `public` value here, so
|
||||
// comparing against that word would make every answer private. A missing
|
||||
// audience fails closed.
|
||||
const isNarrow = (audience) => audience !== 'anonymous'
|
||||
|
||||
const pageUrl = (externalId) =>
|
||||
`${core.baseUrl}${provider.pageUrlTemplate.replace('{externalId}', externalId)}`
|
||||
|
||||
@@ -118,6 +130,7 @@ async function detail(guild, actor, audience) {
|
||||
fields,
|
||||
url: pageUrl(guild.id),
|
||||
notice: linkPrompt(actor, audience),
|
||||
ephemeral: isNarrow(audience),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,6 +186,7 @@ async function handler({ options, actor }) {
|
||||
inline: true,
|
||||
})),
|
||||
notice: linkPrompt(actor, feature.audience),
|
||||
ephemeral: isNarrow(feature.audience),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user