High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(mobile): shared link edit sends explicit null instead of empty string (#28812)
Timond21cb2852617
diff --git a/mobile/lib/pages/library/shared_link/shared_link_edit.page.dart b/mobile/lib/pages/library/shared_link/shared_link_edit.page.dartindex 41486d7c98..65973918e4 100644--- a/mobile/lib/pages/library/shared_link/shared_link_edit.page.dart+++ b/mobile/lib/pages/library/shared_link/shared_link_edit.page.dart@@ -11,6 +11,7 @@ import 'package:immich_mobile/models/shared_link/shared_link.model.dart';import 'package:immich_mobile/providers/server_info.provider.dart';import 'package:immich_mobile/providers/shared_link.provider.dart';import 'package:immich_mobile/services/shared_link.service.dart';+import 'package:openapi/api.dart';import 'package:immich_mobile/utils/url_helper.dart';import 'package:immich_mobile/widgets/common/confirm_dialog.dart';import 'package:immich_mobile/widgets/common/immich_toast.dart';@@ -365,11 +366,10 @@ class SharedLinkEditPage extends HookConsumerWidget {bool? download;bool? upload;bool? meta;- String? desc;- String? password;+ var password = const Optional<String?>.absent();+ var description = const Optional<String?>.absent();String? slug;- DateTime? expiry;- bool? changeExpiry;+ var expiry = const Optional<DateTime?>.absent();if (allowDownload.value != existingLink!.allowDownload) {download = allowDownload.value;@@ -383,12 +383,16 @@ class SharedLinkEditPage extends HookConsumerWidget {meta = showMetadata.value;}- if (descriptionController.text != existingLink!.description) {- desc = descriptionController.text;+ if (descriptionController.text != (existingLink!.description ?? '')) {+ description = descriptionController.text.isEmpty+ ? const Optional.present(null)+ : Optional.present(descriptionController.text);}- if (passwordController.text != existingLink!.password) {- password = passwordController.text;+ if (passwordController.text != (existingLink!.password ?? '')) {+ password = passwordController.text.isEmpty+ ? const Optional.present(null)+ : Optional.present(passwordController.text);}if (slugController.text != (existingLink!.slug ?? "")) {@@ -399,8 +403,7 @@ class SharedLinkEditPage extends HookConsumerWidget {final newExpiry = expiryAfter.value;if (newExpiry?.toUtc() != existingLink!.expiresAt?.toUtc()) {- expiry = newExpiry;- changeExpiry = true;+ expiry = newExpiry == null ? const Optional.present(null) : Optional.present(newExpiry.toUtc());}await ref@@ -410,11 +413,10 @@ class SharedLinkEditPage extends HookConsumerWidget {showMeta: meta,allowDownload: download,allowUpload: upload,- description: desc,+ description: description,password: password,slug: slug,- expiresAt: expiry?.toUtc(),- changeExpiry: changeExpiry,+ expiresAt: expiry,);if (!context.mounted) {return;diff --git a/mobile/lib/services/shared_link.service.dart b/mobile/lib/services/shared_link.service.dartindex 009e922b38..975070f2a0 100644--- a/mobile/lib/services/shared_link.service.dart+++ b/mobile/lib/services/shared_link.service.dart@@ -88,11 +88,10 @@ class SharedLinkService {required bool? showMeta,required bool? allowDownload,required bool? allowUpload,- bool? changeExpiry = false,- String? description,- String? password,+ Optional<String?> password = const Optional.absent(),+ Optional<String?> description = const Optional.absent(),String? slug,- DateTime? expiresAt,+ Optional<DateTime?> expiresAt = const Optional.absent(),}) async {try {final responseDto = await _apiService.sharedLinksApi.updateSharedLink(@@ -101,11 +100,10 @@ class SharedLinkService {showMetadata: showMeta == null ? const Optional.absent() : Optional.present(showMeta),allowDownload: allowDownload == null ? const Optional.absent() : Optional.present(allowDownload),allowUpload: allowUpload == null ? const Optional.absent() : Optional.present(allowUpload),- expiresAt: expiresAt == null ? const Optional.absent() : Optional.present(expiresAt),- description: description == null ? const Optional.absent() : Optional.present(description),- password: password == null ? const Optional.absent() : Optional.present(password),+ password: password,+ description: description,+ expiresAt: expiresAt,slug: slug == null ? const Optional.absent() : Optional.present(slug),- changeExpiryTime: changeExpiry == null ? const Optional.absent() : Optional.present(changeExpiry),),);if (responseDto != null) {