Remember the last Files folder per chat
Persist each chat session's last navigated Files folder, restore it with bounded parent fallback, and forget it when the session closes. Add persistence coverage and capture-fixture support for the reviewed behavior.
This commit is contained in:
@@ -2,10 +2,21 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/chat/files/files_urls.dart';
|
||||
|
||||
/// A static, two-level explorer fixture. Its files live in capture/fixtures/files.
|
||||
/// Set [probeMissingRememberedFolder] to make the nested folder disappear so
|
||||
/// browser captures can exercise the controller's parent fallback.
|
||||
bool probeMissingRememberedFolder = false;
|
||||
|
||||
JsonMap probeFilesReply(JsonMap request) {
|
||||
final fields = request['list_directory'] as Map?;
|
||||
final path = '${fields?['path'] ?? '/srv/probe/release'}';
|
||||
final nested = path.endsWith('/assets');
|
||||
if (probeMissingRememberedFolder && nested) {
|
||||
return {
|
||||
'id': request['id'],
|
||||
'type': 'error',
|
||||
'error': 'directory does not exist: $path',
|
||||
};
|
||||
}
|
||||
final entries = nested
|
||||
? <(String, int)>[('design.png', 18432), ('icon.jpg', 23000)]
|
||||
: <(String, int)>[
|
||||
|
||||
@@ -806,7 +806,10 @@ Future<void> main() async {
|
||||
return;
|
||||
}
|
||||
configurePerfFixture(params);
|
||||
if (params['files'] == '1') installFilesFixture();
|
||||
if (params['files'] == '1') {
|
||||
probeMissingRememberedFolder = params['filesMissing'] == '1';
|
||||
installFilesFixture();
|
||||
}
|
||||
// `?font=inter` chooses a font as Settings would; otherwise the stored one.
|
||||
final font = params['font'];
|
||||
unawaited(
|
||||
|
||||
Reference in New Issue
Block a user