BlueGit

ict rusty-teams

fix(channel): right-click on a post opens reply in thread or the actions menu

- post cards wire the message context menu when right-click opens actions
- otherwise right-click opens the inline reply in thread instead of a hidden chat quote
- reply closures run deferred: updating the window inside its own mouse event failed silently

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-16 · 2 weeks ago

Hash
dab8446722d7c68e3f25b73e91f52c4e08c5cc06
Parent
144ed1a9
2 files changed +54 −14
crates/app/src/views/conversation/render_env.rs +40 −12
@@ -289,12 +289,14 @@ impl RenderEnv {
289 289 let (view, key, handle) = (view.clone(), message.key.clone(), window.window_handle());
290 290 boxed(move |cx| {
291 291 let (view, key) = (view.clone(), key.clone());
292 handle
293 .update(cx, move |_, window, cx| {
294 view.update(cx, |this, cx| this.begin_reply(&key, window, cx))
295 .ok();
296 })
297 .ok();
292 cx.defer(move |cx| {
293 handle
294 .update(cx, move |_, window, cx| {
295 view.update(cx, |this, cx| this.begin_reply(&key, window, cx))
296 .ok();
297 })
298 .ok();
299 });
298 300 })
299 301 });
300 302 let files = (is_real && !message.deleted && !message.files.is_empty())
@@ -535,19 +537,45 @@ impl RenderEnv {
535 537 .as_ref()
536 538 .filter(|(open_root, _)| *open_root == root_key)
537 539 .map(|(_, composer)| self.inline_reply_editor(composer));
540 let mut root = self.message_actions(&post.root, window, cx);
541 let mut replies: Vec<RowActions> = post
542 .replies
543 .iter()
544 .map(|reply| self.message_actions(reply, window, cx))
545 .collect();
546 if !is_local {
547 for actions in std::iter::once(&mut root).chain(replies.iter_mut()) {
548 if actions.reply.is_some() {
549 actions.reply = Some(self.reply_in_thread(root_key.clone(), window));
550 }
551 }
552 }
538 553 PostActions {
539 root: self.message_actions(&post.root, window, cx),
540 replies: post
541 .replies
542 .iter()
543 .map(|reply| self.message_actions(reply, window, cx))
544 .collect(),
554 root,
555 replies,
545 556 open_thread,
546 557 open_reply,
547 558 reply_editor,
548 559 }
549 560 }
550 561
562 fn reply_in_thread(&self, root_key: String, window: &Window) -> Box<dyn Fn(&mut App)> {
563 let (view, handle) = (self.view.clone(), window.window_handle());
564 boxed(move |cx| {
565 let (view, root_key) = (view.clone(), root_key.clone());
566 cx.defer(move |cx| {
567 handle
568 .update(cx, move |_, window, cx| {
569 view.update(cx, |this, cx| {
570 this.open_reply_editor(root_key, None, window, cx)
571 })
572 .ok();
573 })
574 .ok();
575 });
576 })
577 }
578
551 579 fn inline_reply_editor(&self, composer: &Entity<Composer>) -> AnyElement {
552 580 composer.clone().into_any_element()
553 581 }
@@ -289,12 +289,14 @@ impl RenderEnv {
289 let (view, key, handle) = (view.clone(), message.key.clone(), window.window_handle());
289 let (view, key, handle) = (view.clone(), message.key.clone(), window.window_handle());
290 boxed(move |cx| {
290 boxed(move |cx| {
291 let (view, key) = (view.clone(), key.clone());
291 let (view, key) = (view.clone(), key.clone());
292 handle
292 cx.defer(move |cx| {
293 .update(cx, move |_, window, cx| {
293 handle
294 view.update(cx, |this, cx| this.begin_reply(&key, window, cx))
294 .update(cx, move |_, window, cx| {
295 .ok();
295 view.update(cx, |this, cx| this.begin_reply(&key, window, cx))
296 })
296 .ok();
297 .ok();
297 })
298 .ok();
299 });
298 })
300 })
299 });
301 });
300 let files = (is_real && !message.deleted && !message.files.is_empty())
302 let files = (is_real && !message.deleted && !message.files.is_empty())
@@ -535,19 +537,45 @@ impl RenderEnv {
535 .as_ref()
537 .as_ref()
536 .filter(|(open_root, _)| *open_root == root_key)
538 .filter(|(open_root, _)| *open_root == root_key)
537 .map(|(_, composer)| self.inline_reply_editor(composer));
539 .map(|(_, composer)| self.inline_reply_editor(composer));
540 let mut root = self.message_actions(&post.root, window, cx);
541 let mut replies: Vec<RowActions> = post
542 .replies
543 .iter()
544 .map(|reply| self.message_actions(reply, window, cx))
545 .collect();
546 if !is_local {
547 for actions in std::iter::once(&mut root).chain(replies.iter_mut()) {
548 if actions.reply.is_some() {
549 actions.reply = Some(self.reply_in_thread(root_key.clone(), window));
550 }
551 }
552 }
538 PostActions {
553 PostActions {
539 root: self.message_actions(&post.root, window, cx),
554 root,
540 replies: post
555 replies,
541 .replies
542 .iter()
543 .map(|reply| self.message_actions(reply, window, cx))
544 .collect(),
545 open_thread,
556 open_thread,
546 open_reply,
557 open_reply,
547 reply_editor,
558 reply_editor,
548 }
559 }
549 }
560 }
550
561
562 fn reply_in_thread(&self, root_key: String, window: &Window) -> Box<dyn Fn(&mut App)> {
563 let (view, handle) = (self.view.clone(), window.window_handle());
564 boxed(move |cx| {
565 let (view, root_key) = (view.clone(), root_key.clone());
566 cx.defer(move |cx| {
567 handle
568 .update(cx, move |_, window, cx| {
569 view.update(cx, |this, cx| {
570 this.open_reply_editor(root_key, None, window, cx)
571 })
572 .ok();
573 })
574 .ok();
575 });
576 })
577 }
578
551 fn inline_reply_editor(&self, composer: &Entity<Composer>) -> AnyElement {
579 fn inline_reply_editor(&self, composer: &Entity<Composer>) -> AnyElement {
552 composer.clone().into_any_element()
580 composer.clone().into_any_element()
553 }
581 }
crates/app/src/views/post_card.rs +14 −2
@@ -282,6 +282,8 @@ fn message_block(
282 282 timeline,
283 283 agent_run,
284 284 reaction_proposal,
285 open_context,
286 context_menu,
285 287 ..
286 288 } = actions;
287 289 let note = delivery_note(row, delivery, index);
@@ -371,9 +373,19 @@ fn message_block(
371 373 .when_some(hovered, |block, hovered| {
372 374 block.on_hover(move |is_hovered, _, cx| hovered(*is_hovered, cx))
373 375 })
374 .when_some(reply, |block, reply| {
375 block.on_mouse_down(MouseButton::Right, move |_, _, cx| reply(cx))
376 .map(|block| match (open_context, reply) {
377 (Some(open_context), _) => {
378 block.on_mouse_down(MouseButton::Right, move |event, _, cx| {
379 cx.stop_propagation();
380 open_context(event.position, cx)
381 })
382 }
383 (None, Some(reply)) => {
384 block.on_mouse_down(MouseButton::Right, move |_, _, cx| reply(cx))
385 }
386 (None, None) => block,
376 387 })
388 .children(context_menu)
377 389 .child(layout)
378 390 .when_some(menu, |block, menu| {
379 391 block.child(placed_toolbar(
@@ -282,6 +282,8 @@ fn message_block(
282 timeline,
282 timeline,
283 agent_run,
283 agent_run,
284 reaction_proposal,
284 reaction_proposal,
285 open_context,
286 context_menu,
285 ..
287 ..
286 } = actions;
288 } = actions;
287 let note = delivery_note(row, delivery, index);
289 let note = delivery_note(row, delivery, index);
@@ -371,9 +373,19 @@ fn message_block(
371 .when_some(hovered, |block, hovered| {
373 .when_some(hovered, |block, hovered| {
372 block.on_hover(move |is_hovered, _, cx| hovered(*is_hovered, cx))
374 block.on_hover(move |is_hovered, _, cx| hovered(*is_hovered, cx))
373 })
375 })
374 .when_some(reply, |block, reply| {
376 .map(|block| match (open_context, reply) {
375 block.on_mouse_down(MouseButton::Right, move |_, _, cx| reply(cx))
377 (Some(open_context), _) => {
378 block.on_mouse_down(MouseButton::Right, move |event, _, cx| {
379 cx.stop_propagation();
380 open_context(event.position, cx)
381 })
382 }
383 (None, Some(reply)) => {
384 block.on_mouse_down(MouseButton::Right, move |_, _, cx| reply(cx))
385 }
386 (None, None) => block,
376 })
387 })
388 .children(context_menu)
377 .child(layout)
389 .child(layout)
378 .when_some(menu, |block, menu| {
390 .when_some(menu, |block, menu| {
379 block.child(placed_toolbar(
391 block.child(placed_toolbar(