Discussion only open while a study is active; v2.11.1
Publish Container / build (push) Has been cancelled
Publish Container / build (push) Has been cancelled
- Community posts, replies, likes and lesson comments are refused (403) for finished and planned studies - Reading a closed study's community/comments returns an empty list with closed:true - Discussion hub lists only active studies; community page shows a closed notice - Lesson page hides Lesson Discussion, 'Discuss this lesson' and 'Go to Community' for inactive studies; Community buttons hidden on study/dashboard pages - Tests for isStudyDiscussionOpen Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bb83f3e8c5
commit
f1d4909acb
7 files changed
+98
-14
No files matched your search
@@ -59,3 +59,22 @@ test('re-engagement emails skip students whose only study is finished', async ()
|
||||
await scheduleReengagementEmails(async (email) => { sent.push(email) })
|
||||
assert.deepEqual(sent, ['c@d.co'])
|
||||
})
|
||||
|
||||
test('discussion is open only for active studies', async () => {
|
||||
const { isStudyDiscussionOpen } = await import('../server/study-helpers.js')
|
||||
const past = '2020-01-01T00:00:00Z'
|
||||
const future = '2099-01-01T00:00:00Z'
|
||||
state.cachedSiteContent = {
|
||||
studies: [
|
||||
{ slug: 'live', status: 'active', sections: [{ id: 'a', releasedAt: past }, { id: 'b', releasedAt: future }] },
|
||||
{ slug: 'done', status: 'complete', sections: [{ id: 'a', releasedAt: past }] },
|
||||
{ slug: 'auto-done', sections: [{ id: 'a', releasedAt: past }] }, // every lesson released => complete
|
||||
{ slug: 'soon', status: 'planned', sections: [] },
|
||||
],
|
||||
}
|
||||
assert.equal(isStudyDiscussionOpen('live'), true)
|
||||
assert.equal(isStudyDiscussionOpen('done'), false)
|
||||
assert.equal(isStudyDiscussionOpen('auto-done'), false)
|
||||
assert.equal(isStudyDiscussionOpen('soon'), false)
|
||||
assert.equal(isStudyDiscussionOpen('missing'), false)
|
||||
})
|
||||
Reference in new issue
Block a user