Discussion only open while a study is active; v2.11.1
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:
nmemmertandClaude Sonnet 5.5 committed 2026-10-09 11:49:03 -04:00
1 parent bb83f3e8c5
commit f1d4909acb
7 files changed
+98 -14

No files matched your search

+12
View File
@@ -225,6 +225,18 @@ export async function backfillCompletedStudies() {
return updated
}
// Discussion (community posts, replies, likes and lesson comments) is only open while a
// study is active. Finished and planned studies are closed.
export function isStudyDiscussionOpen(studySlug) {
const normalized = normalizeStudySlug(studySlug)
const studies = state.cachedSiteContent?.studies
if (!normalized || !Array.isArray(studies)) return false
const study = studies.find(item => normalizeStudySlug(item?.slug) === normalized)
return Boolean(study) && getEffectiveStudyStatus(study) === 'active'
}
export const DISCUSSION_CLOSED_MESSAGE = 'Discussion is only open while a study is active.'
export function findStudyUserById(userId) {
if (typeof userId !== 'string' || !userId.trim()) return undefined
return state.studyUsers.find(user => user.id === userId)