Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): hide asset description text field if user is not owner (#17442)

Gagan Yadav75bc32b47bc9
diff --git a/mobile/lib/widgets/asset_viewer/description_input.dart b/mobile/lib/widgets/asset_viewer/description_input.dart
index 778212eabe..3ac60fd613 100644
--- a/mobile/lib/widgets/asset_viewer/description_input.dart
+++ b/mobile/lib/widgets/asset_viewer/description_input.dart
@@ -34,17 +34,24 @@ class DescriptionInput extends HookConsumerWidget {
final owner = ref.watch(currentUserProvider);
final hasError = useState(false);
final assetWithExif = ref.watch(assetDetailProvider(asset));
+ final hasDescription = useState(false);
+ final isOwner = fastHash(owner?.id ?? '') == asset.ownerId;
useEffect(
() {
- assetService
- .getDescription(asset)
- .then((value) => controller.text = value);
+ assetService.getDescription(asset).then((value) {
+ controller.text = value;
+ hasDescription.value = value.isNotEmpty;
+ });
return null;
},
[assetWithExif.value],
);
+ if (!isOwner && !hasDescription.value) {
+ return const SizedBox.shrink();
+ }
+
submitDescription(String description) async {
hasError.value = false;
try {
@@ -82,7 +89,7 @@ class DescriptionInput extends HookConsumerWidget {
}
return TextField(
- enabled: fastHash(owner?.id ?? '') == asset.ownerId,
+ enabled: isOwner,
focusNode: focusNode,
onTap: () => isFocus.value = true,
onChanged: (value) {