Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
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
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
23 changes: 17 additions & 6 deletions apps/web/graphql/pages/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ import { Domain } from "../../models/Domain";
import { homePageTemplate } from "./page-templates";
import { publishTheme } from "../themes/logic";
import getDeletedMediaIds from "@/lib/get-deleted-media-ids";
import { deleteMedia, sealMedia } from "@/services/medialit";
import { deleteMedia } from "@/services/medialit";
import CommunityModel from "@models/Community";
import { replaceTempMediaWithSealedMediaInPageLayout } from "@/lib/replace-temp-media-with-sealed-media-in-page-layout";
import {
replaceTempMediaWithSealedMediaInPageLayout,
safeSealMedia,
} from "@/lib/replace-temp-media-with-sealed-media-in-page-layout";
const { product, site, blogPage, communityPage, permissions, defaultPages } =
constants;
const { pageNames } = Constants;
Expand Down Expand Up @@ -198,9 +201,12 @@ export const updatePage = async ({
if (page.draftSocialImage?.mediaId) {
deletedMediaIds.push(page.draftSocialImage.mediaId);
}
page.draftSocialImage = socialImage?.mediaId
? await sealMedia(socialImage.mediaId)
: undefined;
if (socialImage?.mediaId) {
const sealedMedia = await safeSealMedia(socialImage.mediaId);
Comment thread
rajat1saxena marked this conversation as resolved.
Outdated
if (sealedMedia) {
page.draftSocialImage = sealedMedia;
}
}
}
if (typeof robotsAllowed === "boolean") {
page.draftRobotsAllowed = robotsAllowed;
Expand All @@ -211,7 +217,12 @@ export const updatePage = async ({
);

for (const mediaId of deletableMediaIds) {
await deleteMedia(mediaId);
try {
await deleteMedia(mediaId);
} catch (err) {
// eslint-disable-next-line no-console
console.log(`Error while deleting media`, mediaId);
}
}

try {
Expand Down
3 changes: 3 additions & 0 deletions apps/web/graphql/themes/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import UserThemeModel from "@/models/UserTheme";
import { themes as SystemThemes } from "@courselit/page-primitives";
import { ThemeStyle } from "@courselit/page-models";
import { UITheme } from "@models/UITheme";
import { invalidateDomainCache } from "@/lib/domain-cache";

const { permissions } = constants;

Expand Down Expand Up @@ -224,6 +225,8 @@ export const switchTheme = async (themeId: string, ctx: GQLContext) => {
{ $set: { themeId, lastEditedThemeId: themeId } },
);

invalidateDomainCache(ctx.subdomain.name);

return formatTheme(theme);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
): Promise<any> {
const mediaIds = Array.from(extractMediaIDs(JSON.stringify(layout)));
for (const mediaId of mediaIds) {
const media = await sealMedia(mediaId);
const media = await safeSealMedia(mediaId);
if (media) {
layout = replaceMediaURLinPageLayout(layout, mediaId, media);
}
Expand All @@ -16,6 +16,14 @@
return layout;
}

export async function safeSealMedia(mediaId: string) {
try {
return await sealMedia(mediaId);
} catch (err) {
console.error(`Error while sealing media`, mediaId);
Comment thread Fixed
}
}

function replaceMediaURLinPageLayout(
layout: any,
mediaId: string,
Expand Down
Loading
Loading