Skip to content

fix file uploads iterable type - #1863

Open
coolgirl19 wants to merge 3 commits into
devfrom
fix-fileupload
Open

fix file uploads iterable type#1863
coolgirl19 wants to merge 3 commits into
devfrom
fix-fileupload

Conversation

@coolgirl19

@coolgirl19 coolgirl19 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Description

Fixes #1842

Steps for Testing

  1. Login as an admin
  2. Go to the course and its lectures
  3. Press on edit lecture and try to upload the file via drag and drop.

@joschahenningsen joschahenningsen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, can you check why the linter is failing?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes drag-and-drop attachment uploads in the lecture editor (issue #1842) by adjusting how dropped files are collected and by making attachment state updates more robust in the admin lecture list data store.

Changes:

  • Update lecture editor drop handler to handle multiple dropped files and support both DataTransfer.files and DataTransfer.items.
  • Fix attachment list updates to handle potentially missing files and keep hasAttachments consistent on add/remove.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
web/ts/edit-course.ts Adjusts drag-and-drop handling for lecture attachment uploads.
web/ts/data-store/admin-lecture-list.ts Makes attachment add/remove resilient to missing files and updates hasAttachments accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web/ts/edit-course.ts Outdated
Comment on lines +226 to +230
onAttachmentFileDrop(e) {
if (e.dataTransfer.items) {
const item = e.dataTransfer.items[0];
const { kind } = item;
switch (kind) {
case "file": {
DataStore.adminLectureList.uploadAttachmentFile(
this.lectureData.courseId,
this.lectureData.lectureId,
item.getAsFile(),
);
break;
}
const files = [...(e.dataTransfer?.files ?? [])];

if (files.length > 0) {
for (const file of files) {
@joschahenningsen

Copy link
Copy Markdown
Member

@coolgirl19 can you follow up on this PR please?

@coolgirl19

coolgirl19 commented Jul 27, 2026 via email

Copy link
Copy Markdown
Contributor Author

@coolgirl19

Copy link
Copy Markdown
Contributor Author

@joschahenningsen I fixed the formatting issue and added the suggestion. Could you please take another look?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@SebiWrn SebiWrn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File Upload of Slides in Lecture edit doesn't work

4 participants