Discussion stays open for finished studies; only planned studies are closed; v2.11.2
Publish Container / build (push) Successful in 16m10s

A finished study is just no longer the main study, so students who take it later still need discussion.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-09 11:52:56 -04:00
1 parent f1d4909acb
commit 0ab94bfcd4
5 files changed
+20 -17

No files matched your search

+5 -4
View File
@@ -225,17 +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.
// Discussion (community posts, replies, likes and lesson comments) is open for any study that
// has started: the current study and finished ones, so students who take a study later can
// still talk with each other. Only planned studies (not started yet) 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'
return Boolean(study) && getEffectiveStudyStatus(study) !== 'planned'
}
export const DISCUSSION_CLOSED_MESSAGE = 'Discussion is only open while a study is active.'
export const DISCUSSION_CLOSED_MESSAGE = 'Discussion opens once this study has started.'
export function findStudyUserById(userId) {
if (typeof userId !== 'string' || !userId.trim()) return undefined