diff --git a/CHANGELOG.md b/CHANGELOG.md index d1a00fd..f4dbe18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Searching a channel directory filters the loaded file names locally. Refreshing the same folder keeps the filter; opening another folder clears it. + - Searching or paging the client database now refreshes permission hints just like opening the first page, without losing the query or page offset. - Filter scoped administration lists row by row so a change of group or channel within a notification cannot mix permissions from different targets. diff --git a/FEATURE_COMPATIBILITY.md b/FEATURE_COMPATIBILITY.md index 6e3b582..40be018 100644 --- a/FEATURE_COMPATIBILITY.md +++ b/FEATURE_COMPATIBILITY.md @@ -2,6 +2,8 @@ ## Current Windows account-free checkpoint (2026-11-26) +**Directory search:** The Slint file browser filters the current listing without issuing a database search or a new file-list request. The test `directory_filter_keeps_file_targets_and_resets_on_navigation` matched a mixed-case Cyrillic name, kept the parent entry, included a new match after refresh and verified the selected file's original channel, path and session. Opening another directory cleared the filter. Three focused Windows tests passed; this did not exercise a network file transfer. + **Client database search and pagination:** Initial, searched and paginated results use the same server-context projection. Windows test `database_pages_and_search_results_keep_permission_and_target` checked the captured session and database ID, retained search/offset and enabled/disabled delete action for explicit allow/deny hints. Three projection and validation tests passed. No live database enumeration or deletion was attempted in this run. **Connected nickname change:** On private TS6 beta14, `nickname_refusal_keeps_draft_and_retry_updates_only_own_identity` opened the tab's rename form with the current nickname, rejected a two-character draft locally and kept a refused duplicate nickname editable. On retry, both clients saw the trimmed new name with the original server-reported UID and client ID. Reopening the temporary profile confirmed that only the initiating local identity's nickname changed. The test binds server UIDs to the acknowledged client IDs rather than assuming a server-reported UID equals a local profile UID. diff --git a/docs/mobile-port-progress.md b/docs/mobile-port-progress.md index 60f8562..2894cf7 100644 --- a/docs/mobile-port-progress.md +++ b/docs/mobile-port-progress.md @@ -4,6 +4,8 @@ ## Возврат к разработке на ПК, 2026-11-26 +Windows, база `643d0e4`: поиск в браузере файлов фильтрует загруженные имена, сохраняет переход к родителю и сбрасывается при смене каталога. Тест Slint проверил обновление списка, регистр кириллицы и цель контекстного меню. Прошли три адресных теста; сетевой обмен файлами не проверялся. + Windows, база `3a8e15e`: поиск и перелистывание базы клиентов используют тот же контекст прав, что и первая страница. Три адресных теста прошли, включая сохранение смещения, строки поиска, ID записи и сессии. Живой запрос базы и удаление записи не проверялись. Windows, база `d5ba657`: в списках прав ядро учитывает каждый явно указанный ID и не смешивает строки разных групп при смене ID внутри пакета. Три адресных теста прошли, включая продолжение списка в следующем пакете. Это проверка разбора протокола, не живое изменение прав. diff --git a/native/src/smoke/tabs.rs b/native/src/smoke/tabs.rs index 3dfd7f3..0786cb9 100644 --- a/native/src/smoke/tabs.rs +++ b/native/src/smoke/tabs.rs @@ -12,6 +12,40 @@ use teamspeach_core::protocol::Command; const CAPACITY: usize = 8; +#[test] +fn directory_filter_keeps_file_targets_and_resets_on_navigation() { + use crate::ui::shell::{self, Detail, Entity, ShellAction, ShellPresentation, Target}; + use std::sync::{Arc,Mutex}; + if !headless::install_for_test(){return;} + let ui=AppWindow::new().unwrap(); + let events=Arc::new(Mutex::new(Vec::new()));let sent=events.clone(); + let binding=shell::bind(&ui,Arc::new(move |event|sent.lock().unwrap().push(event))); + let key=SessionKey{connection_id:"c1".into(),session:2,generation:3}; + let dir=|path:&str|Target{session:Some(key.clone()),entity:Entity::File{channel_id:4,path:path.into(),directory:true},..Target::application()}; + let present=|path:&str,names:&[&str]| { + let target=dir(path); + let mut detail=Detail{search_target:Some(target.clone()),..Default::default()}; + for &name in names { + let file=Target{entity:Entity::File{channel_id:4,path:if name==".."{"/".into()}else{format!("{path}{name}")},directory:name==".."},name:name.into(),..target.clone()}; + detail.entries.push(shell::Entry{id:name.into(),target:file,title:name.into(),subtitle:String::new(),depth:0,selected:false,expanded:false,expandable:false,talking:false,muted:false,unread:0,actions:vec![],waveform:vec![]}); + } + binding.present(&ui,ShellPresentation{detail,..Default::default()}); + }; + let bridge=ui.global::(); + let titles=||bridge.get_entries().iter().map(|r|r.title.to_string()).collect::>(); + present("/docs/", &["..","song.wav","Отчёт.txt"]); + ui.show().unwrap(); + bridge.invoke_search_edited("отЧЁТ".into()); + assert_eq!(titles(),["..","Отчёт.txt"]); + present("/docs/", &["..","song.wav","Отчёт.txt","Отчёт-2.txt"]); + assert_eq!(titles(),["..","Отчёт.txt","Отчёт-2.txt"]); + assert!(events.lock().unwrap().is_empty()); + bridge.invoke_context(bridge.get_entries().row_data(2).unwrap().id,20.,20.); + assert!(matches!(events.lock().unwrap().as_slice(),[ShellAction::Context(t)] if t.session.as_ref()==Some(&key) && t.entity==Entity::File{channel_id:4,path:"/docs/Отчёт-2.txt".into(),directory:false})); + present("/other/", &["..","other.wav"]); + assert_eq!(titles(),["..","other.wav"]);assert!(bridge.get_search().is_empty()); +} + #[test] fn channel_move_parent_changes_predecessors_and_submits_ids() { use crate::{DialogBridge, app::server_actions, ui::shell::{self, forms, Entity, Operation, ShellAction, ShellPresentation, Tab, Target}}; diff --git a/native/src/ui/shell.rs b/native/src/ui/shell.rs index 728b6d9..b5bedfe 100644 --- a/native/src/ui/shell.rs +++ b/native/src/ui/shell.rs @@ -3,7 +3,7 @@ pub mod types; pub mod forms; pub use types::*; use crate::{AppWindow, ShellBridge, DialogBridge, ShellRow, ShellTab, ShellCommand, ShellInfo, ShellStream, ShellField}; -use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel}; +use slint::{ComponentHandle, Model, ModelExt, ModelRc, SharedString, VecModel}; use std::{cell::RefCell, collections::BTreeMap, rc::Rc, sync::Arc}; struct Editor { form: Form, raw: BTreeMap, dirty: BTreeMap, confirmation: String } @@ -256,7 +256,17 @@ pub fn bind(ui:&AppWindow,emit:Arc)->ShellBinding });} {let s=state.clone();let e=emit.clone();b.on_voice(move|kind|{if let Some(v)=&s.borrow().presentation.voice{e(ShellAction::Invoke{target:v.target.clone(),operation:if kind==0{Operation::ToggleMicrophone}else{Operation::ToggleDeafen}});}});} {let s=state.clone();let e=emit.clone();b.on_held(move|held|{let mut s=s.borrow_mut();if !held{release_hold(&mut s,&e);}else if s.held_target.is_none(){if let Some(v)=s.presentation.voice.as_ref().filter(|v|v.ptt_enabled){let target=v.target.clone();s.held_target=Some(target.clone());e(ShellAction::PushToTalk{target,held:true});}}});} - {let s=state.clone();let e=emit.clone();b.on_search_edited(move|query|{if let Some(target)=&s.borrow().presentation.detail.search_target{e(ShellAction::Search{target:target.clone(),query:query.to_string()});}});} + {let s=state.clone();let e=emit.clone();let weak=ui.as_weak();b.on_search_edited(move|query|{ + let s=s.borrow();let Some(target)=&s.presentation.detail.search_target else{return}; + if matches!(target.entity,Entity::File{directory:true,..}) { + let Some(ui)=weak.upgrade() else{return};let bridge=ui.global::(); + let needle=query.trim().to_lowercase(); + let visible=if needle.is_empty(){s.entries.clone().into()}else{ + ModelRc::new(s.entries.clone().filter(move|row|row.title==".." || row.title.to_lowercase().contains(&needle))) + }; + bridge.set_entries(visible);bridge.set_search(query); + }else{e(ShellAction::Search{target:target.clone(),query:query.to_string()});} + });} {let weak=ui.as_weak();b.on_sidebar_search_edited(move||{if let Some(ui)=weak.upgrade(){filter_sidebar(&ui.global::());}});} {let s=state.clone();let e=emit.clone();b.on_page(move|next|{let s=s.borrow();let d=&s.presentation.detail;if let Some(target)=&d.search_target{e(ShellAction::Page{target:target.clone(),offset:if next{d.page_offset.saturating_add(d.page_size)}else{d.page_offset.saturating_sub(d.page_size)}});}});} {let s=state.clone();let e=emit.clone();b.on_stream_volume(move|id,value,commit|{let s=s.borrow();if let Some(stream)=s.presentation.streams.iter().find(|v|v.id==id.as_str()){if (0.0..=1.0).contains(&value){e(ShellAction::Submit{editor_id:format!("stream-volume/{}",stream.id),target:stream.target.clone(),operation:Operation::StreamVolume,values:BTreeMap::from([("volume".into(),FieldValue::Decimal(f64::from(value))),("preview".into(),FieldValue::Bool(!commit))]),confirmation:String::new()});}}});} @@ -416,7 +426,11 @@ impl ShellBinding { s.popouts.retain(|id,(target,window)|{if p.streams.iter().any(|v|v.id==*id&&v.target==*target){if let Some(stream)=streams.iter().find(|v|v.id.as_str()==id){window.set_item(stream.clone());}true}else{let _=window.hide();false}}); if !streams.iter().any(|stream|stream.id==b.get_fullscreen_stream()){b.set_fullscreen_stream("".into());} b.set_streams(model(streams)); - b.set_title(p.detail.title.clone().into());b.set_subtitle(p.detail.subtitle.clone().into());b.set_description(p.detail.description.clone().into());b.set_detail_loading(p.detail.loading);b.set_detail_error(p.detail.error.clone().into());b.set_status(p.status.clone().into());b.set_error(p.error.clone().into());b.set_loading(p.loading);b.set_searchable(p.detail.search_target.is_some());b.set_search(p.detail.search.clone().into());b.set_has_previous(p.detail.page_offset>0);b.set_has_next(p.detail.has_more); + b.set_title(p.detail.title.clone().into());b.set_subtitle(p.detail.subtitle.clone().into());b.set_description(p.detail.description.clone().into());b.set_detail_loading(p.detail.loading);b.set_detail_error(p.detail.error.clone().into());b.set_status(p.status.clone().into());b.set_error(p.error.clone().into());b.set_loading(p.loading);b.set_searchable(p.detail.search_target.is_some());b.set_has_previous(p.detail.page_offset>0);b.set_has_next(p.detail.has_more); + if p.detail.search_target!=s.presentation.detail.search_target { b.set_entries(s.entries.clone().into()); } + if p.detail.search_target!=s.presentation.detail.search_target || !matches!(p.detail.search_target.as_ref().map(|t|&t.entity),Some(Entity::File{directory:true,..})) { + b.set_search(p.detail.search.clone().into()); + } b.set_destination(destination_index(s.destination));b.set_depth(s.stack.len() as i32); b.set_destinations(strings(["native.navigation.servers","native.navigation.chats","native.navigation.contacts","native.navigation.settings"].map(|k|c.text(k)))); b.set_stages(strings(["native.shell.details","native.shell.chat","native.shell.streams"].map(|k|c.text(k))));