diff --git a/CHANGELOG.md b/CHANGELOG.md index ef0d9c7..c6bbfb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Move to Own Channel is offered only for participants in another channel. Its confirmation stays bound to the original participant and destination, asks for a password only for a protected channel, and keeps server refusals visible. + - Group Rename opens with the selected group's current name. Blank and unchanged names close the editor without submitting; changed names are trimmed before submission. - A late client database search or page response no longer replaces newer results or reopens a closed panel. Results and errors are bound to the original server and tab. diff --git a/FEATURE_COMPATIBILITY.md b/FEATURE_COMPATIBILITY.md index 98e01db..118c6c5 100644 --- a/FEATURE_COMPATIBILITY.md +++ b/FEATURE_COMPATIBILITY.md @@ -2,6 +2,8 @@ ## Current Windows account-free checkpoint (2026-11-26) +**Move to Own Channel:** With two muted beta14 guests the action was absent in the same channel and available once the initiator entered a separate temporary channel. The unprotected destination had no password field. Cancellation and the server's permission refusal left both guests in place; submitting an open confirmation after the initiator changed channels reported a changed target. No successful privileged move was observed. + **Client database panel:** Opening the server's client database as a disposable beta14 guest returned PermissionsClientInsufficient. Slint showed the refusal, with no database rows or active search target. A separate native query test verified that 255 Unicode scalars reach the exact search command unchanged; a 256th scalar is rejected. No authorized list or search result was observed on the server. **Channel codec quality:** The create form rejected 11 and created a temporary channel at quality 5. The edit form restored 5, saved 7, and retained an invalid -1 with a field error. Cancelling a draft of 3 left quality 7 in both the server roster and a newly opened editor. The check exercised server properties, not encoded audio quality. diff --git a/core/src/menu.rs b/core/src/menu.rs index b68ed13..019b3b6 100644 --- a/core/src/menu.rs +++ b/core/src/menu.rs @@ -86,7 +86,7 @@ pub(crate) fn validate_action(request: &ActionRequest) -> Result<(), ErrorObj> { Action::ServerGroup{group_id,..}|Action::ChannelGroup{group_id,..} if *group_id==0=>return Err(bad("group_id must be positive")), Action::ChannelGroup{channel_id,..}|Action::ChannelPermissions{channel_id}|Action::SetChannelPermission{channel_id,..} if *channel_id==0=>return Err(bad("channel_id must be positive")), Action::SetClientPermission{permission_id,..}|Action::SetChannelPermission{permission_id,..} if *permission_id==0=>return Err(bad("permission_id must be positive")), - Action::MoveToOwnChannel{expected_channel_id:0,..}=>return Err(bad("expected_channel_id must be positive")), + Action::MoveToOwnChannel{expected_channel_id,..} if !(1..=crate::admin::MAX_SAFE_INTEGER).contains(expected_channel_id)=>return Err(bad("expected_channel_id must be a positive safe integer")), Action::MoveToOwnChannel{password:Some(p),..} if p.len()>1024 || p.chars().any(char::is_control)=>return Err(bad("invalid channel password")), Action::Avatar{data}=>{avatar_bytes(data)?;}, _=>{}, diff --git a/core/tests/bridge_smoke.rs b/core/tests/bridge_smoke.rs index a17e5e7..84a0817 100644 --- a/core/tests/bridge_smoke.rs +++ b/core/tests/bridge_smoke.rs @@ -274,6 +274,7 @@ fn client_menu_commands_are_validated_and_never_fake_success_offline() { assert_eq!(reply["error"]["code"],"bad_request","{reply}"); } let actions=[ + json!({"action":"move_to_own_channel","expected_channel_id":9_007_199_254_740_991u64}), json!({"action":"poke","message":"fixture"}),json!({"action":"connection_info"}), json!({"action":"commander","enabled":true}),json!({"action":"server_group","group_id":6,"enabled":true}), json!({"action":"channel_group","group_id":7,"channel_id":1}),json!({"action":"client_permissions"}), @@ -289,6 +290,8 @@ fn client_menu_commands_are_validated_and_never_fake_success_offline() { assert_eq!(r["error"]["code"],"not_connected","{r}"); } for (i,args) in [ + json!({"client_id":42,"uid":"fixture","generation":1,"action":"move_to_own_channel","expected_channel_id":0}), + json!({"client_id":42,"uid":"fixture","generation":1,"action":"move_to_own_channel","expected_channel_id":9_007_199_254_740_992u64}), json!({"client_id":42,"uid":"fixture","generation":1,"action":"volume","value":3,"muted":false}), json!({"client_id":42,"uid":"fixture","generation":1,"action":"volume","db":10.5,"muted":false}), json!({"client_id":42,"uid":"fixture","generation":1,"action":"volume","db":-3.25,"muted":false}), diff --git a/docs/mobile-port-progress.md b/docs/mobile-port-progress.md index f111660..0b446ed 100644 --- a/docs/mobile-port-progress.md +++ b/docs/mobile-port-progress.md @@ -4,6 +4,8 @@ ## Возврат к разработке на ПК, 2026-11-26 +Windows, база `baea1f7`: команда переноса участника привязана к исходной сессии, UID, номеру участника и каналу назначения. На двух гостях beta14 проверены отсутствие действия в общем канале, форма без пароля для открытого канала, отмена, серверный отказ и отклонение устаревшего подтверждения. Прошли четыре нативных теста и проверка stdio для границ ID. Успешный перенос с правами не подтверждён. + Windows, база `d687e35`: форма переименования серверной и канальной групп показывает имя выбранной строки. Пробелы по краям удаляются, пустое и неизменённое имена не отправляются, изменённое имя сохраняет исходный ID и сессию в команде формы. Прошли три теста нативного клиента. Запись группы на живом сервере не проверялась. Windows, база `6f1ffc3`: список клиентов, поиск и пагинация проверяют номер запроса, окно, сессию и UID сервера. Тест модели подтвердил отбрасывание ответов в обратном порядке, после «Назад» и после замены сервера. Прошли пять проверок, включая панель гостя beta14. Положительный ответ на поиск от сервера с разрешённым доступом не подтверждён. diff --git a/native/src/app/runtime/controller.rs b/native/src/app/runtime/controller.rs index 8436fbe..7483bbc 100644 --- a/native/src/app/runtime/controller.rs +++ b/native/src/app/runtime/controller.rs @@ -50,6 +50,9 @@ pub(super) fn require_server_editor_target(ctx: &RuntimeServices, target: &Targe .and_then(|session| session.server.as_ref()).ok_or_else(changed)?; match (operation, &target.entity) { (Operation::SetNickname, Entity::Connection) => Ok(()), + (Operation::ClientMove, Entity::Client { id,uid,channel_id }) if *id!=0 && !uid.is_empty() + && target.own_channel_id.is_some_and(|own|own!=0 && own!=*channel_id && server["own_channel_id"].as_u64()==Some(own)) + && server["clients"].as_array().is_some_and(|rows|rows.iter().any(|row|row["id"]==*id && row["uid"].as_str()==Some(uid.as_str()) && row["channel_id"]==*channel_id)) => Ok(()), (Operation::ClientCommander, Entity::Client { id, uid, .. }) if *id != 0 && !uid.is_empty() && server["own_client_id"].as_u64() == Some(u64::from(*id)) && server["clients"].as_array().is_some_and(|rows| rows.iter().any(|row| row["id"] == *id && row["uid"].as_str() == Some(uid.as_str()))) => Ok(()), @@ -92,8 +95,8 @@ pub(super) async fn submit_server_editor(ctx: &Arc, target: &Ta } } ctx.request(key, command).await?; - // A successful Poke is final even if the recipient leaves before we process its reply. - if operation == Operation::ClientPoke { return Ok(WorkflowResult::default()); } + // After a move the source channel is no longer current; a poke recipient may have left. + if matches!(operation,Operation::ClientPoke|Operation::ClientMove) { return Ok(WorkflowResult::default()); } check()?; let mut result = WorkflowResult::default(); if operation == Operation::ServerEdit { @@ -324,6 +327,17 @@ async fn server_form(ctx:&Arc,target:&Target,operation:Operatio return Ok(Some(form)); } if let Entity::Client{id,uid,..}=&target.entity{let key=target.session.as_ref().ok_or_else(changed)?;let context=ctx.request(key,teamspeach_core::protocol::Command::ClientContext(teamspeach_core::menu::Target{client_id:*id,uid:uid.clone()})).await?;ctx.require_target(target)?;if let Some(action)=server_actions::client_context(target,&context,&c)?.into_iter().find(|action|action.operation==operation){if !action.enabled{return Err(ServiceError::new("permission_denied",action.reason))}if let Some(populated)=action.form{form=populated;}}} + if operation==Operation::ClientMove { + let key=target.session.as_ref().ok_or_else(changed)?; + let id=target.own_channel_id.ok_or_else(changed)?; + let snapshots=ctx.connected.connections.snapshot(); + let protected=snapshots.get(&key.connection_id).filter(|entry|entry.key==*key).and_then(|entry|entry.server.as_ref()) + .and_then(|s|s["channels"].as_array()).and_then(|rows|rows.iter().find(|r|r["id"]==id)) + .and_then(|r|r["has_password"].as_bool()).ok_or_else(changed)?; + if !protected {form.fields.retain(|f|f.id!="channel_password");} + form.description=c.format("clientMenu.confirmChange",&[("name",&target.name)]); + return Ok(Some(form)); + } if matches!(operation,Operation::ChannelCreate|Operation::ChannelCreateChild|Operation::ChannelEdit|Operation::ChannelMove){ let key=target.session.as_ref().ok_or_else(changed)?; if operation==Operation::ChannelEdit { diff --git a/native/src/app/runtime/mod.rs b/native/src/app/runtime/mod.rs index efa8d48..512a769 100644 --- a/native/src/app/runtime/mod.rs +++ b/native/src/app/runtime/mod.rs @@ -201,7 +201,7 @@ async fn run(config:AppConfig,runtime:Weak,mut commands:mpsc::Receiv continue; } if matches!(prompts.front(), Some(Dialog::ServerEditor { form, submitting: true, .. }) - if matches!(form.operation,Operation::ClientPoke|Operation::ClientCommander) && form.id == editor_id && form.target == target) { continue; } + if forms::tracked_participant(form.operation) && form.id == editor_id && form.target == target) { continue; } if prompts.front().is_some_and(|dialog|dialog.form().id==editor_id&&(matches!(dialog,Dialog::Prompt(_))||dialog.form().target==target)){ if let Some(Dialog::Prompt(prompt))=prompts.pop_front(){let _=prompt.answer.send(Err(ServiceError::new("cancelled","Dialog cancelled")));} project_dialog(&mut state,&prompts); diff --git a/native/src/app/runtime/model.rs b/native/src/app/runtime/model.rs index 1fd214a..2f18ea8 100644 --- a/native/src/app/runtime/model.rs +++ b/native/src/app/runtime/model.rs @@ -578,7 +578,9 @@ impl TreeProjection<'_> { let talk_power=if client["is_talker"]==true{Operation::TalkRevoke}else{Operation::TalkGrant}; let own=client["is_self"]==true||index.own_client==Some(u64::from(client_id)); let operations=[Operation::ClientCommander,Operation::ClientPoke,Operation::ClientVolume,Operation::ClientConnectionInfo,Operation::ClientServerGroupAdd,Operation::ClientServerGroupRemove,Operation::ClientChannelGroupSet,Operation::ClientPermissions,Operation::ClientChannelPermissionSet,Operation::ClientChannelPermissionRemove,Operation::ClientWhisperAdd,Operation::ClientKickChannel,Operation::ClientKickServer,Operation::ClientBan,Operation::ClientInfo,Operation::ClientPrivateChat,Operation::ClientMove,Operation::ClientAvatarChoose,Operation::ClientAvatarDelete,talk_power,Operation::ContactAdd]; - row.actions=actions(&target,&operations[usize::from(!own)..],self.catalog); + row.actions=operations[usize::from(!own)..].iter().copied() + .filter(|op|*op!=Operation::ClientMove || !own && index.own_channel.is_some_and(|channel|channel!=0 && channel!=id)) + .map(|op|shell_action(&target,op,self.catalog)).collect(); let appearance=TreeAppearance::Client { own, contact: false, @@ -1004,4 +1006,5 @@ mod tests { } } fn entry(target:Target,id:String,depth:usize)->Entry{Entry{id,title:target.name.clone(),target,subtitle:String::new(),depth,selected:false,expanded:false,expandable:false,talking:false,muted:false,unread:0,actions:vec![],waveform:Vec::new()}} -pub fn actions(target:&Target,operations:&[Operation],catalog:&Catalog)->Vec{operations.iter().map(|op|{let mut action=Action::new(format!("{op:?}"),*op,target.clone(),catalog);super::local_actions::prepare_action(&mut action);if target.session.is_some()||matches!(op,Operation::CaptureChoose|Operation::CapturePreview|Operation::CaptureStart|Operation::StreamVolume){action.form=None;}action}).collect()} +fn shell_action(target:&Target,op:Operation,catalog:&Catalog)->Action{let mut action=Action::new(format!("{op:?}"),op,target.clone(),catalog);super::local_actions::prepare_action(&mut action);if target.session.is_some()||matches!(op,Operation::CaptureChoose|Operation::CapturePreview|Operation::CaptureStart|Operation::StreamVolume){action.form=None;}action} +pub fn actions(target:&Target,operations:&[Operation],catalog:&Catalog)->Vec{operations.iter().map(|op|shell_action(target,*op,catalog)).collect()} diff --git a/native/src/smoke/tabs.rs b/native/src/smoke/tabs.rs index 49764b7..2b32b86 100644 --- a/native/src/smoke/tabs.rs +++ b/native/src/smoke/tabs.rs @@ -891,7 +891,15 @@ fn participant_context_menu_projects_muted_beta14_capabilities() { #[cfg(target_os = "windows")] #[derive(Clone, Copy, PartialEq, Eq)] -enum ParticipantFixture { Info, Statistics, Poke, Context, Volume, Commander } +enum ParticipantFixture { Info, Statistics, Poke, Context, Volume, Commander, Move } + +#[cfg(target_os = "windows")] +#[test] +#[ignore = "requires exclusive use of the private beta14 server"] +fn participant_move_requires_the_original_own_channel() { + if !headless::install_for_test() { return; } + run_muted_beta14_participant_fixture(ParticipantFixture::Move); +} #[cfg(target_os = "windows")] #[path = "participant_gain.rs"] @@ -949,6 +957,7 @@ fn run_muted_beta14_participant_fixture(scenario: ParticipantFixture) { } let uids = await_muted_beta14_roster(runtime, &tabs, clients).await?; match scenario { + ParticipantFixture::Move => return exercise_peer_move(runtime,ui,&owner,&tabs,clients,&uids).await, ParticipantFixture::Statistics => return exercise_beta14_connection_info(runtime, ui, &owner, &mut tabs, clients, &uids, &identities[1]).await, ParticipantFixture::Poke => return exercise_beta14_poke(runtime, ui, &owner, &mut tabs, clients, &uids, replacement.as_deref().ok_or("missing replacement guest identity")?).await, @@ -1064,6 +1073,59 @@ fn run_muted_beta14_participant_fixture(scenario: ParticipantFixture) { #[cfg(target_os = "windows")] const BETA14_PARTICIPANTS: [&str; 2] = ["Info QA First", "Info QA Second"]; +#[cfg(target_os="windows")] +async fn exercise_peer_move(runtime:&AppRuntime,ui:&AppWindow,owner:&crate::app::runtime::context::RuntimeServices,tabs:&[SessionKey;2],clients:[u16;2],uids:&[String;2])->SmokeResult<()> { + use crate::{DialogBridge,ui::shell::{forms,Entity,Operation}}; + use super::key_profiles::until; + use teamspeach_core::admin::{AdminCommand,Properties}; + let key=&tabs[0];let peer=BETA14_PARTICIPANTS[1]; + view_muted_beta14_tab(runtime,ui,key,0).await?; + let roster=|view:usize|runtime.snapshot().connections.get(&tabs[view].connection_id).filter(|t|t.key==tabs[view] && t.is_connected()).and_then(|t|t.server.clone()); + let lobby=roster(0).and_then(|s|s["own_channel_id"].as_u64()).ok_or("missing lobby")?; + let at=|locations:[u64;2]|(0..2).all(|view|roster(view).is_some_and(|s|s["own_channel_id"]==locations[view] && s["clients"].as_array().is_some_and(|rows|(0..2).all(|i| + rows.iter().any(|r|r["id"]==clients[i] && r["uid"]==uids[i] && r["channel_id"]==locations[i]))))); + let move_offered=||runtime.snapshot().tree.iter().find(|e|e.row.title==peer).map(|e|e.row.actions.iter().any(|a|a.operation==Operation::ClientMove)); + until("same-channel guest has no move action",||at([lobby,lobby]) && move_offered()==Some(false)).await?; + let room=format!("Move-{}",uuid::Uuid::new_v4().simple()); + let properties=Properties::channel_create(serde_json::json!({"channel_name":room}).as_object().unwrap().clone()).map_err(|e|e.message)?; + pace_beta14().await?; + let reply=owner.request(key,Command::Admin(AdminCommand::ChannelCreate{generation:key.generation,parent_id:0,properties})).await.map_err(|e|e.message)?; + let dest=reply["channel_id"].as_u64().filter(|id|*id!=0 && *id!=lobby).ok_or("missing temporary destination")?; + until("other-channel guest has move action",||at([dest,lobby]) && move_offered()==Some(true)).await?; + let dialog=ui.global::();let title=runtime.snapshot().catalog.text(forms::label_key(Operation::ClientMove)); + let open=async ||->SmokeResult<()> { + pace_beta14().await?; + invoke_tree_info_menu(runtime,ui,peer,Operation::ClientMove).await?; + until("move confirmation for original guest and destination",||dialog.get_visible() && dialog.get_title()==title && + runtime.snapshot().dialog.as_ref().is_some_and(|f|f.operation==Operation::ClientMove && f.target.session.as_ref()==Some(key) && f.target.own_channel_id==Some(dest) && + matches!(&f.target.entity,Entity::Client{id,uid,channel_id} if *id==clients[1] && uid==&uids[1] && *channel_id==lobby)) && + !dialog.get_fields().iter().any(|f|f.id=="channel_password")).await + }; + open().await?;rendered_form_button(ui,&title,dialog.get_cancel_label().as_str())?; + until("cancelled move leaves both guests in place",||!dialog.get_visible() && at([dest,lobby])).await?; + open().await?;pace_beta14().await?; + rendered_form_button(ui,&title,dialog.get_submit_label().as_str())?; + until("server move outcome",||(!dialog.get_visible() && at([dest,dest])) || (dialog.get_visible() && !dialog.get_busy() && !dialog.get_error().is_empty())).await?; + if dialog.get_visible(){ + let error=dialog.get_error(); + if !error.contains("PermissionsClientInsufficient") || !at([dest,lobby]){return Err(format!("unexpected move refusal: {error}"));} + eprintln!("beta14 participant move: guest permission refusal; both channels unchanged"); + rendered_form_button(ui,&title,dialog.get_cancel_label().as_str())?; + }else{ + eprintln!("beta14 participant move: acknowledged on both rosters"); + pace_beta14().await?;owner.request(&tabs[1],Command::JoinChannel{channel_id:lobby,password:None}).await.map_err(|e|e.message)?; + } + until("peer back in lobby",||at([dest,lobby]) && !dialog.get_visible()).await?; + open().await?;pace_beta14().await?; + owner.request(key,Command::JoinChannel{channel_id:lobby,password:None}).await.map_err(|e|e.message)?; + until("captured destination no longer current",||at([lobby,lobby])).await?; + rendered_form_button(ui,&title,dialog.get_submit_label().as_str())?; + until("stale move reported in editor",||dialog.get_visible() && !dialog.get_busy() && dialog.get_error()==crate::app::runtime::context::changed().message).await?; + if !at([lobby,lobby]){return Err("stale move changed a guest's channel".into());} + rendered_form_button(ui,&title,dialog.get_cancel_label().as_str())?; + Ok(()) +} + #[cfg(target_os = "windows")] pub(super) async fn pace_beta14() -> SmokeResult<()> { // Both disposable guests share beta14's loopback command budget. diff --git a/native/src/ui/application.rs b/native/src/ui/application.rs index 71cf58c..0f863b4 100644 --- a/native/src/ui/application.rs +++ b/native/src/ui/application.rs @@ -47,7 +47,7 @@ pub fn bind(runtime:Arc,generation:u64)->Result{ + shell::ShellAction::Submit{ref editor_id, ref target, operation,..} if shell::forms::tracked_participant(operation)=>{ let (id,target)=(editor_id.clone(),target.clone()); let command=crate::app::runtime::RuntimeCommand::AttachmentShell{action,ui_generation:generation}; if let Err(error)=runtime.enqueue(command) { @@ -76,7 +76,7 @@ pub fn bind(runtime:Arc,generation:u64)->Result{ diff --git a/native/src/ui/shell.rs b/native/src/ui/shell.rs index b448980..34c2604 100644 --- a/native/src/ui/shell.rs +++ b/native/src/ui/shell.rs @@ -21,7 +21,7 @@ impl Editor { self.form=form; } fn can_cancel(&self) -> bool { - if let Some(volume)=&self.volume { !volume.closing } else { !self.form.busy || !matches!(self.form.operation,Operation::ClientPoke|Operation::ClientCommander) } + if let Some(volume)=&self.volume { !volume.closing } else { !self.form.busy || !forms::tracked_participant(self.form.operation) } } } @@ -440,7 +440,7 @@ pub fn bind(ui:&AppWindow,emit:Arc)->ShellBinding else if cfg!(any(target_os="android",target_os="ios")){e(ShellAction::Invoke{target:action.target.clone(),operation:Operation::StreamPopout});} else if let Err(error)=open_popout(&ui,&mut s,&stream){ui.global::().set_error(error.into());} } - }else if matches!(action.operation,Operation::ClientPoke|Operation::ClientCommander|Operation::ClientVolume) { + }else if forms::tracked_participant(action.operation) || action.operation==Operation::ClientVolume { e(ShellAction::Invoke{target:action.target,operation:action.operation}); }else if let Some(form)=action.form{s.editor=Some(Editor::new(form));project_editor(&ui,&mut s);} else{e(ShellAction::Invoke{target:action.target,operation:action.operation});} diff --git a/native/src/ui/shell/forms.rs b/native/src/ui/shell/forms.rs index 56726b6..a3faa69 100644 --- a/native/src/ui/shell/forms.rs +++ b/native/src/ui/shell/forms.rs @@ -3,7 +3,10 @@ use super::super::i18n::Catalog; use teamspeach_core::menu::{MAX_POKE_BYTES, valid_poke_message}; pub(crate) fn tracks_server_ack(operation: Operation) -> bool { - matches!(operation, Operation::ChannelEdit | Operation::ServerEdit | Operation::SetNickname | Operation::ClientPoke | Operation::ClientCommander) + matches!(operation, Operation::ChannelEdit | Operation::ServerEdit | Operation::SetNickname) || tracked_participant(operation) +} +pub(crate) fn tracked_participant(operation: Operation) -> bool { + matches!(operation,Operation::ClientMove|Operation::ClientPoke|Operation::ClientCommander) } pub fn label_key(operation: Operation) -> &'static str {