From 7a9c7611e943f26c351054af7c722615cf6b71d1 Mon Sep 17 00:00:00 2001 From: monsieurtanuki Date: Thu, 28 Nov 2024 21:01:45 +0100 Subject: [PATCH] fix: contributor correctly displayed (#1005) Impacted files: * `json_helper.dart`: contributor correctly included in `toJson` * `product_image.dart`: contributor correctly included in `toString` --- lib/src/model/product_image.dart | 1 + lib/src/utils/json_helper.dart | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/model/product_image.dart b/lib/src/model/product_image.dart index 51999b5eee..89dc7ff796 100644 --- a/lib/src/model/product_image.dart +++ b/lib/src/model/product_image.dart @@ -242,6 +242,7 @@ class ProductImage { '${angle == null ? '' : ',angle=${angle!.degreesClockwise}'}' '${url == null ? '' : ',url=$url'}' '${uploaded == null ? '' : ',uploaded=$uploaded'}' + '${contributor == null ? '' : ',uploader=$contributor'}' '${imgid == null ? '' : ',imgid=$imgid'}' '${rev == null ? '' : ',rev=$rev'}' '${coordinatesImageSize == null ? '' : ',coordinatesImageSize=$coordinatesImageSize'}' diff --git a/lib/src/utils/json_helper.dart b/lib/src/utils/json_helper.dart index 996aa3452a..f7a3508a56 100644 --- a/lib/src/utils/json_helper.dart +++ b/lib/src/utils/json_helper.dart @@ -144,6 +144,7 @@ class JsonHelper { if (imageId != null) { final DateTime? uploaded = timestampToDate(fieldObject[_ALL_IMAGES_TAG_UPLOADED]); + final String? contributor = fieldObject[_ALL_IMAGES_TAG_UPLOADER]; // get each number object (e.g. 200) for (var size in ImageSize.values) { var number = size.number; @@ -159,7 +160,7 @@ class JsonHelper { height: JsonObject.parseInt(numberObject[_ALL_IMAGES_TAG_HEIGHT]), url: numberObject[_ALL_IMAGES_TAG_URL], uploaded: uploaded, - contributor: fieldObject[_ALL_IMAGES_TAG_UPLOADER], + contributor: contributor, ), ); } @@ -277,6 +278,9 @@ class JsonHelper { item[_ALL_IMAGES_TAG_UPLOADED] = dateToTimestamp(productImage.uploaded); } + if (productImage.contributor != null) { + item[_ALL_IMAGES_TAG_UPLOADER] = productImage.contributor; + } } else { if (productImage.rev != null) { item[_ALL_IMAGES_TAG_REVISION] = productImage.rev.toString();