fix(admin): the Held empty state names both reasons a message is held
- The hint said mail is held only on moderated lists; it is also held when the From header does not match the sender. It now says both, and shows for every posting policy. - Test covers members and moderated lists and the hint staying away when messages are held.
This commit is contained in:
parent
eccd82af69
commit
d957be3e84
2 changed files with 17 additions and 10 deletions
|
|
@ -76,15 +76,21 @@ describe('held tab', () => {
|
|||
expect(await screen.findByText(/nothing is waiting/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('explains how messages get held when posting is not moderated', async () => {
|
||||
await setup([], aList({ id: 1, post_policy: 'members' }))
|
||||
expect(await screen.findByText(/set posting to moderated/i)).toBeInTheDocument()
|
||||
it('explains both ways a message gets held, whatever the posting policy', async () => {
|
||||
for (const post_policy of ['members', 'moderated'] as const) {
|
||||
const { unmount } = await setup([], aList({ id: 1, post_policy }))
|
||||
const hint = await screen.findByText(/messages are held when/i)
|
||||
expect(hint).toHaveTextContent(/posting is set to moderated/i)
|
||||
expect(hint).toHaveTextContent(/from header does not match the sender/i)
|
||||
expect(hint).not.toHaveTextContent(/only/i)
|
||||
unmount()
|
||||
}
|
||||
})
|
||||
|
||||
it('does not nag about the policy when the list is moderated', async () => {
|
||||
await setup([])
|
||||
await screen.findByText(/nothing is waiting/i)
|
||||
expect(screen.queryByText(/set posting to moderated/i)).not.toBeInTheDocument()
|
||||
it('shows no hint when there are held messages', async () => {
|
||||
await setup([held(1)])
|
||||
await screen.findByText('Subject 1')
|
||||
expect(screen.queryByText(/messages are held when/i)).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('approves a message: it is sent and leaves the queue', async () => {
|
||||
|
|
|
|||
|
|
@ -51,9 +51,10 @@ export function HeldTab() {
|
|||
{held.data && items.length === 0 && (
|
||||
<div className="space-y-1 text-muted-foreground">
|
||||
<p>Nothing is waiting for approval.</p>
|
||||
{list.post_policy !== 'moderated' && (
|
||||
<p className="text-sm">Messages are held only when you set Posting to moderated in Settings.</p>
|
||||
)}
|
||||
<p className="text-sm">
|
||||
Messages are held when Posting is set to moderated in Settings, or when the From header does not match
|
||||
the sender.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{items.length > 0 && (
|
||||
|
|
|
|||
Loading…
Reference in a new issue