Skip to content

Commit ac53c97

Browse files
author
Rajat
committed
Downloads respects published lessons
1 parent a85a20a commit ac53c97

4 files changed

Lines changed: 33 additions & 22 deletions

File tree

  • apps
    • docs
    • web/app
      • (with-contexts)/dashboard/(sidebar)/product/[id]/content/section/[section]/lesson
      • api/download/[token]
128 KB
Loading

apps/docs/src/pages/en/downloads/create.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ Now that we have added some content to the course, it's time to publish. By defa
5252

5353
11. To share your digital download with your audience, simply copy the URL and share it. When your users click on the `Buy now` button, they will be redirected to the login screen so that they can add the course into their accounts.
5454

55+
## Control file visibility
56+
57+
By default, files are unpublished i.e., it will not be included in the ZIP download. To included it in the ZIP file, toggle the `Publish` switch as shown.
58+
59+
![Publish file](/assets/downloads/visibility.png)
60+
5561
## Stuck somewhere?
5662

5763
We are always here for you. Come chat with us in our <a href="https://discord.com/invite/GR4bQsN" target="_blank">Discord</a> channel or send a tweet at <a href="https://twitter.com/courselit" target="_blank">@CourseLit</a>.

apps/web/app/(with-contexts)/dashboard/(sidebar)/product/[id]/content/section/[section]/lesson/page.tsx

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import {
4343
TOAST_TITLE_ERROR,
4444
TOAST_TITLE_SUCCESS,
4545
ALPHA_LABEL,
46+
LESSON_PREVIEW,
4647
} from "@ui-config/strings";
4748
import DashboardContent from "@components/admin/dashboard-content";
4849
import useProduct from "@/hooks/use-product";
@@ -603,29 +604,32 @@ export default function LessonPage() {
603604
/>
604605
</>
605606
)}
606-
<div className="flex items-center justify-between">
607-
<div className="space-y-0.5">
608-
<Label
609-
htmlFor="preview"
610-
className="font-semibold"
611-
>
612-
Preview
613-
</Label>
614-
<p className="text-sm text-muted-foreground">
615-
Allow students to preview this lesson
616-
without enrolling
617-
</p>
607+
{product?.type?.toLowerCase() !==
608+
UIConstants.COURSE_TYPE_DOWNLOAD && (
609+
<div className="flex items-center justify-between">
610+
<div className="space-y-0.5">
611+
<Label
612+
htmlFor="preview"
613+
className="font-semibold"
614+
>
615+
{LESSON_PREVIEW}
616+
</Label>
617+
<p className="text-sm text-muted-foreground">
618+
Allow students to preview this
619+
lesson without enrolling
620+
</p>
621+
</div>
622+
<Switch
623+
id="preview"
624+
checked={!lesson.requiresEnrollment}
625+
onCheckedChange={(checked) =>
626+
updateLesson({
627+
requiresEnrollment: !checked,
628+
})
629+
}
630+
/>
618631
</div>
619-
<Switch
620-
id="preview"
621-
checked={!lesson.requiresEnrollment}
622-
onCheckedChange={(checked) =>
623-
updateLesson({
624-
requiresEnrollment: !checked,
625-
})
626-
}
627-
/>
628-
</div>
632+
)}
629633
<div className="flex items-center justify-between">
630634
<div className="space-y-0.5">
631635
<Label

apps/web/app/api/download/[token]/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export async function GET(
8080
{
8181
courseId: course.courseId,
8282
domain: domain._id,
83+
published: true,
8384
},
8485
{
8586
media: 1,

0 commit comments

Comments
 (0)