Only send what is new, and lead with a picture
The window now starts at the last dispatch, so pressing send twice does not repeat a digest. Cards prefer entries that have a cover, the newest one of them opens the message as a full width image, and the page says when the last digest went out.
This commit is contained in:
@@ -121,3 +121,25 @@ describe('Bot-Token', () => {
|
||||
expect(outcome.run).toMatchObject({ sent: false, detail: 'channel_not_found' })
|
||||
})
|
||||
})
|
||||
|
||||
describe('Doppelter Versand', () => {
|
||||
it('schickt nach einem Versand nichts Zweites, solange nichts Neues erscheint', async () => {
|
||||
const brand = await makeBrand()
|
||||
const project = await makeProject(brand.id)
|
||||
|
||||
await makePost(project.id, { number: 1, slug: 'eins', status: 'published', publishAt: new Date() })
|
||||
await writeSetting('slack.botToken', 'xoxb-1234')
|
||||
await writeSetting('slack.channel', 'C123')
|
||||
|
||||
vi.stubGlobal('fetch', vi.fn(async () => new Response(
|
||||
JSON.stringify({ ok: true, channel: 'C123', ts: '1785600000.000100' }),
|
||||
{ headers: { 'content-type': 'application/json' } },
|
||||
)))
|
||||
|
||||
const first = await runWeeklyReport({ origin, trigger: 'test' })
|
||||
const second = await runWeeklyReport({ origin, trigger: 'test' })
|
||||
|
||||
expect(first.reason).toBe('sent')
|
||||
expect(second.reason).toBe('nothing_published')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user