Hide Enroll for planned studies (Coming soon) and reject planned enrollments server-side; v2.8.3
Publish Container / build (push) Has been cancelled
Publish Container / build (push) Has been cancelled
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b1695b2b59
commit
db1737baf3
3 files changed
+20
-9
No files matched your search
@@ -59,6 +59,11 @@ export function register(app) {
|
||||
|
||||
const enrolled = Array.isArray(user.enrolledStudySlugs) ? user.enrolledStudySlugs : []
|
||||
if (!enrolled.includes(studySlug)) {
|
||||
const catalogEntry = getStudyCatalog().find(study => study.slug === studySlug)
|
||||
if (catalogEntry?.status === 'planned') {
|
||||
res.status(400).json({ message: 'This study is not open for enrollment yet.' })
|
||||
return
|
||||
}
|
||||
user.enrolledStudySlugs = [...enrolled, studySlug].slice(0, MAX_STUDY_ENROLLMENTS_PER_USER)
|
||||
user.updatedAt = new Date().toISOString()
|
||||
queueStudyUsersWrite()
|
||||
|
||||
Reference in new issue
Block a user