commit
Some checks failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled

This commit is contained in:
Mikhail Kilin
2026-02-02 03:18:55 +03:00
parent 9465f067fe
commit 2980e52113
3 changed files with 334 additions and 13 deletions

View File

@@ -589,9 +589,10 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
app.last_typing_sent = None;
// Отменяем typing status
app.td_client
.send_chat_action(ChatId::new(chat_id), ChatAction::Cancel)
.await;
let _ = tokio::time::timeout(
Duration::from_millis(100),
app.td_client.send_chat_action(ChatId::new(chat_id), ChatAction::Cancel)
).await;
match with_timeout_msg(
Duration::from_secs(5),
@@ -679,13 +680,17 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
if let Some(chat_id) = app.selected_chat_id {
if !app.message_input.is_empty() && !app.is_editing() && !app.is_replying() {
let draft_text = app.message_input.clone();
let _ = app.td_client.set_draft_message(chat_id, draft_text).await;
// Timeout чтобы не блокировать UI в тестах
let _ = tokio::time::timeout(
Duration::from_millis(100),
app.td_client.set_draft_message(chat_id, draft_text)
).await;
} else if app.message_input.is_empty() {
// Очищаем черновик если инпут пустой
let _ = app
.td_client
.set_draft_message(chat_id, String::new())
.await;
let _ = tokio::time::timeout(
Duration::from_millis(100),
app.td_client.set_draft_message(chat_id, String::new())
).await;
}
}
app.close_chat();
@@ -859,9 +864,11 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
.unwrap_or(true);
if should_send_typing {
if let Some(chat_id) = app.get_selected_chat_id() {
app.td_client
.send_chat_action(ChatId::new(chat_id), ChatAction::Typing)
.await;
// Используем короткий timeout чтобы не блокировать UI (особенно в тестах)
let _ = tokio::time::timeout(
Duration::from_millis(100),
app.td_client.send_chat_action(ChatId::new(chat_id), ChatAction::Typing)
).await;
app.last_typing_sent = Some(Instant::now());
}
}
@@ -942,7 +949,7 @@ pub async fn handle(app: &mut App, key: KeyEvent) {
KeyCode::Down | KeyCode::Char('j') | KeyCode::Char('о') => {
app.next_chat();
}
KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('ц') => {
KeyCode::Up | KeyCode::Char('k') | KeyCode::Char('р') => {
app.previous_chat();
}
// Цифры 1-9 - переключение папок