Set the author name when submitting exercises

This commit is contained in:
Roland Geider
2026-02-08 15:56:22 +01:00
parent 88168dc352
commit 147764d1d7

View File

@@ -1,3 +1,21 @@
/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* 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 <http://www.gnu.org/licenses/>.
*/
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) {