chore: label local only delete as trash (#30726)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2026-08-12 19:32:08 +05:30 committed by GitHub
parent ce705dcc06
commit 943c11c019
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -37,7 +37,8 @@ final _stateProvider = Provider.family.autoDispose<_State?, ActionSource>((ref,
final trashEnabled = ref.watch(serverInfoProvider.select((state) => state.serverFeatures.trash));
// Assets already in the trash or in the locked folder are deleted outright, irrespective of the server setting.
final trash = trashEnabled && !ownedRemote.every((asset) => asset.isTrashed || asset.isLocked);
final trash =
ownedRemote.isEmpty || (trashEnabled && !ownedRemote.every((asset) => asset.isTrashed || asset.isLocked));
return (localIds: localIds, remoteIds: ownedRemote.map((asset) => asset.id).toList(growable: false), trash: trash);
}, dependencies: [assetsActionProvider]);

View file

@ -170,6 +170,17 @@ void main() {
verifyNever(() => assetService.trash(any()));
verifyNever(() => assetService.delete(any()));
});
testWidgets('is labelled trash', (tester) async {
await tester.pumpTestWidget(
context,
const ActionButton(action: DeleteAction(source: .timeline)),
overrides: context.selected({LocalAssetFactory.create()}),
);
expect(find.text(StaticTranslations.instance.trash), findsOneWidget);
expect(find.text(StaticTranslations.instance.delete), findsNothing);
});
});
group('prompt handling', () {