diff --git a/lib/providers/add_exercise.dart b/lib/providers/add_exercise.dart index a813744f..41d316a0 100644 --- a/lib/providers/add_exercise.dart +++ b/lib/providers/add_exercise.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (c) 2026 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:flutter/foundation.dart'; import 'package:http/http.dart' as http; import 'package:logging/logging.dart'; @@ -100,7 +118,7 @@ class AddExerciseProvider with ChangeNotifier { ExerciseSubmissionApi get exerciseApiObject { return ExerciseSubmissionApi( - author: '', + author: author, variation: _variationId, variationConnectTo: _variationConnectToExercise, category: category!.id, @@ -110,7 +128,7 @@ class AddExerciseProvider with ChangeNotifier { translations: [ // Base language (English) ExerciseTranslationSubmissionApi( - author: '', + author: author, language: languageEn!.id, name: exerciseNameEn!, description: descriptionEn!, @@ -123,7 +141,7 @@ class AddExerciseProvider with ChangeNotifier { // Optional translation if (languageTranslation != null) ExerciseTranslationSubmissionApi( - author: '', + author: author, language: languageTranslation!.id, name: exerciseNameTrans!, description: descriptionTrans!, @@ -190,8 +208,9 @@ class AddExerciseProvider with ChangeNotifier { request.files.add(await http.MultipartFile.fromPath('image', image.imageFile.path)); request.fields['exercise'] = exerciseId.toString(); - request.fields['license'] = CC_BY_SA_4_ID.toString(); request.fields['is_main'] = 'false'; + request.fields['license'] = CC_BY_SA_4_ID.toString(); + request.fields['license_author'] = author; final details = image.toJson(); if (details.isNotEmpty) {