Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/qna/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function cardHasQnaEventType(db: DynamoDBDocumentClient, card: Card
}

function slugFor(card: Card): string {
const base = String(card.title || 'event').toLowerCase().normalize('NFKD').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 40).replace(/-+$/g, '');
const base = String(card.title || 'event').toLowerCase().normalize('NFKD').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 39).replace(/-+$/g, '');
return `${base || 'event'}-${card.id.replace(/[^a-z0-9]/gi, '').slice(0, 8).toLowerCase()}`;
}

Expand Down
3 changes: 2 additions & 1 deletion backend/tests/card-qna.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ describe('Event card audience Q&A (qna.dtcdev.click)', () => {
const newCard = (templateId: string, title: string) => req('POST', '/api/cards', { templateId, title, anchorDate: '2026-12-01' });

it('creates one Q&A room per podcast, webinar and workshop Card, grants host admin, and fills announcement', async () => {
for (const [tpl, title] of [[podcast, 'Podcast One'], [webinar, 'Webinar One'], [workshop, 'Workshop One']] as const) {
for (const [tpl, title] of [[podcast, 'Podcast One'], [webinar, 'Webinar One With A Very Long Event Title That Exceeds Forty Eight Characters'], [workshop, 'Workshop One']] as const) {
const res = await newCard(tpl.id, title);
assert.strictEqual(res.statusCode, 201);
const card = payload(res).card ?? payload(res);
assert.match(card.qna.url, /^https:\/\/qna\.dtcdev\.click\/r\//);
assert.ok(card.qna.slug.length >= 3 && card.qna.slug.length <= 48, `slug ${card.qna.slug} length ${card.qna.slug.length}`);
assert.deepStrictEqual(rooms.get(card.qna.roomId)?.admins, ['alexey@datatalks.club']);
const read = payload(await req('GET', `/api/cards/${card.id}`)).card ?? payload(await req('GET', `/api/cards/${card.id}`));
assert.strictEqual(read.qna.url, card.qna.url);
Expand Down