diff --git a/app/lib/blocs/homework/homework_dialog_bloc.dart b/app/lib/blocs/homework/homework_dialog_bloc.dart index 6fbd40aae..6f5d2793c 100644 --- a/app/lib/blocs/homework/homework_dialog_bloc.dart +++ b/app/lib/blocs/homework/homework_dialog_bloc.dart @@ -229,8 +229,7 @@ class HomeworkDialogBloc extends BlocBase { Future _loadInitialCloudFiles( String courseID, String homeworkID) async { - final cloudFiles = - await api.loadCloudFiles(courseId: courseID, homeworkId: homeworkID); + final cloudFiles = await api.loadCloudFiles(homeworkId: homeworkID); _cloudFilesSubject.sink.add(cloudFiles); initialCloudFiles.addAll(cloudFiles); } @@ -385,10 +384,10 @@ class HomeworkDialogApi { return _api.homework.singleHomework(homeworkId.id, source: Source.cache); } - Future> loadCloudFiles( - {required String courseId, required String homeworkId}) { + Future> loadCloudFiles({required String homeworkId}) async { + final homework = await _api.homework.singleHomeworkStream(homeworkId).first; return _api.fileSharing.cloudFilesGateway - .filesStreamAttachment(courseId, homeworkId) + .filesStreamAttachment(homework.courseID, homeworkId) .first; } diff --git a/app/lib/blocs/homework/new_homework_dialog_bloc.dart b/app/lib/blocs/homework/new_homework_dialog_bloc.dart index 3357e9181..4321f2332 100644 --- a/app/lib/blocs/homework/new_homework_dialog_bloc.dart +++ b/app/lib/blocs/homework/new_homework_dialog_bloc.dart @@ -404,7 +404,6 @@ class NewHomeworkDialogBloc Future _loadExistingData(HomeworkId homeworkId) async { _initialHomework = await api.loadHomework(homeworkId); _initialAttachments = await api.loadCloudFiles( - courseId: _initialHomework.courseID, homeworkId: _initialHomework.id, ); add(_LoadedHomeworkData()); diff --git a/app/lib/pages/homework/homework_details/homework_details.dart b/app/lib/pages/homework/homework_details/homework_details.dart index a534522dd..6c1ff3a6d 100644 --- a/app/lib/pages/homework/homework_details/homework_details.dart +++ b/app/lib/pages/homework/homework_details/homework_details.dart @@ -390,9 +390,12 @@ class _EditIcon extends StatelessWidget { final successful = await Navigator.push( context, MaterialPageRoute( - builder: (context) => NewHomeworkDialog( + builder: (context) => HomeworkDialog( id: homework?.id != null ? HomeworkId(homework!.id) : null, ), + // builder: (context) => NewHomeworkDialog( + // id: homework?.id != null ? HomeworkId(homework!.id) : null, + // ), settings: const RouteSettings(name: HomeworkDialog.tag), ), ); diff --git a/app/test/homework/homework_dialog_test.dart b/app/test/homework/homework_dialog_test.dart index 689719f49..f9e69f107 100644 --- a/app/test/homework/homework_dialog_test.dart +++ b/app/test/homework/homework_dialog_test.dart @@ -69,8 +69,7 @@ class MockHomeworkDialogApi implements HomeworkDialogApi { final loadCloudFilesResult = []; @override - Future> loadCloudFiles( - {required String courseId, required String homeworkId}) async { + Future> loadCloudFiles({required String homeworkId}) async { return loadCloudFilesResult; }