-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement delivering client assets for custom elements in public question previews #9807
base: sharing-element-client-code
Are you sure you want to change the base?
Conversation
All images
|
note from meeting: add an index on the |
if (options.publicEndpoint && !options.static) { | ||
const has_publicy_shared_question = await sqldb.queryRow( | ||
sql.select_has_publicly_shared_question, | ||
{ course_id: req.params.course_id }, | ||
z.boolean(), | ||
); | ||
if (!has_shared_question) { | ||
if (!has_publicy_shared_question) { | ||
throw new HttpStatusError(404, 'Not Found'); | ||
} | ||
const course = await selectCourseById(req.params.course_id); | ||
const coursePath = chunks.getRuntimeDirectoryForCourse(course); | ||
await chunks.ensureChunksForCourseAsync(course.id, { type: 'elements' }); | ||
|
||
elementFilesDir = path.join(coursePath, 'elements'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only actual new code here, the rest of the diff is muddled by the indentation level change.
This should go in after #9786 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## sharing-element-client-code #9807 +/- ##
============================================================
Coverage 67.02% 67.03%
============================================================
Files 458 458
Lines 71457 71490 +33
Branches 5733 5743 +10
============================================================
+ Hits 47896 47923 +27
- Misses 23126 23128 +2
- Partials 435 439 +4 ☔ View full report in Codecov by Sentry. |
(await import('../pages/elementFiles/elementFiles.js')).default({ | ||
publicQuestionEndpoint: false, | ||
static: true, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessary; why not import at the top-level scope like we had before? This isn't server.js
where we want to avoid overloading the top of the file with imports.
if (!valid) { | ||
throw new HttpStatusError(404, 'Unable to serve that file'); | ||
} | ||
export default function (options = { publicQuestionEndpoint: false, static: false }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSDoc comment? I'm specifically wondering what static
means here.
partial replacement for #9776
resolves part of #9397