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
5 changes: 4 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"@courselit/common-logic",
"@courselit/page-primitives",
"@courselit/common-models",
"@courselit/docs"
"@courselit/docs",
"@courselit/orm-models",
"@courselit/page-models",
"@courselit/scripts"
]
}
5 changes: 5 additions & 0 deletions .changeset/empty-rockets-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@courselit/email-editor": patch
---

Bug fix: Lists don't render
20 changes: 8 additions & 12 deletions .github/workflows/publish-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ env:
jobs:
publish-packages:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- name: checkout
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Configure CI Git User
run: |
git config --global user.name 'Rajat Saxena'
git config --global user.email 'hi@sub.rajatsaxena.dev'
git remote set-url origin https://$GITHUB_ACTOR:$GITHUB_PAT@github.com/codelitdev/courselit
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}
env:
GITHUB_PAT: ${{ secrets.PAT }}

Expand All @@ -33,20 +37,13 @@ jobs:
git pull origin ${{ github.ref_name }}

- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 8
version: latest

- name: Install Packages
run: pnpm install

- name: Authenticate with Registry
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
pnpm whoami
env:
NPM_TOKEN: ${{ secrets.NPM }}

- name: Create and publish versions
id: changesets
uses: changesets/action@v1
Expand All @@ -56,7 +53,6 @@ jobs:
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
NPM_TOKEN: ${{ secrets.NPM }}

- name: Echo changeset output
run: echo "${{ steps.changesets.outputs.hasChangesets }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Sets `requiresEnrollment` to true for all quiz lessons.
*
* Usage:
* DB_CONNECTION_STRING=<mongodb-connection-string> node 28-03-26_00-00-set-quiz-requires-enrollment.js
*/
import mongoose from "mongoose";

const DB_CONNECTION_STRING = process.env.DB_CONNECTION_STRING;

if (!DB_CONNECTION_STRING) {
throw new Error("DB_CONNECTION_STRING is not set");
}

(async () => {
try {
await mongoose.connect(DB_CONNECTION_STRING);

const db = mongoose.connection.db;
if (!db) {
throw new Error("Could not connect to database");
}

const result = await db.collection("lessons").updateMany(
{ type: "quiz" },
{
$set: {
requiresEnrollment: true,
},
},
);

console.log(
`✅ Updated quiz lessons. Matched: ${result.matchedCount}, Modified: ${result.modifiedCount}`,
);
} finally {
await mongoose.connection.close();
}
})();
Original file line number Diff line number Diff line change
Expand Up @@ -604,32 +604,34 @@ export default function LessonPage() {
/>
</>
)}
{product?.type?.toLowerCase() !==
UIConstants.COURSE_TYPE_DOWNLOAD && (
<div className="flex items-center justify-between">
<div className="space-y-0.5">
<Label
htmlFor="preview"
className="font-semibold"
>
{LESSON_PREVIEW}
</Label>
<p className="text-sm text-muted-foreground">
Allow students to preview this
lesson without enrolling
</p>
{product?.type?.toLowerCase() ===
Constants.CourseType.COURSE &&
lesson.type !== Constants.LessonType.QUIZ && (
<div className="flex items-center justify-between">
<div className="space-y-0.5">
<Label
htmlFor="preview"
className="font-semibold"
>
{LESSON_PREVIEW}
</Label>
<p className="text-sm text-muted-foreground">
Allow students to preview this
lesson without enrolling
</p>
</div>
<Switch
id="preview"
checked={!lesson.requiresEnrollment}
onCheckedChange={(checked) =>
updateLesson({
requiresEnrollment:
!checked,
})
}
/>
</div>
<Switch
id="preview"
checked={!lesson.requiresEnrollment}
onCheckedChange={(checked) =>
updateLesson({
requiresEnrollment: !checked,
})
}
/>
</div>
)}
)}
<div className="flex items-center justify-between">
<div className="space-y-0.5">
<Label
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/admin/blogs/new-blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function NewBlog() {
>
{BTN_CONTINUE}
</Button>
<Link href={`/dashboard/blogs`} legacyBehavior>
<Link href="/dashboard/blogs">
<Button variant="soft">{BUTTON_CANCEL_TEXT}</Button>
</Link>
</div>
Expand Down
6 changes: 4 additions & 2 deletions apps/web/components/admin/page-editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default function PageEditor({
Page & {
draftTitle?: string;
draftDescription?: string;
draftSocialImage?: Media;
draftSocialImage?: Media | null;
draftRobotsAllowed?: boolean;
}
>
Expand Down Expand Up @@ -595,7 +595,9 @@ export default function PageEditor({
: true
}
socialImage={
page.draftSocialImage ?? page.socialImage ?? null
page.draftSocialImage !== undefined
? page.draftSocialImage
: (page.socialImage ?? null)
}
onClose={(e) => setLeftPaneContent("none")}
onSave={({
Expand Down
5 changes: 4 additions & 1 deletion apps/web/components/admin/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ const Settings = (props: SettingsProps) => {
) => {
event.preventDefault();

if (!newSettings.codeInjectionHead && !newSettings.codeInjectionBody) {
if (
newSettings.codeInjectionHead === settings.codeInjectionHead &&
newSettings.codeInjectionBody === settings.codeInjectionBody
) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/community/comment-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export default function CommentSection({

return (
<div className="flex flex-col gap-4">
<div className="space-y-4 max-h-[300px] overflow-y-auto">
<div className="space-y-4 overflow-y-auto">
{comments.map((comment) => (
<Comment
communityId={communityId}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/community/create-post-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export default function CreatePostDialog({
</div>
</DialogTrigger>
))}
<DialogContent className="sm:max-w-[90vw] md:max-w-[600px] w-full overflow-y-auto max-h-[calc(100vh-4rem)] my-8">
<DialogContent className="sm:max-w-4xl w-full overflow-y-auto max-h-[90vh] my-8">
<DialogHeader>
<DialogTitle>
<div className="flex items-center gap-2 mb-4">
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/community/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ export function CommunityForum({
}}
>
<DialogContent
className="sm:max-w-[600px] w-full overflow-y-auto max-h-[80vh] my-8"
className="sm:max-w-4xl w-full overflow-y-auto max-h-[90vh] my-8"
aria-describedby={undefined}
>
<VisuallyHidden>
Expand Down
1 change: 1 addition & 0 deletions apps/web/config/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const responses = {
certificate_invalid_settings: "Certificate can only be enabled for courses",
sso_provider_already_exists:
"A SSO provider with the same provider ID already exists",
quiz_cannot_be_previewed: "Quiz cannot be previewed",

// api responses
digital_download_no_files:
Expand Down
12 changes: 11 additions & 1 deletion apps/web/graphql/lessons/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { text, audio, video, pdf, embed, quiz, file } = constants;

type LessonValidatorProps = Pick<
LessonWithStringContent,
"content" | "type" | "media"
"content" | "type" | "media" | "requiresEnrollment"
>;

export const lessonValidator = (lessonData: LessonValidatorProps) => {
Expand Down Expand Up @@ -38,6 +38,16 @@ export function validateTextContent(lessonData: LessonValidatorProps) {
}

if (lessonData.type === quiz) {
if (
Object.prototype.hasOwnProperty.call(
lessonData,
"requiresEnrollment",
) &&
!lessonData.requiresEnrollment
) {
throw new Error(responses.quiz_cannot_be_previewed);
Comment thread
rajat1saxena marked this conversation as resolved.
}

if (content && content.questions) {
validateQuizContent(content.questions);
}
Expand Down
Loading
Loading