Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8e96fcef6 | |||
| 5d793389e4 | |||
| 12d973d29c | |||
| 20e4617e6f |
@@ -107,7 +107,7 @@ function PendingUnlinks({ rows }) {
|
||||
<div className="dim" style={{ fontSize: '0.78rem', marginTop: 2 }}>
|
||||
{r.state === 'refused'
|
||||
? 'Protected staff account: the shard will not unlink it over the bridge. Clear its link on the shard by hand.'
|
||||
: `Waiting for the shard; tried ${r.attempts} time${r.attempts === 1 ? '' : 's'}, and tried again when the bridge reconnects.`}
|
||||
: `Waiting for the shard; tried ${r.attempts} time${r.attempts === 1 ? '' : 's'}. It tries again when the bridge reconnects.`}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,30 @@ test('a name resolves by abbreviation, then exactly, then by unique prefix', asy
|
||||
assert.equal(ambiguous.ephemeral, true)
|
||||
})
|
||||
|
||||
// #46: the rung check decides WHETHER to answer, not who else reads it. A reply
|
||||
// posted into a channel reaches every member, so an answer the shard gates
|
||||
// above `anonymous` must go to the caller alone — list and detail both.
|
||||
test('a permitted answer narrower than public is private to the caller', async () => {
|
||||
const staff = { ...linked, role: 'moderator', isStaff: true }
|
||||
for (const audience of ['logged_in', 'player', 'staff', 'admin']) {
|
||||
stub({ audience, level: 'admin' })
|
||||
const list = await command.handler({ options: {}, actor: staff })
|
||||
assert.equal(list.title, 'Guilds on this shard')
|
||||
assert.equal(list.ephemeral, true, `list under ${audience}`)
|
||||
const one = await command.handler({ options: { name: 'KOC' }, actor: staff })
|
||||
assert.match(one.title, /Knights of the Codex/)
|
||||
assert.equal(one.ephemeral, true, `detail under ${audience}`)
|
||||
}
|
||||
})
|
||||
|
||||
test('a public answer stays public in the channel', async () => {
|
||||
stub({ audience: 'anonymous', level: 'anonymous' })
|
||||
const list = await command.handler({ options: {}, actor: anonymous })
|
||||
assert.equal(list.ephemeral, false)
|
||||
const one = await command.handler({ options: { name: 'KOC' }, actor: anonymous })
|
||||
assert.equal(one.ephemeral, false)
|
||||
})
|
||||
|
||||
test('a miss is an answer, not a failure', async () => {
|
||||
stub()
|
||||
const res = await command.handler({ options: { name: 'nobody' }, actor: anonymous })
|
||||
|
||||
Reference in New Issue
Block a user