Fix @-mentioning threads when their summary isn't ready yet (#36664)

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2025-08-21 10:57:28 +02:00 committed by Joseph T. Lyons
parent b7783efc77
commit 8c6a1d143c
2 changed files with 5 additions and 14 deletions

View file

@ -1269,18 +1269,12 @@ mod tests {
let model = Arc::new(FakeLanguageModel::default());
let summary_model = Arc::new(FakeLanguageModel::default());
thread.update(cx, |thread, cx| {
thread.set_model(model, cx);
thread.set_summarization_model(Some(summary_model), cx);
thread.set_model(model.clone(), cx);
thread.set_summarization_model(Some(summary_model.clone()), cx);
});
cx.run_until_parked();
assert_eq!(history_entries(&history_store, cx), vec![]);
let model = thread.read_with(cx, |thread, _| thread.model().unwrap().clone());
let model = model.as_fake();
let summary_model = thread.read_with(cx, |thread, _| {
thread.summarization_model().unwrap().clone()
});
let summary_model = summary_model.as_fake();
let send = acp_thread.update(cx, |thread, cx| {
thread.send(
vec![

View file

@ -629,15 +629,11 @@ impl MessageEditor {
.shared();
self.mention_set.insert_thread(id.clone(), task.clone());
self.mention_set.insert_uri(crease_id, uri);
let editor = self.editor.clone();
cx.spawn_in(window, async move |this, cx| {
if task.await.notify_async_err(cx).is_some() {
this.update(cx, |this, _| {
this.mention_set.insert_uri(crease_id, uri);
})
.ok();
} else {
if task.await.notify_async_err(cx).is_none() {
editor
.update(cx, |editor, cx| {
editor.display_map.update(cx, |display_map, cx| {
@ -648,6 +644,7 @@ impl MessageEditor {
.ok();
this.update(cx, |this, _| {
this.mention_set.thread_summaries.remove(&id);
this.mention_set.uri_by_crease_id.remove(&crease_id);
})
.ok();
}