fix(calls): menu only on meetings with a link, filter history by reference
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -75,8 +75,8 @@ fn known_names(chats: &[ChatRecord]) -> HashMap<&str, &str> {
75
75
.collect()
76
76
}
77
77
78
pub fn call_rows(
79
entries: &[CallLogEntry],
78
pub fn call_rows<'a>(
79
entries: impl IntoIterator<Item = &'a CallLogEntry>,
80
80
chats: &[ChatRecord],
81
81
now: DateTime<Utc>,
82
82
offset: FixedOffset,
@@ -86,7 +86,7 @@ pub fn call_rows(
86
86
chats.iter().map(|chat| (chat.id.as_str(), chat)).collect();
87
87
let today = now.with_timezone(&offset).date_naive();
88
88
entries
89
.iter()
89
.into_iter()
90
90
.map(|entry| {
91
91
let user_id = entry
92
92
.peer_id
@@ -75,8 +75,8 @@ fn known_names(chats: &[ChatRecord]) -> HashMap<&str, &str> {75
.collect()75
.collect()76
}76
}77
77
78
pub fn call_rows(78
pub fn call_rows<'a>(79
entries: &[CallLogEntry],79
entries: impl IntoIterator<Item = &'a CallLogEntry>,80
chats: &[ChatRecord],80
chats: &[ChatRecord],81
now: DateTime<Utc>,81
now: DateTime<Utc>,82
offset: FixedOffset,82
offset: FixedOffset,@@ -86,7 +86,7 @@ pub fn call_rows(86
chats.iter().map(|chat| (chat.id.as_str(), chat)).collect();86
chats.iter().map(|chat| (chat.id.as_str(), chat)).collect();87
let today = now.with_timezone(&offset).date_naive();87
let today = now.with_timezone(&offset).date_naive();88
entries88
entries89
.iter()89
.into_iter()90
.map(|entry| {90
.map(|entry| {91
let user_id = entry91
let user_id = entry92
.peer_id92
.peer_id@@ -159,12 +159,9 @@ impl CallsList {
159
159
}
160
160
entries.push(ListEntry::Section(RECENT_TITLE));
161
161
entries.push(ListEntry::Filters(self.filter));
162
let filtered: Vec<CallLogEntry> = history
163
.iter()
164
.filter(|entry| self.filter.admits(entry))
165
.cloned()
166
.collect();
167
let calls = call_rows(&filtered, chats, now, offset);
162
let filter = self.filter;
163
let admitted = history.iter().filter(|entry| filter.admits(entry));
164
let calls = call_rows(admitted, chats, now, offset);
168
165
if calls.is_empty() {
169
166
entries.push(ListEntry::Empty(self.filter.empty_text()));
170
167
}
@@ -159,12 +159,9 @@ impl CallsList {159
}159
}160
entries.push(ListEntry::Section(RECENT_TITLE));160
entries.push(ListEntry::Section(RECENT_TITLE));161
entries.push(ListEntry::Filters(self.filter));161
entries.push(ListEntry::Filters(self.filter));162
let filtered: Vec<CallLogEntry> = history162
let filter = self.filter;163
.iter()163
let admitted = history.iter().filter(|entry| filter.admits(entry));164
.filter(|entry| self.filter.admits(entry))164
let calls = call_rows(admitted, chats, now, offset);165
.cloned()166
.collect();167
let calls = call_rows(&filtered, chats, now, offset);168
if calls.is_empty() {165
if calls.is_empty() {169
entries.push(ListEntry::Empty(self.filter.empty_text()));166
entries.push(ListEntry::Empty(self.filter.empty_text()));170
}167
}@@ -367,7 +367,7 @@ fn agenda_row(
367
367
let join_state = state.clone();
368
368
let join_row = row.clone();
369
369
let menu_join_url = row.join_url.clone();
370
h_flex()
370
let line = h_flex()
371
371
.id(SharedString::from(format!("agenda-{}", row.key)))
372
372
.mx(px(6.))
373
373
.h(px(AGENDA_ROW_HEIGHT))
@@ -432,19 +432,21 @@ fn agenda_row(
432
432
})
433
433
.on_click(move |_, _, cx| {
434
434
click_state.update(cx, |state, cx| state.open_agenda_chat(&click_row, cx));
435
})
436
.context_menu(move |popup, _, _| {
437
popup.when_some(menu_join_url.clone(), |popup, join_url| {
438
popup.item(
439
PopupMenuItem::new("Copy meeting link")
440
.icon(menu_icon(IconName::Link))
441
.on_click(move |_, _, cx| {
442
cx.write_to_clipboard(ClipboardItem::new_string(join_url.clone()));
443
}),
444
)
445
})
446
})
447
.into_any_element()
435
});
436
let Some(join_url) = menu_join_url else {
437
return line.into_any_element();
438
};
439
line.context_menu(move |popup, _, _| {
440
let join_url = join_url.clone();
441
popup.item(
442
PopupMenuItem::new("Copy meeting link")
443
.icon(menu_icon(IconName::Link))
444
.on_click(move |_, _, cx| {
445
cx.write_to_clipboard(ClipboardItem::new_string(join_url.clone()));
446
}),
447
)
448
})
449
.into_any_element()
448
450
}
449
451
450
452
pub fn calls_body(
@@ -367,7 +367,7 @@ fn agenda_row(367
let join_state = state.clone();367
let join_state = state.clone();368
let join_row = row.clone();368
let join_row = row.clone();369
let menu_join_url = row.join_url.clone();369
let menu_join_url = row.join_url.clone();370
h_flex()370
let line = h_flex()371
.id(SharedString::from(format!("agenda-{}", row.key)))371
.id(SharedString::from(format!("agenda-{}", row.key)))372
.mx(px(6.))372
.mx(px(6.))373
.h(px(AGENDA_ROW_HEIGHT))373
.h(px(AGENDA_ROW_HEIGHT))@@ -432,19 +432,21 @@ fn agenda_row(432
})432
})433
.on_click(move |_, _, cx| {433
.on_click(move |_, _, cx| {434
click_state.update(cx, |state, cx| state.open_agenda_chat(&click_row, cx));434
click_state.update(cx, |state, cx| state.open_agenda_chat(&click_row, cx));435
})435
});436
.context_menu(move |popup, _, _| {436
let Some(join_url) = menu_join_url else {437
popup.when_some(menu_join_url.clone(), |popup, join_url| {437
return line.into_any_element();438
popup.item(438
};439
PopupMenuItem::new("Copy meeting link")439
line.context_menu(move |popup, _, _| {440
.icon(menu_icon(IconName::Link))440
let join_url = join_url.clone();441
.on_click(move |_, _, cx| {441
popup.item(442
cx.write_to_clipboard(ClipboardItem::new_string(join_url.clone()));442
PopupMenuItem::new("Copy meeting link")443
}),443
.icon(menu_icon(IconName::Link))444
)444
.on_click(move |_, _, cx| {445
})445
cx.write_to_clipboard(ClipboardItem::new_string(join_url.clone()));446
})446
}),447
.into_any_element()447
)448
})449
.into_any_element()448
}450
}449
451
450
pub fn calls_body(452
pub fn calls_body(