fix(chat): meeting and recording events as Teams notice lines with recap card
- Meeting/recording events render as one muted 12px line like Teams: Fluent icon in the avatar column, "Thursday 11:45" stamp, text, bold duration; 1:1/group calls keep their card - Texts as Teams: "X started recording.", "X stopped recording." (or "Recording stopped." when it stops with the meeting end), "Meeting ended: 9m 46s", "Recording has been saved to X's OneDrive and will expire in N days." - Recap card under "Meeting ended" with title, date (calendar occurrence or call times), share, View recap, Content + Transcript, thumbnail with duration and expiry; sizes and colours from the Teams web DOM - Expiry from the Recap API (SharePoint _ExpirationDate) for the 3 newest recordings - Channel thread and feed replies use the same notice line; feed Meet now root keeps its card - Demo standup mirrors the reference sequence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -8,7 +8,7 @@ macro_rules! symbols {
8
8
};
9
9
}
10
10
11
const SYMBOLS: [(&str, &[u8]); 50] = symbols![
11
const SYMBOLS: [(&str, &[u8]); 53] = symbols![
12
12
"done",
13
13
"done_all",
14
14
"keyboard_return",
@@ -55,10 +55,13 @@ const SYMBOLS: [(&str, &[u8]); 50] = symbols![
55
55
"call",
56
56
"call_missed",
57
57
"videocam",
58
"radio_button_checked",
59
"stop_circle",
60
"play_arrow",
61
"description",
58
"fluent_video",
59
"fluent_record",
60
"fluent_record_stop",
61
"fluent_cloud_arrow_up",
62
"fluent_share",
63
"fluent_clock",
64
"fluent_document_text",
62
65
];
63
66
64
67
pub struct AppAssets;
@@ -8,7 +8,7 @@ macro_rules! symbols {8
};8
};9
}9
}10
10
11
const SYMBOLS: [(&str, &[u8]); 50] = symbols![11
const SYMBOLS: [(&str, &[u8]); 53] = symbols![12
"done",12
"done",13
"done_all",13
"done_all",14
"keyboard_return",14
"keyboard_return",@@ -55,10 +55,13 @@ const SYMBOLS: [(&str, &[u8]); 50] = symbols![55
"call",55
"call",56
"call_missed",56
"call_missed",57
"videocam",57
"videocam",58
"radio_button_checked",58
"fluent_video",59
"stop_circle",59
"fluent_record",60
"play_arrow",60
"fluent_record_stop",61
"description",61
"fluent_cloud_arrow_up",62
"fluent_share",63
"fluent_clock",64
"fluent_document_text",62
];65
];63
66
64
pub struct AppAssets;67
pub struct AppAssets;@@ -1,9 +1,17 @@
1
1
use std::collections::{HashMap, HashSet};
2
2
3
use chrono::{DateTime, FixedOffset, NaiveDate, Utc};
4
use store::MessageRecord;
3
5
use teams_core::{CallEvent, CallPhase, CallType, ImageRef, format_duration};
4
6
7
use crate::format;
8
5
9
const MAX_AVATARS: usize = 4;
6
const RECORDING_FALLBACK_TITLE: &str = "Meeting recording";
10
const RECAP_FALLBACK_TITLE: &str = "Meeting";
11
const RECAP_DATE_FORMAT: &str = "%A, %-d %B %Y %H:%M";
12
const RECAP_TIME_FORMAT: &str = "%H:%M";
13
const AUTO_STOP_SECONDS: i64 = 5;
14
const WEEKDAY_STAMP_DAYS: i64 = 6;
7
15
8
16
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9
17
pub enum CallIcon {
@@ -12,6 +20,7 @@ pub enum CallIcon {
12
20
Video,
13
21
Record,
14
22
RecordStop,
23
Saved,
15
24
}
16
25
17
26
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -23,11 +32,27 @@ pub struct CallParticipant {
23
32
#[derive(Debug, Clone, PartialEq, Eq)]
24
33
pub struct RecordingCard {
25
34
pub message_id: String,
26
pub title: String,
27
35
pub duration: Option<String>,
28
36
pub url: Option<String>,
29
37
pub thumbnail: Option<ImageRef>,
30
38
pub transcript: bool,
39
pub expires_in_days: Option<i64>,
40
}
41
42
/// The card Teams puts under the "Meeting ended" line of a meeting with a recording.
43
#[derive(Debug, Clone, PartialEq, Eq)]
44
pub struct RecapCard {
45
pub title: String,
46
pub date_line: String,
47
pub recording: RecordingCard,
48
}
49
50
/// A meeting or recording event as Teams draws it: one muted line, icon in the avatar column.
51
#[derive(Debug, Clone, PartialEq, Eq)]
52
pub struct CallNotice {
53
pub stamp: String,
54
pub text: String,
55
pub emphasis: Option<String>,
31
56
}
32
57
33
58
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -39,7 +64,23 @@ pub struct CallCard {
39
64
pub started: bool,
40
65
pub participants: Vec<CallParticipant>,
41
66
pub extra_participants: usize,
42
pub recording: Option<RecordingCard>,
67
pub notice: Option<CallNotice>,
68
pub recap: Option<RecapCard>,
69
}
70
71
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
72
pub struct MeetingSlot {
73
pub start: DateTime<Utc>,
74
pub end: DateTime<Utc>,
75
}
76
77
/// What the meeting rows need beyond the messages: the chat topic, the calendar occurrences
78
/// and the recording expiry the Recap tab reads, keyed by the saved recording message id.
79
#[derive(Debug, Clone, Default, PartialEq)]
80
pub struct MeetingInfo {
81
pub title: Option<String>,
82
pub slots: Vec<MeetingSlot>,
83
pub expiry_days: HashMap<String, i64>,
43
84
}
44
85
45
86
pub struct CallNames<'a> {
@@ -56,6 +97,17 @@ impl CallNames<'_> {
56
97
}
57
98
}
58
99
100
pub struct CallClock<'a> {
101
pub offset: FixedOffset,
102
pub today: NaiveDate,
103
pub meeting: &'a MeetingInfo,
104
}
105
106
struct SavedRecording {
107
message_id: String,
108
event: CallEvent,
109
}
110
59
111
/// Which call events of a timeline show as rows: Teams keeps one row per recording start and stop,
60
112
/// hides transcript notices and, for calls (not meetings), the start once the call ended.
61
113
pub struct CallTimeline {
@@ -63,10 +115,17 @@ pub struct CallTimeline {
63
115
finished: HashSet<String>,
64
116
transcripts: HashSet<String>,
65
117
newest_open_start: Option<usize>,
118
started_at: HashMap<String, DateTime<Utc>>,
119
ended_at: HashMap<String, DateTime<Utc>>,
120
saved: HashMap<String, SavedRecording>,
66
121
}
67
122
68
123
impl CallTimeline {
69
124
pub fn new(events: &[Option<CallEvent>]) -> Self {
125
Self::with_records(events, &[])
126
}
127
128
pub fn with_records(events: &[Option<CallEvent>], records: &[&MessageRecord]) -> Self {
70
129
let finished: HashSet<String> = events
71
130
.iter()
72
131
.flatten()
@@ -103,11 +162,42 @@ impl CallTimeline {
103
162
event.phase == CallPhase::Started && !finished.contains(&event.call_id)
104
163
})
105
164
});
165
let mut started_at = HashMap::new();
166
let mut ended_at = HashMap::new();
167
let mut saved = HashMap::new();
168
for (event, record) in events.iter().zip(records) {
169
let Some(event) = event else {
170
continue;
171
};
172
match event.phase {
173
CallPhase::Started => {
174
started_at
175
.entry(event.call_id.clone())
176
.or_insert(record.created_at);
177
}
178
CallPhase::Ended => {
179
ended_at.insert(event.call_id.clone(), record.created_at);
180
}
181
CallPhase::RecordingSaved => {
182
saved.insert(
183
event.call_id.clone(),
184
SavedRecording {
185
message_id: record.message_id.clone(),
186
event: event.clone(),
187
},
188
);
189
}
190
_ => {}
191
}
192
}
106
193
CallTimeline {
107
194
hidden,
108
195
finished,
109
196
transcripts,
110
197
newest_open_start,
198
started_at,
199
ended_at,
200
saved,
111
201
}
112
202
}
113
203
@@ -126,6 +216,94 @@ impl CallTimeline {
126
216
pub fn has_transcript(&self, call_id: &str) -> bool {
127
217
self.transcripts.contains(call_id)
128
218
}
219
220
/// A recording that stops with the meeting end has no one who stopped it; Teams then says
221
/// "Recording stopped." instead of naming the recorder.
222
fn stopped_by_meeting_end(&self, event: &CallEvent, created_at: DateTime<Utc>) -> bool {
223
self.ended_at.get(&event.call_id).is_some_and(|ended_at| {
224
(*ended_at - created_at).num_seconds().abs() <= AUTO_STOP_SECONDS
225
})
226
}
227
228
fn recap(
229
&self,
230
ended: &CallEvent,
231
ended_at: DateTime<Utc>,
232
clock: &CallClock,
233
) -> Option<RecapCard> {
234
if ended.phase != CallPhase::Ended || ended.call_type != CallType::Meeting {
235
return None;
236
}
237
let saved = self.saved.get(&ended.call_id)?;
238
let started_at = self
239
.started_at
240
.get(&ended.call_id)
241
.copied()
242
.or_else(|| {
243
ended
244
.duration_seconds
245
.map(|seconds| ended_at - chrono::Duration::seconds(seconds as i64))
246
})
247
.unwrap_or(ended_at);
248
let recording = recording_card(
249
&saved.event,
250
&saved.message_id,
251
self.has_transcript(&ended.call_id),
252
clock.meeting,
253
)?;
254
let title = clock
255
.meeting
256
.title
257
.clone()
258
.filter(|title| !title.trim().is_empty())
259
.or_else(|| saved.event.recording.as_ref()?.title())
260
.unwrap_or_else(|| RECAP_FALLBACK_TITLE.to_owned());
261
Some(RecapCard {
262
title,
263
date_line: recap_date_line(started_at, ended_at, clock),
264
recording,
265
})
266
}
267
}
268
269
/// Teams dates the recap card with the scheduled occurrence; without a calendar match the call's
270
/// own start and end stand in.
271
fn recap_date_line(
272
started_at: DateTime<Utc>,
273
ended_at: DateTime<Utc>,
274
clock: &CallClock,
275
) -> String {
276
let slot = clock
277
.meeting
278
.slots
279
.iter()
280
.filter(|slot| slot.start <= ended_at && slot.end >= started_at)
281
.min_by_key(|slot| (slot.start - started_at).num_seconds().abs())
282
.copied()
283
.unwrap_or(MeetingSlot {
284
start: started_at,
285
end: ended_at,
286
});
287
format!(
288
"{} - {}",
289
slot.start
290
.with_timezone(&clock.offset)
291
.format(RECAP_DATE_FORMAT),
292
slot.end
293
.with_timezone(&clock.offset)
294
.format(RECAP_TIME_FORMAT)
295
)
296
}
297
298
/// Teams writes the weekday in full on these lines ("Thursday 11:45"), unlike message times.
299
fn notice_stamp(time: DateTime<Utc>, clock: &CallClock) -> String {
300
let local = time.with_timezone(&clock.offset);
301
let days_ago = (clock.today - local.date_naive()).num_days();
302
if (2..=WEEKDAY_STAMP_DAYS).contains(&days_ago) {
303
local.format("%A %H:%M").to_string()
304
} else {
305
format::post_time_label(time, clock.today, clock.offset)
306
}
129
307
}
130
308
131
309
fn participants(event: &CallEvent, names: &CallNames) -> Vec<CallParticipant> {
@@ -143,13 +321,15 @@ fn participants(event: &CallEvent, names: &CallNames) -> Vec<CallParticipant> {
143
321
.collect()
144
322
}
145
323
146
fn recording_card(event: &CallEvent, message_id: &str, transcript: bool) -> Option<RecordingCard> {
324
fn recording_card(
325
event: &CallEvent,
326
message_id: &str,
327
transcript: bool,
328
meeting: &MeetingInfo,
329
) -> Option<RecordingCard> {
147
330
let recording = event.recording.as_ref()?;
148
331
Some(RecordingCard {
149
332
message_id: message_id.to_owned(),
150
title: recording
151
.title()
152
.unwrap_or_else(|| RECORDING_FALLBACK_TITLE.to_owned()),
153
333
duration: event
154
334
.duration_seconds
155
335
.filter(|seconds| *seconds > 0)
@@ -163,9 +343,71 @@ fn recording_card(event: &CallEvent, message_id: &str, transcript: bool) -> Opti
163
343
alt: None,
164
344
}),
165
345
transcript,
346
expires_in_days: meeting.expiry_days.get(message_id).copied(),
166
347
})
167
348
}
168
349
350
fn day_count(days: i64) -> String {
351
if days == 1 {
352
"1 day".to_owned()
353
} else {
354
format!("{days} days")
355
}
356
}
357
358
struct NoticeSource<'a> {
359
event: &'a CallEvent,
360
message_id: &'a str,
361
stopped_by_meeting_end: bool,
362
}
363
364
fn notice_text(source: NoticeSource, names: &CallNames, meeting: &MeetingInfo) -> String {
365
let NoticeSource {
366
event,
367
message_id,
368
stopped_by_meeting_end,
369
} = source;
370
let initiator = || {
371
names.name(
372
event.initiator_id.as_deref(),
373
event.initiator_name.as_deref(),
374
)
375
};
376
match event.phase {
377
CallPhase::Ended => format!("{}:", event.title(false)),
378
CallPhase::RecordingStarted => match initiator() {
379
Some(name) => format!("{name} started recording."),
380
None => event.title(false).to_owned(),
381
},
382
CallPhase::RecordingStopped => match initiator().filter(|_| !stopped_by_meeting_end) {
383
Some(name) => format!("{name} stopped recording."),
384
None => format!("{}.", event.title(false)),
385
},
386
CallPhase::RecordingSaved => {
387
let saved = saved_to(event, names);
388
match meeting.expiry_days.get(message_id) {
389
Some(days) => format!("{saved} and will expire in {}.", day_count(*days)),
390
None => format!("{saved}."),
391
}
392
}
393
_ => event.title(false).to_owned(),
394
}
395
}
396
397
fn saved_to(event: &CallEvent, names: &CallNames) -> String {
398
let organizer_id = event
399
.recording
400
.as_ref()
401
.and_then(|recording| recording.organizer_id.as_deref());
402
if organizer_id.is_some() && organizer_id == names.my_user_id {
403
return "Recording has been saved to your OneDrive".to_owned();
404
}
405
match names.name(organizer_id, None) {
406
Some(owner) => format!("Recording has been saved to {owner}'s OneDrive"),
407
None => "Recording has been saved to OneDrive".to_owned(),
408
}
409
}
410
169
411
fn title(event: &CallEvent, missed: bool, names: &CallNames) -> String {
170
412
match event.phase {
171
413
CallPhase::RecordingStarted => {
@@ -177,30 +419,35 @@ fn title(event: &CallEvent, missed: bool, names: &CallNames) -> String {
177
419
None => event.title(false).to_owned(),
178
420
}
179
421
}
180
CallPhase::RecordingSaved => {
181
let organizer_id = event
182
.recording
183
.as_ref()
184
.and_then(|recording| recording.organizer_id.as_deref());
185
if organizer_id.is_some() && organizer_id == names.my_user_id {
186
return "Recording has been saved to your OneDrive".to_owned();
187
}
188
match names.name(organizer_id, None) {
189
Some(owner) => format!("Recording has been saved to {owner}'s OneDrive"),
190
None => "Recording has been saved to OneDrive".to_owned(),
191
}
192
}
422
CallPhase::RecordingSaved => saved_to(event, names),
193
423
_ => event.title(missed).to_owned(),
194
424
}
195
425
}
196
426
427
/// Teams draws meeting and recording events as one-line notices; 1:1 and group calls keep the card.
428
pub fn is_notice(event: &CallEvent) -> bool {
429
event.call_type == CallType::Meeting || event.is_recording()
430
}
431
432
pub struct CallSource<'a> {
433
pub event: &'a CallEvent,
434
pub message_id: &'a str,
435
pub created_at: DateTime<Utc>,
436
pub time: &'a str,
437
}
438
197
439
pub fn call_card(
198
event: &CallEvent,
199
message_id: &str,
200
time: &str,
440
source: CallSource,
201
441
names: &CallNames,
202
transcript: bool,
442
clock: &CallClock,
443
timeline: &CallTimeline,
203
444
) -> CallCard {
445
let CallSource {
446
event,
447
message_id,
448
created_at,
449
time,
450
} = source;
204
451
let missed = event.missed(names.my_user_id);
205
452
let detail = match (event.phase, event.duration_seconds) {
206
453
(CallPhase::Ended, Some(seconds)) if !missed => {
@@ -215,12 +462,29 @@ pub fn call_card(
215
462
};
216
463
let extra_participants = people.len().saturating_sub(MAX_AVATARS);
217
464
people.truncate(MAX_AVATARS);
465
let notice = is_notice(event).then(|| CallNotice {
466
stamp: notice_stamp(created_at, clock),
467
text: notice_text(
468
NoticeSource {
469
event,
470
message_id,
471
stopped_by_meeting_end: timeline.stopped_by_meeting_end(event, created_at),
472
},
473
names,
474
clock.meeting,
475
),
476
emphasis: event
477
.duration_seconds
478
.filter(|_| event.phase == CallPhase::Ended)
479
.map(format_duration),
480
});
218
481
CallCard {
219
482
title: title(event, missed, names),
220
483
detail,
221
484
icon: match (missed, event.phase, event.call_type) {
222
485
(true, _, _) => CallIcon::Missed,
223
(false, CallPhase::RecordingStarted | CallPhase::RecordingSaved, _) => CallIcon::Record,
486
(false, CallPhase::RecordingStarted, _) => CallIcon::Record,
487
(false, CallPhase::RecordingSaved, _) => CallIcon::Saved,
224
488
(false, CallPhase::RecordingStopped | CallPhase::TranscriptStarted, _) => {
225
489
CallIcon::RecordStop
226
490
}
@@ -231,14 +495,14 @@ pub fn call_card(
231
495
started: event.phase == CallPhase::Started,
232
496
participants: people,
233
497
extra_participants,
234
recording: (event.phase == CallPhase::RecordingSaved)
235
.then(|| recording_card(event, message_id, transcript))
236
.flatten(),
498
recap: timeline.recap(event, created_at, clock),
499
notice,
237
500
}
238
501
}
239
502
240
503
#[cfg(test)]
241
504
mod tests {
505
use chrono::TimeZone;
242
506
use teams_core::Recording;
243
507
244
508
use super::*;
@@ -257,7 +521,7 @@ mod tests {
257
521
}
258
522
}
259
523
260
fn fixture_events() -> Vec<Option<CallEvent>> {
524
fn fixture_records() -> Vec<MessageRecord> {
261
525
let path = format!(
262
526
"{}/../core/tests/fixtures/call_events/meeting_chat_recording.json",
263
527
env!("CARGO_MANIFEST_DIR")
@@ -269,7 +533,10 @@ mod tests {
269
533
.unwrap()
270
534
.iter()
271
535
.rev()
272
.map(|message| CallEvent::from_graph(&message["eventDetail"]))
536
.map(|message| {
537
let message: graph::Message = serde_json::from_value(message.clone()).unwrap();
538
teams_core::message_record("meeting-chat", &message).unwrap()
539
})
273
540
.collect()
274
541
}
275
542
@@ -286,93 +553,197 @@ mod tests {
286
553
])
287
554
}
288
555
289
#[test]
290
fn recorded_meeting_shows_like_teams() {
291
let events = fixture_events();
292
let timeline = CallTimeline::new(&events);
556
fn cards(records: &[MessageRecord], meeting: &MeetingInfo) -> Vec<CallCard> {
557
let events: Vec<Option<CallEvent>> = records.iter().map(teams_core::call_event).collect();
558
let timeline = CallTimeline::with_records(&events, &records.iter().collect::<Vec<_>>());
293
559
let names = names();
294
560
let lookup = CallNames {
295
561
my_user_id: Some("me"),
296
562
names: &names,
297
563
};
298
let titles: Vec<String> = events
564
let clock = CallClock {
565
offset: FixedOffset::east_opt(0).unwrap(),
566
today: NaiveDate::from_ymd_opt(2026, 10, 30).unwrap(),
567
meeting,
568
};
569
events
299
570
.iter()
571
.zip(records)
300
572
.enumerate()
301
573
.filter(|(index, _)| !timeline.hides(*index))
302
.map(|(_, event)| {
303
let event = event.as_ref().unwrap();
574
.map(|(_, (event, record))| {
304
575
call_card(
305
event,
306
"m",
307
"16:15",
576
CallSource {
577
event: event.as_ref().unwrap(),
578
message_id: &record.message_id,
579
created_at: record.created_at,
580
time: "16:15",
581
},
308
582
&lookup,
309
timeline.has_transcript(&event.call_id),
583
&clock,
584
&timeline,
310
585
)
311
.title
312
586
})
313
.collect();
587
.collect()
588
}
589
590
fn notice_line(card: &CallCard) -> String {
591
let notice = card.notice.as_ref().unwrap();
592
match ¬ice.emphasis {
593
Some(emphasis) => format!("{} {emphasis}", notice.text),
594
None => notice.text.clone(),
595
}
596
}
597
598
#[test]
599
fn recorded_meeting_shows_as_teams_notices() {
600
let shown = cards(&fixture_records(), &MeetingInfo::default());
601
let lines: Vec<String> = shown.iter().map(notice_line).collect();
314
602
assert_eq!(
315
titles,
603
lines,
316
604
[
317
605
"Meeting started",
318
"Sam Recorder started recording",
319
"Recording stopped",
320
"Meeting ended",
321
"Recording has been saved to Vera Organizer's OneDrive",
606
"Sam Recorder started recording.",
607
"Recording stopped.",
608
"Meeting ended: 16m 28s",
609
"Recording has been saved to Vera Organizer's OneDrive.",
322
610
]
323
611
);
612
let icons: Vec<CallIcon> = shown.iter().map(|card| card.icon).collect();
613
assert_eq!(
614
icons,
615
[
616
CallIcon::Video,
617
CallIcon::Record,
618
CallIcon::RecordStop,
619
CallIcon::Video,
620
CallIcon::Saved,
621
]
622
);
623
assert!(
624
shown
625
.iter()
626
.all(|card| card.recap.is_none() == (card.title != "Meeting ended"))
627
);
324
628
}
325
629
326
630
#[test]
327
fn saved_recording_becomes_a_card_with_transcript_and_thumbnail() {
328
let events = fixture_events();
329
let timeline = CallTimeline::new(&events);
330
let saved = events.last().unwrap().as_ref().unwrap();
331
let names = HashMap::new();
332
let lookup = CallNames {
333
my_user_id: None,
334
names: &names,
631
fn a_recording_stopped_before_the_end_names_who_stopped_it() {
632
let mut records = fixture_records();
633
for record in records.iter_mut() {
634
if teams_core::call_event(record)
635
.is_some_and(|event| event.phase == CallPhase::RecordingStopped)
636
{
637
record.created_at -= chrono::Duration::minutes(2);
638
}
639
}
640
let shown = cards(&records, &MeetingInfo::default());
641
assert_eq!(notice_line(&shown[2]), "Sam Recorder stopped recording.");
642
}
643
644
#[test]
645
fn ended_meeting_carries_the_recap_card_of_its_recording() {
646
let records = fixture_records();
647
let saved_id = records.last().unwrap().message_id.clone();
648
let meeting = MeetingInfo {
649
title: Some("Weekly sync".to_owned()),
650
slots: Vec::new(),
651
expiry_days: HashMap::from([(saved_id.clone(), 56)]),
335
652
};
336
let card = call_card(
337
saved,
338
"saved-1",
339
"16:16",
340
&lookup,
341
timeline.has_transcript(&saved.call_id),
653
let shown = cards(&records, &meeting);
654
let ended = shown
655
.iter()
656
.find(|card| card.title == "Meeting ended")
657
.unwrap();
658
let recap = ended.recap.as_ref().unwrap();
659
assert_eq!(recap.title, "Weekly sync");
660
assert_eq!(recap.recording.message_id, saved_id);
661
assert_eq!(recap.recording.duration.as_deref(), Some("13m 34s"));
662
assert_eq!(recap.recording.expires_in_days, Some(56));
663
assert!(recap.recording.transcript);
664
assert!(
665
recap
666
.recording
667
.thumbnail
668
.as_ref()
669
.unwrap()
670
.url
671
.contains("/thumbnails/")
672
);
673
assert!(shown.iter().filter(|card| card.recap.is_some()).count() == 1);
674
assert_eq!(
675
notice_line(shown.last().unwrap()),
676
"Recording has been saved to Vera Organizer's OneDrive and will expire in 56 days."
342
677
);
343
assert_eq!(card.title, "Recording has been saved to OneDrive");
344
assert_eq!(card.icon, CallIcon::Record);
345
let recording = card.recording.unwrap();
346
assert_eq!(recording.title, "Weekly team meeting");
347
assert_eq!(recording.duration.as_deref(), Some("13m 34s"));
348
assert!(recording.transcript);
349
assert_eq!(recording.message_id, "saved-1");
350
assert!(recording.thumbnail.unwrap().url.contains("/thumbnails/"));
678
}
679
680
#[test]
681
fn recap_date_prefers_the_calendar_occurrence() {
682
let started_at = Utc.with_ymd_and_hms(2026, 10, 15, 9, 46, 0).unwrap();
683
let ended_at = Utc.with_ymd_and_hms(2026, 10, 15, 9, 55, 0).unwrap();
684
let mut meeting = MeetingInfo::default();
685
let clock = |meeting: &MeetingInfo| {
686
recap_date_line(
687
started_at,
688
ended_at,
689
&CallClock {
690
offset: FixedOffset::east_opt(2 * 3600).unwrap(),
691
today: NaiveDate::from_ymd_opt(2026, 10, 17).unwrap(),
692
meeting,
693
},
694
)
695
};
696
assert_eq!(clock(&meeting), "Thursday, 15 October 2026 11:46 - 11:55");
697
meeting.slots = vec![
698
MeetingSlot {
699
start: Utc.with_ymd_and_hms(2026, 10, 14, 9, 45, 0).unwrap(),
700
end: Utc.with_ymd_and_hms(2026, 10, 14, 10, 0, 0).unwrap(),
701
},
702
MeetingSlot {
703
start: Utc.with_ymd_and_hms(2026, 10, 15, 9, 45, 0).unwrap(),
704
end: Utc.with_ymd_and_hms(2026, 10, 15, 10, 0, 0).unwrap(),
705
},
706
];
707
assert_eq!(clock(&meeting), "Thursday, 15 October 2026 11:45 - 12:00");
708
}
709
710
#[test]
711
fn notice_stamps_spell_out_the_weekday_like_teams() {
712
let meeting = MeetingInfo::default();
713
let clock = CallClock {
714
offset: FixedOffset::east_opt(0).unwrap(),
715
today: NaiveDate::from_ymd_opt(2026, 10, 17).unwrap(),
716
meeting: &meeting,
717
};
718
let stamp = |day: u32| {
719
notice_stamp(
720
Utc.with_ymd_and_hms(2026, 10, day, 11, 45, 0).unwrap(),
721
&clock,
722
)
723
};
724
assert_eq!(stamp(17), "11:45");
725
assert_eq!(stamp(16), "Yesterday 11:45");
726
assert_eq!(stamp(15), "Thursday 11:45");
351
727
}
352
728
353
729
#[test]
354
730
fn ended_meeting_lists_named_participants_up_to_four() {
355
let events = fixture_events();
356
let ended = events
731
let shown = cards(&fixture_records(), &MeetingInfo::default());
732
let ended = shown
357
733
.iter()
358
.flatten()
359
.find(|event| event.phase == CallPhase::Ended)
734
.find(|card| card.title == "Meeting ended")
360
735
.unwrap();
361
let names = HashMap::new();
362
let lookup = CallNames {
363
my_user_id: None,
364
names: &names,
365
};
366
let card = call_card(ended, "m", "16:15", &lookup, false);
367
assert_eq!(card.detail, "16m 28s \u{b7} 16:15");
368
assert_eq!(card.icon, CallIcon::Video);
369
let shown: Vec<&str> = card
736
assert_eq!(ended.detail, "16m 28s \u{b7} 16:15");
737
let shown_names: Vec<&str> = ended
370
738
.participants
371
739
.iter()
372
740
.map(|person| person.name.as_str())
373
741
.collect();
374
assert_eq!(shown, ["Person 1", "Person 2", "Person 3", "Person 4"]);
375
assert_eq!(card.extra_participants, 20);
742
assert_eq!(
743
shown_names,
744
["Person 1", "Person 2", "Person 3", "Person 4"]
745
);
746
assert_eq!(ended.extra_participants, 20);
376
747
}
377
748
378
749
#[test]
@@ -395,8 +766,9 @@ mod tests {
395
766
}
396
767
397
768
#[test]
398
fn my_own_recording_is_saved_to_my_onedrive() {
399
let mut saved = event(CallPhase::RecordingSaved, CallType::Meeting, "c");
769
fn calls_keep_their_card_and_my_recording_is_in_my_onedrive() {
770
assert!(!is_notice(&event(CallPhase::Ended, CallType::Call, "c")));
771
let mut saved = event(CallPhase::RecordingSaved, CallType::Call, "c");
400
772
saved.recording = Some(Recording {
401
773
name: None,
402
774
url: Some("https://contoso.example/rec.mp4".to_owned()),
@@ -407,11 +779,17 @@ mod tests {
407
779
my_user_id: Some("me"),
408
780
names: &names,
409
781
};
410
let card = call_card(&saved, "m", "9:00", &lookup, false);
411
assert_eq!(card.title, "Recording has been saved to your OneDrive");
412
let recording = card.recording.unwrap();
413
assert_eq!(recording.title, "Meeting recording");
414
assert_eq!(recording.thumbnail, None);
415
assert_eq!(recording.duration, None);
782
assert_eq!(
783
notice_text(
784
NoticeSource {
785
event: &saved,
786
message_id: "m",
787
stopped_by_meeting_end: false,
788
},
789
&lookup,
790
&MeetingInfo::default()
791
),
792
"Recording has been saved to your OneDrive."
793
);
416
794
}
417
795
}
@@ -1,9 +1,17 @@1
use std::collections::{HashMap, HashSet};1
use std::collections::{HashMap, HashSet};2
2
3
use chrono::{DateTime, FixedOffset, NaiveDate, Utc};4
use store::MessageRecord;3
use teams_core::{CallEvent, CallPhase, CallType, ImageRef, format_duration};5
use teams_core::{CallEvent, CallPhase, CallType, ImageRef, format_duration};4
6
7
use crate::format;8
5
const MAX_AVATARS: usize = 4;9
const MAX_AVATARS: usize = 4;6
const RECORDING_FALLBACK_TITLE: &str = "Meeting recording";10
const RECAP_FALLBACK_TITLE: &str = "Meeting";11
const RECAP_DATE_FORMAT: &str = "%A, %-d %B %Y %H:%M";12
const RECAP_TIME_FORMAT: &str = "%H:%M";13
const AUTO_STOP_SECONDS: i64 = 5;14
const WEEKDAY_STAMP_DAYS: i64 = 6;7
15
8
#[derive(Debug, Clone, Copy, PartialEq, Eq)]16
#[derive(Debug, Clone, Copy, PartialEq, Eq)]9
pub enum CallIcon {17
pub enum CallIcon {@@ -12,6 +20,7 @@ pub enum CallIcon {12
Video,20
Video,13
Record,21
Record,14
RecordStop,22
RecordStop,23
Saved,15
}24
}16
25
17
#[derive(Debug, Clone, PartialEq, Eq)]26
#[derive(Debug, Clone, PartialEq, Eq)]@@ -23,11 +32,27 @@ pub struct CallParticipant {23
#[derive(Debug, Clone, PartialEq, Eq)]32
#[derive(Debug, Clone, PartialEq, Eq)]24
pub struct RecordingCard {33
pub struct RecordingCard {25
pub message_id: String,34
pub message_id: String,26
pub title: String,27
pub duration: Option<String>,35
pub duration: Option<String>,28
pub url: Option<String>,36
pub url: Option<String>,29
pub thumbnail: Option<ImageRef>,37
pub thumbnail: Option<ImageRef>,30
pub transcript: bool,38
pub transcript: bool,39
pub expires_in_days: Option<i64>,40
}41
42
/// The card Teams puts under the "Meeting ended" line of a meeting with a recording.43
#[derive(Debug, Clone, PartialEq, Eq)]44
pub struct RecapCard {45
pub title: String,46
pub date_line: String,47
pub recording: RecordingCard,48
}49
50
/// A meeting or recording event as Teams draws it: one muted line, icon in the avatar column.51
#[derive(Debug, Clone, PartialEq, Eq)]52
pub struct CallNotice {53
pub stamp: String,54
pub text: String,55
pub emphasis: Option<String>,31
}56
}32
57
33
#[derive(Debug, Clone, PartialEq, Eq)]58
#[derive(Debug, Clone, PartialEq, Eq)]@@ -39,7 +64,23 @@ pub struct CallCard {39
pub started: bool,64
pub started: bool,40
pub participants: Vec<CallParticipant>,65
pub participants: Vec<CallParticipant>,41
pub extra_participants: usize,66
pub extra_participants: usize,42
pub recording: Option<RecordingCard>,67
pub notice: Option<CallNotice>,68
pub recap: Option<RecapCard>,69
}70
71
#[derive(Debug, Clone, Copy, PartialEq, Eq)]72
pub struct MeetingSlot {73
pub start: DateTime<Utc>,74
pub end: DateTime<Utc>,75
}76
77
/// What the meeting rows need beyond the messages: the chat topic, the calendar occurrences78
/// and the recording expiry the Recap tab reads, keyed by the saved recording message id.79
#[derive(Debug, Clone, Default, PartialEq)]80
pub struct MeetingInfo {81
pub title: Option<String>,82
pub slots: Vec<MeetingSlot>,83
pub expiry_days: HashMap<String, i64>,43
}84
}44
85
45
pub struct CallNames<'a> {86
pub struct CallNames<'a> {@@ -56,6 +97,17 @@ impl CallNames<'_> {56
}97
}57
}98
}58
99
100
pub struct CallClock<'a> {101
pub offset: FixedOffset,102
pub today: NaiveDate,103
pub meeting: &'a MeetingInfo,104
}105
106
struct SavedRecording {107
message_id: String,108
event: CallEvent,109
}110
59
/// Which call events of a timeline show as rows: Teams keeps one row per recording start and stop,111
/// Which call events of a timeline show as rows: Teams keeps one row per recording start and stop,60
/// hides transcript notices and, for calls (not meetings), the start once the call ended.112
/// hides transcript notices and, for calls (not meetings), the start once the call ended.61
pub struct CallTimeline {113
pub struct CallTimeline {@@ -63,10 +115,17 @@ pub struct CallTimeline {63
finished: HashSet<String>,115
finished: HashSet<String>,64
transcripts: HashSet<String>,116
transcripts: HashSet<String>,65
newest_open_start: Option<usize>,117
newest_open_start: Option<usize>,118
started_at: HashMap<String, DateTime<Utc>>,119
ended_at: HashMap<String, DateTime<Utc>>,120
saved: HashMap<String, SavedRecording>,66
}121
}67
122
68
impl CallTimeline {123
impl CallTimeline {69
pub fn new(events: &[Option<CallEvent>]) -> Self {124
pub fn new(events: &[Option<CallEvent>]) -> Self {125
Self::with_records(events, &[])126
}127
128
pub fn with_records(events: &[Option<CallEvent>], records: &[&MessageRecord]) -> Self {70
let finished: HashSet<String> = events129
let finished: HashSet<String> = events71
.iter()130
.iter()72
.flatten()131
.flatten()@@ -103,11 +162,42 @@ impl CallTimeline {103
event.phase == CallPhase::Started && !finished.contains(&event.call_id)162
event.phase == CallPhase::Started && !finished.contains(&event.call_id)104
})163
})105
});164
});165
let mut started_at = HashMap::new();166
let mut ended_at = HashMap::new();167
let mut saved = HashMap::new();168
for (event, record) in events.iter().zip(records) {169
let Some(event) = event else {170
continue;171
};172
match event.phase {173
CallPhase::Started => {174
started_at175
.entry(event.call_id.clone())176
.or_insert(record.created_at);177
}178
CallPhase::Ended => {179
ended_at.insert(event.call_id.clone(), record.created_at);180
}181
CallPhase::RecordingSaved => {182
saved.insert(183
event.call_id.clone(),184
SavedRecording {185
message_id: record.message_id.clone(),186
event: event.clone(),187
},188
);189
}190
_ => {}191
}192
}106
CallTimeline {193
CallTimeline {107
hidden,194
hidden,108
finished,195
finished,109
transcripts,196
transcripts,110
newest_open_start,197
newest_open_start,198
started_at,199
ended_at,200
saved,111
}201
}112
}202
}113
203
@@ -126,6 +216,94 @@ impl CallTimeline {126
pub fn has_transcript(&self, call_id: &str) -> bool {216
pub fn has_transcript(&self, call_id: &str) -> bool {127
self.transcripts.contains(call_id)217
self.transcripts.contains(call_id)128
}218
}219
220
/// A recording that stops with the meeting end has no one who stopped it; Teams then says221
/// "Recording stopped." instead of naming the recorder.222
fn stopped_by_meeting_end(&self, event: &CallEvent, created_at: DateTime<Utc>) -> bool {223
self.ended_at.get(&event.call_id).is_some_and(|ended_at| {224
(*ended_at - created_at).num_seconds().abs() <= AUTO_STOP_SECONDS225
})226
}227
228
fn recap(229
&self,230
ended: &CallEvent,231
ended_at: DateTime<Utc>,232
clock: &CallClock,233
) -> Option<RecapCard> {234
if ended.phase != CallPhase::Ended || ended.call_type != CallType::Meeting {235
return None;236
}237
let saved = self.saved.get(&ended.call_id)?;238
let started_at = self239
.started_at240
.get(&ended.call_id)241
.copied()242
.or_else(|| {243
ended244
.duration_seconds245
.map(|seconds| ended_at - chrono::Duration::seconds(seconds as i64))246
})247
.unwrap_or(ended_at);248
let recording = recording_card(249
&saved.event,250
&saved.message_id,251
self.has_transcript(&ended.call_id),252
clock.meeting,253
)?;254
let title = clock255
.meeting256
.title257
.clone()258
.filter(|title| !title.trim().is_empty())259
.or_else(|| saved.event.recording.as_ref()?.title())260
.unwrap_or_else(|| RECAP_FALLBACK_TITLE.to_owned());261
Some(RecapCard {262
title,263
date_line: recap_date_line(started_at, ended_at, clock),264
recording,265
})266
}267
}268
269
/// Teams dates the recap card with the scheduled occurrence; without a calendar match the call's270
/// own start and end stand in.271
fn recap_date_line(272
started_at: DateTime<Utc>,273
ended_at: DateTime<Utc>,274
clock: &CallClock,275
) -> String {276
let slot = clock277
.meeting278
.slots279
.iter()280
.filter(|slot| slot.start <= ended_at && slot.end >= started_at)281
.min_by_key(|slot| (slot.start - started_at).num_seconds().abs())282
.copied()283
.unwrap_or(MeetingSlot {284
start: started_at,285
end: ended_at,286
});287
format!(288
"{} - {}",289
slot.start290
.with_timezone(&clock.offset)291
.format(RECAP_DATE_FORMAT),292
slot.end293
.with_timezone(&clock.offset)294
.format(RECAP_TIME_FORMAT)295
)296
}297
298
/// Teams writes the weekday in full on these lines ("Thursday 11:45"), unlike message times.299
fn notice_stamp(time: DateTime<Utc>, clock: &CallClock) -> String {300
let local = time.with_timezone(&clock.offset);301
let days_ago = (clock.today - local.date_naive()).num_days();302
if (2..=WEEKDAY_STAMP_DAYS).contains(&days_ago) {303
local.format("%A %H:%M").to_string()304
} else {305
format::post_time_label(time, clock.today, clock.offset)306
}129
}307
}130
308
131
fn participants(event: &CallEvent, names: &CallNames) -> Vec<CallParticipant> {309
fn participants(event: &CallEvent, names: &CallNames) -> Vec<CallParticipant> {@@ -143,13 +321,15 @@ fn participants(event: &CallEvent, names: &CallNames) -> Vec<CallParticipant> {143
.collect()321
.collect()144
}322
}145
323
146
fn recording_card(event: &CallEvent, message_id: &str, transcript: bool) -> Option<RecordingCard> {324
fn recording_card(325
event: &CallEvent,326
message_id: &str,327
transcript: bool,328
meeting: &MeetingInfo,329
) -> Option<RecordingCard> {147
let recording = event.recording.as_ref()?;330
let recording = event.recording.as_ref()?;148
Some(RecordingCard {331
Some(RecordingCard {149
message_id: message_id.to_owned(),332
message_id: message_id.to_owned(),150
title: recording151
.title()152
.unwrap_or_else(|| RECORDING_FALLBACK_TITLE.to_owned()),153
duration: event333
duration: event154
.duration_seconds334
.duration_seconds155
.filter(|seconds| *seconds > 0)335
.filter(|seconds| *seconds > 0)@@ -163,9 +343,71 @@ fn recording_card(event: &CallEvent, message_id: &str, transcript: bool) -> Opti163
alt: None,343
alt: None,164
}),344
}),165
transcript,345
transcript,346
expires_in_days: meeting.expiry_days.get(message_id).copied(),166
})347
})167
}348
}168
349
350
fn day_count(days: i64) -> String {351
if days == 1 {352
"1 day".to_owned()353
} else {354
format!("{days} days")355
}356
}357
358
struct NoticeSource<'a> {359
event: &'a CallEvent,360
message_id: &'a str,361
stopped_by_meeting_end: bool,362
}363
364
fn notice_text(source: NoticeSource, names: &CallNames, meeting: &MeetingInfo) -> String {365
let NoticeSource {366
event,367
message_id,368
stopped_by_meeting_end,369
} = source;370
let initiator = || {371
names.name(372
event.initiator_id.as_deref(),373
event.initiator_name.as_deref(),374
)375
};376
match event.phase {377
CallPhase::Ended => format!("{}:", event.title(false)),378
CallPhase::RecordingStarted => match initiator() {379
Some(name) => format!("{name} started recording."),380
None => event.title(false).to_owned(),381
},382
CallPhase::RecordingStopped => match initiator().filter(|_| !stopped_by_meeting_end) {383
Some(name) => format!("{name} stopped recording."),384
None => format!("{}.", event.title(false)),385
},386
CallPhase::RecordingSaved => {387
let saved = saved_to(event, names);388
match meeting.expiry_days.get(message_id) {389
Some(days) => format!("{saved} and will expire in {}.", day_count(*days)),390
None => format!("{saved}."),391
}392
}393
_ => event.title(false).to_owned(),394
}395
}396
397
fn saved_to(event: &CallEvent, names: &CallNames) -> String {398
let organizer_id = event399
.recording400
.as_ref()401
.and_then(|recording| recording.organizer_id.as_deref());402
if organizer_id.is_some() && organizer_id == names.my_user_id {403
return "Recording has been saved to your OneDrive".to_owned();404
}405
match names.name(organizer_id, None) {406
Some(owner) => format!("Recording has been saved to {owner}'s OneDrive"),407
None => "Recording has been saved to OneDrive".to_owned(),408
}409
}410
169
fn title(event: &CallEvent, missed: bool, names: &CallNames) -> String {411
fn title(event: &CallEvent, missed: bool, names: &CallNames) -> String {170
match event.phase {412
match event.phase {171
CallPhase::RecordingStarted => {413
CallPhase::RecordingStarted => {@@ -177,30 +419,35 @@ fn title(event: &CallEvent, missed: bool, names: &CallNames) -> String {177
None => event.title(false).to_owned(),419
None => event.title(false).to_owned(),178
}420
}179
}421
}180
CallPhase::RecordingSaved => {422
CallPhase::RecordingSaved => saved_to(event, names),181
let organizer_id = event182
.recording183
.as_ref()184
.and_then(|recording| recording.organizer_id.as_deref());185
if organizer_id.is_some() && organizer_id == names.my_user_id {186
return "Recording has been saved to your OneDrive".to_owned();187
}188
match names.name(organizer_id, None) {189
Some(owner) => format!("Recording has been saved to {owner}'s OneDrive"),190
None => "Recording has been saved to OneDrive".to_owned(),191
}192
}193
_ => event.title(missed).to_owned(),423
_ => event.title(missed).to_owned(),194
}424
}195
}425
}196
426
427
/// Teams draws meeting and recording events as one-line notices; 1:1 and group calls keep the card.428
pub fn is_notice(event: &CallEvent) -> bool {429
event.call_type == CallType::Meeting || event.is_recording()430
}431
432
pub struct CallSource<'a> {433
pub event: &'a CallEvent,434
pub message_id: &'a str,435
pub created_at: DateTime<Utc>,436
pub time: &'a str,437
}438
197
pub fn call_card(439
pub fn call_card(198
event: &CallEvent,440
source: CallSource,199
message_id: &str,200
time: &str,201
names: &CallNames,441
names: &CallNames,202
transcript: bool,442
clock: &CallClock,443
timeline: &CallTimeline,203
) -> CallCard {444
) -> CallCard {445
let CallSource {446
event,447
message_id,448
created_at,449
time,450
} = source;204
let missed = event.missed(names.my_user_id);451
let missed = event.missed(names.my_user_id);205
let detail = match (event.phase, event.duration_seconds) {452
let detail = match (event.phase, event.duration_seconds) {206
(CallPhase::Ended, Some(seconds)) if !missed => {453
(CallPhase::Ended, Some(seconds)) if !missed => {@@ -215,12 +462,29 @@ pub fn call_card(215
};462
};216
let extra_participants = people.len().saturating_sub(MAX_AVATARS);463
let extra_participants = people.len().saturating_sub(MAX_AVATARS);217
people.truncate(MAX_AVATARS);464
people.truncate(MAX_AVATARS);465
let notice = is_notice(event).then(|| CallNotice {466
stamp: notice_stamp(created_at, clock),467
text: notice_text(468
NoticeSource {469
event,470
message_id,471
stopped_by_meeting_end: timeline.stopped_by_meeting_end(event, created_at),472
},473
names,474
clock.meeting,475
),476
emphasis: event477
.duration_seconds478
.filter(|_| event.phase == CallPhase::Ended)479
.map(format_duration),480
});218
CallCard {481
CallCard {219
title: title(event, missed, names),482
title: title(event, missed, names),220
detail,483
detail,221
icon: match (missed, event.phase, event.call_type) {484
icon: match (missed, event.phase, event.call_type) {222
(true, _, _) => CallIcon::Missed,485
(true, _, _) => CallIcon::Missed,223
(false, CallPhase::RecordingStarted | CallPhase::RecordingSaved, _) => CallIcon::Record,486
(false, CallPhase::RecordingStarted, _) => CallIcon::Record,487
(false, CallPhase::RecordingSaved, _) => CallIcon::Saved,224
(false, CallPhase::RecordingStopped | CallPhase::TranscriptStarted, _) => {488
(false, CallPhase::RecordingStopped | CallPhase::TranscriptStarted, _) => {225
CallIcon::RecordStop489
CallIcon::RecordStop226
}490
}@@ -231,14 +495,14 @@ pub fn call_card(231
started: event.phase == CallPhase::Started,495
started: event.phase == CallPhase::Started,232
participants: people,496
participants: people,233
extra_participants,497
extra_participants,234
recording: (event.phase == CallPhase::RecordingSaved)498
recap: timeline.recap(event, created_at, clock),235
.then(|| recording_card(event, message_id, transcript))499
notice,236
.flatten(),237
}500
}238
}501
}239
502
240
#[cfg(test)]503
#[cfg(test)]241
mod tests {504
mod tests {505
use chrono::TimeZone;242
use teams_core::Recording;506
use teams_core::Recording;243
507
244
use super::*;508
use super::*;@@ -257,7 +521,7 @@ mod tests {257
}521
}258
}522
}259
523
260
fn fixture_events() -> Vec<Option<CallEvent>> {524
fn fixture_records() -> Vec<MessageRecord> {261
let path = format!(525
let path = format!(262
"{}/../core/tests/fixtures/call_events/meeting_chat_recording.json",526
"{}/../core/tests/fixtures/call_events/meeting_chat_recording.json",263
env!("CARGO_MANIFEST_DIR")527
env!("CARGO_MANIFEST_DIR")@@ -269,7 +533,10 @@ mod tests {269
.unwrap()533
.unwrap()270
.iter()534
.iter()271
.rev()535
.rev()272
.map(|message| CallEvent::from_graph(&message["eventDetail"]))536
.map(|message| {537
let message: graph::Message = serde_json::from_value(message.clone()).unwrap();538
teams_core::message_record("meeting-chat", &message).unwrap()539
})273
.collect()540
.collect()274
}541
}275
542
@@ -286,93 +553,197 @@ mod tests {286
])553
])287
}554
}288
555
289
#[test]556
fn cards(records: &[MessageRecord], meeting: &MeetingInfo) -> Vec<CallCard> {290
fn recorded_meeting_shows_like_teams() {557
let events: Vec<Option<CallEvent>> = records.iter().map(teams_core::call_event).collect();291
let events = fixture_events();558
let timeline = CallTimeline::with_records(&events, &records.iter().collect::<Vec<_>>());292
let timeline = CallTimeline::new(&events);293
let names = names();559
let names = names();294
let lookup = CallNames {560
let lookup = CallNames {295
my_user_id: Some("me"),561
my_user_id: Some("me"),296
names: &names,562
names: &names,297
};563
};298
let titles: Vec<String> = events564
let clock = CallClock {565
offset: FixedOffset::east_opt(0).unwrap(),566
today: NaiveDate::from_ymd_opt(2026, 10, 30).unwrap(),567
meeting,568
};569
events299
.iter()570
.iter()571
.zip(records)300
.enumerate()572
.enumerate()301
.filter(|(index, _)| !timeline.hides(*index))573
.filter(|(index, _)| !timeline.hides(*index))302
.map(|(_, event)| {574
.map(|(_, (event, record))| {303
let event = event.as_ref().unwrap();304
call_card(575
call_card(305
event,576
CallSource {306
"m",577
event: event.as_ref().unwrap(),307
"16:15",578
message_id: &record.message_id,579
created_at: record.created_at,580
time: "16:15",581
},308
&lookup,582
&lookup,309
timeline.has_transcript(&event.call_id),583
&clock,584
&timeline,310
)585
)311
.title312
})586
})313
.collect();587
.collect()588
}589
590
fn notice_line(card: &CallCard) -> String {591
let notice = card.notice.as_ref().unwrap();592
match ¬ice.emphasis {593
Some(emphasis) => format!("{} {emphasis}", notice.text),594
None => notice.text.clone(),595
}596
}597
598
#[test]599
fn recorded_meeting_shows_as_teams_notices() {600
let shown = cards(&fixture_records(), &MeetingInfo::default());601
let lines: Vec<String> = shown.iter().map(notice_line).collect();314
assert_eq!(602
assert_eq!(315
titles,603
lines,316
[604
[317
"Meeting started",605
"Meeting started",318
"Sam Recorder started recording",606
"Sam Recorder started recording.",319
"Recording stopped",607
"Recording stopped.",320
"Meeting ended",608
"Meeting ended: 16m 28s",321
"Recording has been saved to Vera Organizer's OneDrive",609
"Recording has been saved to Vera Organizer's OneDrive.",322
]610
]323
);611
);612
let icons: Vec<CallIcon> = shown.iter().map(|card| card.icon).collect();613
assert_eq!(614
icons,615
[616
CallIcon::Video,617
CallIcon::Record,618
CallIcon::RecordStop,619
CallIcon::Video,620
CallIcon::Saved,621
]622
);623
assert!(624
shown625
.iter()626
.all(|card| card.recap.is_none() == (card.title != "Meeting ended"))627
);324
}628
}325
629
326
#[test]630
#[test]327
fn saved_recording_becomes_a_card_with_transcript_and_thumbnail() {631
fn a_recording_stopped_before_the_end_names_who_stopped_it() {328
let events = fixture_events();632
let mut records = fixture_records();329
let timeline = CallTimeline::new(&events);633
for record in records.iter_mut() {330
let saved = events.last().unwrap().as_ref().unwrap();634
if teams_core::call_event(record)331
let names = HashMap::new();635
.is_some_and(|event| event.phase == CallPhase::RecordingStopped)332
let lookup = CallNames {636
{333
my_user_id: None,637
record.created_at -= chrono::Duration::minutes(2);334
names: &names,638
}639
}640
let shown = cards(&records, &MeetingInfo::default());641
assert_eq!(notice_line(&shown[2]), "Sam Recorder stopped recording.");642
}643
644
#[test]645
fn ended_meeting_carries_the_recap_card_of_its_recording() {646
let records = fixture_records();647
let saved_id = records.last().unwrap().message_id.clone();648
let meeting = MeetingInfo {649
title: Some("Weekly sync".to_owned()),650
slots: Vec::new(),651
expiry_days: HashMap::from([(saved_id.clone(), 56)]),335
};652
};336
let card = call_card(653
let shown = cards(&records, &meeting);337
saved,654
let ended = shown338
"saved-1",655
.iter()339
"16:16",656
.find(|card| card.title == "Meeting ended")340
&lookup,657
.unwrap();341
timeline.has_transcript(&saved.call_id),658
let recap = ended.recap.as_ref().unwrap();659
assert_eq!(recap.title, "Weekly sync");660
assert_eq!(recap.recording.message_id, saved_id);661
assert_eq!(recap.recording.duration.as_deref(), Some("13m 34s"));662
assert_eq!(recap.recording.expires_in_days, Some(56));663
assert!(recap.recording.transcript);664
assert!(665
recap666
.recording667
.thumbnail668
.as_ref()669
.unwrap()670
.url671
.contains("/thumbnails/")672
);673
assert!(shown.iter().filter(|card| card.recap.is_some()).count() == 1);674
assert_eq!(675
notice_line(shown.last().unwrap()),676
"Recording has been saved to Vera Organizer's OneDrive and will expire in 56 days."342
);677
);343
assert_eq!(card.title, "Recording has been saved to OneDrive");678
}344
assert_eq!(card.icon, CallIcon::Record);679
345
let recording = card.recording.unwrap();680
#[test]346
assert_eq!(recording.title, "Weekly team meeting");681
fn recap_date_prefers_the_calendar_occurrence() {347
assert_eq!(recording.duration.as_deref(), Some("13m 34s"));682
let started_at = Utc.with_ymd_and_hms(2026, 10, 15, 9, 46, 0).unwrap();348
assert!(recording.transcript);683
let ended_at = Utc.with_ymd_and_hms(2026, 10, 15, 9, 55, 0).unwrap();349
assert_eq!(recording.message_id, "saved-1");684
let mut meeting = MeetingInfo::default();350
assert!(recording.thumbnail.unwrap().url.contains("/thumbnails/"));685
let clock = |meeting: &MeetingInfo| {686
recap_date_line(687
started_at,688
ended_at,689
&CallClock {690
offset: FixedOffset::east_opt(2 * 3600).unwrap(),691
today: NaiveDate::from_ymd_opt(2026, 10, 17).unwrap(),692
meeting,693
},694
)695
};696
assert_eq!(clock(&meeting), "Thursday, 15 October 2026 11:46 - 11:55");697
meeting.slots = vec![698
MeetingSlot {699
start: Utc.with_ymd_and_hms(2026, 10, 14, 9, 45, 0).unwrap(),700
end: Utc.with_ymd_and_hms(2026, 10, 14, 10, 0, 0).unwrap(),701
},702
MeetingSlot {703
start: Utc.with_ymd_and_hms(2026, 10, 15, 9, 45, 0).unwrap(),704
end: Utc.with_ymd_and_hms(2026, 10, 15, 10, 0, 0).unwrap(),705
},706
];707
assert_eq!(clock(&meeting), "Thursday, 15 October 2026 11:45 - 12:00");708
}709
710
#[test]711
fn notice_stamps_spell_out_the_weekday_like_teams() {712
let meeting = MeetingInfo::default();713
let clock = CallClock {714
offset: FixedOffset::east_opt(0).unwrap(),715
today: NaiveDate::from_ymd_opt(2026, 10, 17).unwrap(),716
meeting: &meeting,717
};718
let stamp = |day: u32| {719
notice_stamp(720
Utc.with_ymd_and_hms(2026, 10, day, 11, 45, 0).unwrap(),721
&clock,722
)723
};724
assert_eq!(stamp(17), "11:45");725
assert_eq!(stamp(16), "Yesterday 11:45");726
assert_eq!(stamp(15), "Thursday 11:45");351
}727
}352
728
353
#[test]729
#[test]354
fn ended_meeting_lists_named_participants_up_to_four() {730
fn ended_meeting_lists_named_participants_up_to_four() {355
let events = fixture_events();731
let shown = cards(&fixture_records(), &MeetingInfo::default());356
let ended = events732
let ended = shown357
.iter()733
.iter()358
.flatten()734
.find(|card| card.title == "Meeting ended")359
.find(|event| event.phase == CallPhase::Ended)360
.unwrap();735
.unwrap();361
let names = HashMap::new();736
assert_eq!(ended.detail, "16m 28s \u{b7} 16:15");362
let lookup = CallNames {737
let shown_names: Vec<&str> = ended363
my_user_id: None,364
names: &names,365
};366
let card = call_card(ended, "m", "16:15", &lookup, false);367
assert_eq!(card.detail, "16m 28s \u{b7} 16:15");368
assert_eq!(card.icon, CallIcon::Video);369
let shown: Vec<&str> = card370
.participants738
.participants371
.iter()739
.iter()372
.map(|person| person.name.as_str())740
.map(|person| person.name.as_str())373
.collect();741
.collect();374
assert_eq!(shown, ["Person 1", "Person 2", "Person 3", "Person 4"]);742
assert_eq!(375
assert_eq!(card.extra_participants, 20);743
shown_names,744
["Person 1", "Person 2", "Person 3", "Person 4"]745
);746
assert_eq!(ended.extra_participants, 20);376
}747
}377
748
378
#[test]749
#[test]@@ -395,8 +766,9 @@ mod tests {395
}766
}396
767
397
#[test]768
#[test]398
fn my_own_recording_is_saved_to_my_onedrive() {769
fn calls_keep_their_card_and_my_recording_is_in_my_onedrive() {399
let mut saved = event(CallPhase::RecordingSaved, CallType::Meeting, "c");770
assert!(!is_notice(&event(CallPhase::Ended, CallType::Call, "c")));771
let mut saved = event(CallPhase::RecordingSaved, CallType::Call, "c");400
saved.recording = Some(Recording {772
saved.recording = Some(Recording {401
name: None,773
name: None,402
url: Some("https://contoso.example/rec.mp4".to_owned()),774
url: Some("https://contoso.example/rec.mp4".to_owned()),@@ -407,11 +779,17 @@ mod tests {407
my_user_id: Some("me"),779
my_user_id: Some("me"),408
names: &names,780
names: &names,409
};781
};410
let card = call_card(&saved, "m", "9:00", &lookup, false);782
assert_eq!(411
assert_eq!(card.title, "Recording has been saved to your OneDrive");783
notice_text(412
let recording = card.recording.unwrap();784
NoticeSource {413
assert_eq!(recording.title, "Meeting recording");785
event: &saved,414
assert_eq!(recording.thumbnail, None);786
message_id: "m",415
assert_eq!(recording.duration, None);787
stopped_by_meeting_end: false,788
},789
&lookup,790
&MeetingInfo::default()791
),792
"Recording has been saved to your OneDrive."793
);416
}794
}417
}795
}@@ -158,64 +158,63 @@ fn channel_meeting() -> Vec<MessageRecord> {
158
158
]
159
159
}
160
160
161
fn standup_line(id: &str, time: DateTime<Utc>, event: CallEvent) -> MessageRecord {
162
record(DEMO_RECAP_CHAT, id, None, time, event)
163
}
164
161
165
fn recorded_standup() -> Vec<MessageRecord> {
162
let start = at(1, 9, 0);
166
let start = at(2, 11, 45);
163
167
let minutes = |count: i64| start + Duration::minutes(count);
164
let name = "Daily standup-1-Meeting Recording.mp4";
168
let name = "Daily standup-20261015_114602-Meeting Recording.mp4";
165
169
let url = format!("{DEMO_RECORDING_URL}/standup-1.mp4");
166
170
let people = [
167
171
(JONAS_ID, "Jonas Ortega"),
168
172
(DEMO_USER_ID, "Dana Demo"),
169
173
(MARA_ID, "Mara Lindqvist"),
170
174
];
171
let line = |id: &str, offset: i64, event: CallEvent| {
172
record(DEMO_RECAP_CHAT, id, None, minutes(offset), event)
175
let saved_recording = |phase: CallPhase, seconds: Option<u64>, url: Option<&str>| {
176
recording(
177
event(phase, STANDUP_CALL, DEMO_USER_ID, seconds),
178
name,
179
url,
180
MARA_ID,
181
)
173
182
};
174
183
vec![
175
line(
184
standup_line(
176
185
"standup-1-start",
177
0,
186
start,
178
187
event(CallPhase::Started, STANDUP_CALL, JONAS_ID, None),
179
188
),
180
line(
189
standup_line(
181
190
"standup-1-rec",
182
1,
183
recording(
184
event(CallPhase::RecordingStarted, STANDUP_CALL, JONAS_ID, Some(0)),
185
name,
186
None,
191
minutes(1),
192
saved_recording(CallPhase::RecordingStarted, Some(0), None),
193
),
194
standup_line(
195
"standup-1-transcript",
196
minutes(1),
197
event(
198
CallPhase::TranscriptStarted,
199
STANDUP_CALL,
187
200
DEMO_USER_ID,
201
None,
188
202
),
189
203
),
190
line(
204
standup_line(
191
205
"standup-1-stop",
192
17,
193
recording(
194
event(
195
CallPhase::RecordingStopped,
196
STANDUP_CALL,
197
JONAS_ID,
198
Some(985),
199
),
200
name,
201
None,
202
DEMO_USER_ID,
203
),
206
minutes(10),
207
saved_recording(CallPhase::RecordingStopped, Some(531), None),
204
208
),
205
line(
209
standup_line(
206
210
"standup-1-end",
207
18,
208
ended(STANDUP_CALL, JONAS_ID, 1080, &people),
211
minutes(10) + Duration::seconds(40),
212
ended(STANDUP_CALL, JONAS_ID, 586, &people),
209
213
),
210
line(
211
"demo-recap-1",
212
19,
213
recording(
214
event(CallPhase::RecordingSaved, STANDUP_CALL, JONAS_ID, Some(985)),
215
name,
216
Some(&url),
217
DEMO_USER_ID,
218
),
214
standup_line(
215
"demo-recap-0",
216
minutes(10) + Duration::seconds(55),
217
saved_recording(CallPhase::RecordingSaved, Some(531), Some(&url)),
219
218
),
220
219
]
221
220
}
@@ -158,64 +158,63 @@ fn channel_meeting() -> Vec<MessageRecord> {158
]158
]159
}159
}160
160
161
fn standup_line(id: &str, time: DateTime<Utc>, event: CallEvent) -> MessageRecord {162
record(DEMO_RECAP_CHAT, id, None, time, event)163
}164
161
fn recorded_standup() -> Vec<MessageRecord> {165
fn recorded_standup() -> Vec<MessageRecord> {162
let start = at(1, 9, 0);166
let start = at(2, 11, 45);163
let minutes = |count: i64| start + Duration::minutes(count);167
let minutes = |count: i64| start + Duration::minutes(count);164
let name = "Daily standup-1-Meeting Recording.mp4";168
let name = "Daily standup-20261015_114602-Meeting Recording.mp4";165
let url = format!("{DEMO_RECORDING_URL}/standup-1.mp4");169
let url = format!("{DEMO_RECORDING_URL}/standup-1.mp4");166
let people = [170
let people = [167
(JONAS_ID, "Jonas Ortega"),171
(JONAS_ID, "Jonas Ortega"),168
(DEMO_USER_ID, "Dana Demo"),172
(DEMO_USER_ID, "Dana Demo"),169
(MARA_ID, "Mara Lindqvist"),173
(MARA_ID, "Mara Lindqvist"),170
];174
];171
let line = |id: &str, offset: i64, event: CallEvent| {175
let saved_recording = |phase: CallPhase, seconds: Option<u64>, url: Option<&str>| {172
record(DEMO_RECAP_CHAT, id, None, minutes(offset), event)176
recording(177
event(phase, STANDUP_CALL, DEMO_USER_ID, seconds),178
name,179
url,180
MARA_ID,181
)173
};182
};174
vec![183
vec![175
line(184
standup_line(176
"standup-1-start",185
"standup-1-start",177
0,186
start,178
event(CallPhase::Started, STANDUP_CALL, JONAS_ID, None),187
event(CallPhase::Started, STANDUP_CALL, JONAS_ID, None),179
),188
),180
line(189
standup_line(181
"standup-1-rec",190
"standup-1-rec",182
1,191
minutes(1),183
recording(192
saved_recording(CallPhase::RecordingStarted, Some(0), None),184
event(CallPhase::RecordingStarted, STANDUP_CALL, JONAS_ID, Some(0)),193
),185
name,194
standup_line(186
None,195
"standup-1-transcript",196
minutes(1),197
event(198
CallPhase::TranscriptStarted,199
STANDUP_CALL,187
DEMO_USER_ID,200
DEMO_USER_ID,201
None,188
),202
),189
),203
),190
line(204
standup_line(191
"standup-1-stop",205
"standup-1-stop",192
17,206
minutes(10),193
recording(207
saved_recording(CallPhase::RecordingStopped, Some(531), None),194
event(195
CallPhase::RecordingStopped,196
STANDUP_CALL,197
JONAS_ID,198
Some(985),199
),200
name,201
None,202
DEMO_USER_ID,203
),204
),208
),205
line(209
standup_line(206
"standup-1-end",210
"standup-1-end",207
18,211
minutes(10) + Duration::seconds(40),208
ended(STANDUP_CALL, JONAS_ID, 1080, &people),212
ended(STANDUP_CALL, JONAS_ID, 586, &people),209
),213
),210
line(214
standup_line(211
"demo-recap-1",215
"demo-recap-0",212
19,216
minutes(10) + Duration::seconds(55),213
recording(217
saved_recording(CallPhase::RecordingSaved, Some(531), Some(&url)),214
event(CallPhase::RecordingSaved, STANDUP_CALL, JONAS_ID, Some(985)),215
name,216
Some(&url),217
DEMO_USER_ID,218
),219
),218
),220
]219
]221
}220
}@@ -75,7 +75,7 @@ mod tests {
75
75
use store::MessageRecord;
76
76
77
77
use super::*;
78
use crate::rows::{RowContext, message_row};
78
use crate::rows::{MeetingInfo, RowContext, message_row};
79
79
use crate::translation::TranslationContext;
80
80
81
81
fn offset() -> FixedOffset {
@@ -96,6 +96,7 @@ mod tests {
96
96
card_overrides: HashMap::new(),
97
97
translation: TranslationContext::default(),
98
98
skin_tone: 0,
99
meeting: MeetingInfo::default(),
99
100
}
100
101
}
101
102
@@ -75,7 +75,7 @@ mod tests {75
use store::MessageRecord;75
use store::MessageRecord;76
76
77
use super::*;77
use super::*;78
use crate::rows::{RowContext, message_row};78
use crate::rows::{MeetingInfo, RowContext, message_row};79
use crate::translation::TranslationContext;79
use crate::translation::TranslationContext;80
80
81
fn offset() -> FixedOffset {81
fn offset() -> FixedOffset {@@ -96,6 +96,7 @@ mod tests {96
card_overrides: HashMap::new(),96
card_overrides: HashMap::new(),97
translation: TranslationContext::default(),97
translation: TranslationContext::default(),98
skin_tone: 0,98
skin_tone: 0,99
meeting: MeetingInfo::default(),99
}100
}100
}101
}101
102
@@ -14,8 +14,11 @@ use teams_core::{
14
14
reactions, readable_text, translated_spans,
15
15
};
16
16
17
pub use crate::call_rows::{CallCard, CallIcon, CallParticipant, RecordingCard};
18
use crate::call_rows::{CallNames, CallTimeline, call_card};
17
pub use crate::call_rows::{
18
CallCard, CallIcon, CallNotice, CallParticipant, MeetingInfo, MeetingSlot, RecapCard,
19
RecordingCard,
20
};
21
use crate::call_rows::{CallClock, CallNames, CallSource, CallTimeline, call_card};
19
22
use crate::card_state::CardOverride;
20
23
use crate::format;
21
24
use crate::reaction_model::{Reactor, UNKNOWN_REACTOR};
@@ -563,6 +566,7 @@ pub struct RowContext {
563
566
pub card_overrides: HashMap<String, CardOverride>,
564
567
pub translation: TranslationContext,
565
568
pub skin_tone: u8,
569
pub meeting: MeetingInfo,
566
570
}
567
571
568
572
fn visible_reactions(record: &MessageRecord, context: &RowContext) -> Vec<ReactionInfo> {
@@ -580,7 +584,7 @@ fn call_row(
580
584
record: &MessageRecord,
581
585
event: &CallEvent,
582
586
context: &RowContext,
583
transcript: bool,
587
timeline: &CallTimeline,
584
588
) -> MessageRow {
585
589
let my_user_id = context.my_user_id.as_deref();
586
590
let time = clock_label(record.created_at, context.offset);
@@ -633,11 +637,19 @@ fn call_row(
633
637
forwarded: false,
634
638
translation: None,
635
639
call: Some(call_card(
636
event,
637
&record.message_id,
638
&time,
640
CallSource {
641
event,
642
message_id: &record.message_id,
643
created_at: record.created_at,
644
time: &time,
645
},
639
646
&names,
640
transcript,
647
&CallClock {
648
offset: context.offset,
649
today: context.today,
650
meeting: &context.meeting,
651
},
652
timeline,
641
653
)),
642
654
time,
643
655
}
@@ -706,7 +718,8 @@ fn message_row_with(
706
718
quoted: &HashMap<String, String>,
707
719
) -> MessageRow {
708
720
if let Some(event) = call_event(record) {
709
return call_row(record, &event, context, false);
721
let events = [Some(event.clone())];
722
return call_row(record, &event, context, &CallTimeline::new(&events));
710
723
}
711
724
let local = record.created_at.with_timezone(&context.offset);
712
725
let images = images(record);
@@ -778,7 +791,7 @@ pub fn flat_rows(records: &[MessageRecord], context: &RowContext, has_older: boo
778
791
rows.push(Row::LoadOlder);
779
792
}
780
793
let events: Vec<Option<CallEvent>> = records.iter().map(call_event).collect();
781
let timeline = CallTimeline::new(&events);
794
let timeline = CallTimeline::with_records(&events, &records.iter().collect::<Vec<_>>());
782
795
let mut previous_day: Option<NaiveDate> = None;
783
796
let quoted = quoted_texts(records);
784
797
for (index, (record, event)) in records.iter().zip(&events).enumerate() {
@@ -786,12 +799,7 @@ pub fn flat_rows(records: &[MessageRecord], context: &RowContext, has_older: boo
786
799
continue;
787
800
}
788
801
let mut row = match event {
789
Some(event) => call_row(
790
record,
791
event,
792
context,
793
timeline.has_transcript(&event.call_id),
794
),
802
Some(event) => call_row(record, event, context, &timeline),
795
803
None => message_row_with(record, context, "ed),
796
804
};
797
805
if let Some(call) = row.call.as_mut() {
@@ -849,12 +857,7 @@ fn post_message_row(
849
857
timeline: &CallTimeline,
850
858
) -> MessageRow {
851
859
let mut row = match call_event(record) {
852
Some(event) => call_row(
853
record,
854
&event,
855
context,
856
timeline.has_transcript(&event.call_id),
857
),
860
Some(event) => call_row(record, &event, context, timeline),
858
861
None => message_row(record, context),
859
862
};
860
863
row.day_header = None;
@@ -885,7 +888,7 @@ fn meeting_root_row(
885
888
..ended_event
886
889
};
887
890
summary.call_type = started.call_type;
888
let mut row = call_row(ended_record, &summary, context, false);
891
let mut row = call_row(ended_record, &summary, context, timeline);
889
892
row.key = root.message_id.clone();
890
893
row.created_at = root.created_at;
891
894
row.reply_root = None;
@@ -1291,6 +1294,7 @@ mod tests {
1291
1294
card_overrides: HashMap::new(),
1292
1295
translation: TranslationContext::default(),
1293
1296
skin_tone: 0,
1297
meeting: MeetingInfo::default(),
1294
1298
}
1295
1299
}
1296
1300
@@ -2116,13 +2120,12 @@ mod tests {
2116
2120
let post = feed_post(&rows[0]);
2117
2121
assert_eq!(post.replies.len(), 1);
2118
2122
assert_eq!(post.hidden_reply_count, 0);
2119
let recording = post.replies[0]
2120
.call
2121
.as_ref()
2122
.and_then(|call| call.recording.as_ref())
2123
.unwrap();
2124
assert_eq!(recording.title, "Weekly team meeting");
2125
assert!(recording.transcript);
2123
let saved = post.replies[0].call.as_ref().unwrap();
2124
assert_eq!(saved.icon, CallIcon::Saved);
2125
assert_eq!(
2126
saved.notice.as_ref().unwrap().text,
2127
"Recording has been saved to OneDrive."
2128
);
2126
2129
let thread = thread_rows(&records, &root_id, &call_context());
2127
2130
let calls = thread
2128
2131
.iter()
@@ -14,8 +14,11 @@ use teams_core::{14
reactions, readable_text, translated_spans,14
reactions, readable_text, translated_spans,15
};15
};16
16
17
pub use crate::call_rows::{CallCard, CallIcon, CallParticipant, RecordingCard};17
pub use crate::call_rows::{18
use crate::call_rows::{CallNames, CallTimeline, call_card};18
CallCard, CallIcon, CallNotice, CallParticipant, MeetingInfo, MeetingSlot, RecapCard,19
RecordingCard,20
};21
use crate::call_rows::{CallClock, CallNames, CallSource, CallTimeline, call_card};19
use crate::card_state::CardOverride;22
use crate::card_state::CardOverride;20
use crate::format;23
use crate::format;21
use crate::reaction_model::{Reactor, UNKNOWN_REACTOR};24
use crate::reaction_model::{Reactor, UNKNOWN_REACTOR};@@ -563,6 +566,7 @@ pub struct RowContext {563
pub card_overrides: HashMap<String, CardOverride>,566
pub card_overrides: HashMap<String, CardOverride>,564
pub translation: TranslationContext,567
pub translation: TranslationContext,565
pub skin_tone: u8,568
pub skin_tone: u8,569
pub meeting: MeetingInfo,566
}570
}567
571
568
fn visible_reactions(record: &MessageRecord, context: &RowContext) -> Vec<ReactionInfo> {572
fn visible_reactions(record: &MessageRecord, context: &RowContext) -> Vec<ReactionInfo> {@@ -580,7 +584,7 @@ fn call_row(580
record: &MessageRecord,584
record: &MessageRecord,581
event: &CallEvent,585
event: &CallEvent,582
context: &RowContext,586
context: &RowContext,583
transcript: bool,587
timeline: &CallTimeline,584
) -> MessageRow {588
) -> MessageRow {585
let my_user_id = context.my_user_id.as_deref();589
let my_user_id = context.my_user_id.as_deref();586
let time = clock_label(record.created_at, context.offset);590
let time = clock_label(record.created_at, context.offset);@@ -633,11 +637,19 @@ fn call_row(633
forwarded: false,637
forwarded: false,634
translation: None,638
translation: None,635
call: Some(call_card(639
call: Some(call_card(636
event,640
CallSource {637
&record.message_id,641
event,638
&time,642
message_id: &record.message_id,643
created_at: record.created_at,644
time: &time,645
},639
&names,646
&names,640
transcript,647
&CallClock {648
offset: context.offset,649
today: context.today,650
meeting: &context.meeting,651
},652
timeline,641
)),653
)),642
time,654
time,643
}655
}@@ -706,7 +718,8 @@ fn message_row_with(706
quoted: &HashMap<String, String>,718
quoted: &HashMap<String, String>,707
) -> MessageRow {719
) -> MessageRow {708
if let Some(event) = call_event(record) {720
if let Some(event) = call_event(record) {709
return call_row(record, &event, context, false);721
let events = [Some(event.clone())];722
return call_row(record, &event, context, &CallTimeline::new(&events));710
}723
}711
let local = record.created_at.with_timezone(&context.offset);724
let local = record.created_at.with_timezone(&context.offset);712
let images = images(record);725
let images = images(record);@@ -778,7 +791,7 @@ pub fn flat_rows(records: &[MessageRecord], context: &RowContext, has_older: boo778
rows.push(Row::LoadOlder);791
rows.push(Row::LoadOlder);779
}792
}780
let events: Vec<Option<CallEvent>> = records.iter().map(call_event).collect();793
let events: Vec<Option<CallEvent>> = records.iter().map(call_event).collect();781
let timeline = CallTimeline::new(&events);794
let timeline = CallTimeline::with_records(&events, &records.iter().collect::<Vec<_>>());782
let mut previous_day: Option<NaiveDate> = None;795
let mut previous_day: Option<NaiveDate> = None;783
let quoted = quoted_texts(records);796
let quoted = quoted_texts(records);784
for (index, (record, event)) in records.iter().zip(&events).enumerate() {797
for (index, (record, event)) in records.iter().zip(&events).enumerate() {@@ -786,12 +799,7 @@ pub fn flat_rows(records: &[MessageRecord], context: &RowContext, has_older: boo786
continue;799
continue;787
}800
}788
let mut row = match event {801
let mut row = match event {789
Some(event) => call_row(802
Some(event) => call_row(record, event, context, &timeline),790
record,791
event,792
context,793
timeline.has_transcript(&event.call_id),794
),795
None => message_row_with(record, context, "ed),803
None => message_row_with(record, context, "ed),796
};804
};797
if let Some(call) = row.call.as_mut() {805
if let Some(call) = row.call.as_mut() {@@ -849,12 +857,7 @@ fn post_message_row(849
timeline: &CallTimeline,857
timeline: &CallTimeline,850
) -> MessageRow {858
) -> MessageRow {851
let mut row = match call_event(record) {859
let mut row = match call_event(record) {852
Some(event) => call_row(860
Some(event) => call_row(record, &event, context, timeline),853
record,854
&event,855
context,856
timeline.has_transcript(&event.call_id),857
),858
None => message_row(record, context),861
None => message_row(record, context),859
};862
};860
row.day_header = None;863
row.day_header = None;@@ -885,7 +888,7 @@ fn meeting_root_row(885
..ended_event888
..ended_event886
};889
};887
summary.call_type = started.call_type;890
summary.call_type = started.call_type;888
let mut row = call_row(ended_record, &summary, context, false);891
let mut row = call_row(ended_record, &summary, context, timeline);889
row.key = root.message_id.clone();892
row.key = root.message_id.clone();890
row.created_at = root.created_at;893
row.created_at = root.created_at;891
row.reply_root = None;894
row.reply_root = None;@@ -1291,6 +1294,7 @@ mod tests {1291
card_overrides: HashMap::new(),1294
card_overrides: HashMap::new(),1292
translation: TranslationContext::default(),1295
translation: TranslationContext::default(),1293
skin_tone: 0,1296
skin_tone: 0,1297
meeting: MeetingInfo::default(),1294
}1298
}1295
}1299
}1296
1300
@@ -2116,13 +2120,12 @@ mod tests {2116
let post = feed_post(&rows[0]);2120
let post = feed_post(&rows[0]);2117
assert_eq!(post.replies.len(), 1);2121
assert_eq!(post.replies.len(), 1);2118
assert_eq!(post.hidden_reply_count, 0);2122
assert_eq!(post.hidden_reply_count, 0);2119
let recording = post.replies[0]2123
let saved = post.replies[0].call.as_ref().unwrap();2120
.call2124
assert_eq!(saved.icon, CallIcon::Saved);2121
.as_ref()2125
assert_eq!(2122
.and_then(|call| call.recording.as_ref())2126
saved.notice.as_ref().unwrap().text,2123
.unwrap();2127
"Recording has been saved to OneDrive."2124
assert_eq!(recording.title, "Weekly team meeting");2128
);2125
assert!(recording.transcript);2126
let thread = thread_rows(&records, &root_id, &call_context());2129
let thread = thread_rows(&records, &root_id, &call_context());2127
let calls = thread2130
let calls = thread2128
.iter()2131
.iter()@@ -1 +0,0 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>
@@ -1 +0,0 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>@@ -0,0 +1 @@
1
<svg width="12" height="12" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path d="M6 1a5 5 0 1 1 0 10A5 5 0 0 1 6 1Zm0 1a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-.5 1.5a.5.5 0 0 1 .5.41V6h1.5a.5.5 0 0 1 .09 1H5.5a.5.5 0 0 1-.5-.41V4c0-.28.22-.5.5-.5Z"/></svg>
@@ -0,0 +1 @@1
<svg width="12" height="12" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path d="M6 1a5 5 0 1 1 0 10A5 5 0 0 1 6 1Zm0 1a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-.5 1.5a.5.5 0 0 1 .5.41V6h1.5a.5.5 0 0 1 .09 1H5.5a.5.5 0 0 1-.5-.41V4c0-.28.22-.5.5-.5Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 2c2.82 0 4.41 1.92 4.65 4.25h.07a3.33 3.33 0 0 1 3.27 3.66c-.32-.4-.7-.76-1.12-1.07a2.3 2.3 0 0 0-2.150-1.6h-.07a1 1 0 0 1-1-.9C13.45 4.33 12.11 3 10 3S6.55 4.32 6.35 6.35a1 1 0 0 1-1 .9h-.07A2.33 2.33 0 0 0 3 9.62 2.33 2.33 0 0 0 5.28 12h2.67c-.09.32-.15.66-.18 1H5.28A3.33 3.33 0 0 1 2 9.62c0-1.8 1.37-3.27 3.1-3.37h.25C5.6 3.9 7.18 2 10 2Zm3.5 7a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9Zm1.6 4.9a.56.56 0 1 0 .8-.8l-2-2a.56.56 0 0 0-.8 0l-2 2a.56.56 0 1 0 .8.8l1.1-1.1v2.7a.5.5 0 0 0 1 0v-2.7l1.1 1.1Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 2c2.82 0 4.41 1.92 4.65 4.25h.07a3.33 3.33 0 0 1 3.27 3.66c-.32-.4-.7-.76-1.12-1.07a2.3 2.3 0 0 0-2.150-1.6h-.07a1 1 0 0 1-1-.9C13.45 4.33 12.11 3 10 3S6.55 4.32 6.35 6.35a1 1 0 0 1-1 .9h-.07A2.33 2.33 0 0 0 3 9.62 2.33 2.33 0 0 0 5.28 12h2.67c-.09.32-.15.66-.18 1H5.28A3.33 3.33 0 0 1 2 9.62c0-1.8 1.37-3.27 3.1-3.37h.25C5.6 3.9 7.18 2 10 2Zm3.5 7a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9Zm1.6 4.9a.56.56 0 1 0 .8-.8l-2-2a.56.56 0 0 0-.8 0l-2 2a.56.56 0 1 0 .8.8l1.1-1.1v2.7a.5.5 0 0 0 1 0v-2.7l1.1 1.1Z"/></svg>@@ -0,0 +1 @@
1
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 10a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7Zm0 2a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7Zm0 2a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7ZM4 4c0-1.1.9-2 2-2h4.59c.4 0 .78.16 1.06.44l3.91 3.91c.28.28.44.67.44 1.06V16a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V8h-3.5A1.5 1.5 0 0 1 10 6.5V3H6Zm5.5 4h3.3L11 3.2v3.3c0 .28.22.5.5.5Z"/></svg>
@@ -0,0 +1 @@1
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 10a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7Zm0 2a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7Zm0 2a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7ZM4 4c0-1.1.9-2 2-2h4.59c.4 0 .78.16 1.06.44l3.91 3.91c.28.28.44.67.44 1.06V16a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4Zm2-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V8h-3.5A1.5 1.5 0 0 1 10 6.5V3H6Zm5.5 4h3.3L11 3.2v3.3c0 .28.22.5.5.5Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 14.5a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9ZM10 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-7 8a7 7 0 1 1 14 0 7 7 0 0 1-14 0Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 14.5a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9ZM10 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-7 8a7 7 0 1 1 14 0 7 7 0 0 1-14 0Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-8 7a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm5-2a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M10 3a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-8 7a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm5-2a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V8Z"/></svg>@@ -0,0 +1 @@
1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M5 4a3 3 0 0 0-3 3v6a3 3 0 0 0 3 3h5a3 3 0 0 0 3-3v-.32l3.04 2.1c.83.57 1.96-.03 1.960-1.03v-7.5c0-1-1.13-1.6-1.96-1.03L13 7.32V7a3 3 0 0 0-3-3H5Zm8 4.54 3.6-2.5c.17-.1.4.01.4.21v7.5c0 .2-.23.32-.4.2L13 11.46V8.540ZM3 7c0-1.1.9-2 2-2h5a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"/></svg>
@@ -0,0 +1 @@1
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M5 4a3 3 0 0 0-3 3v6a3 3 0 0 0 3 3h5a3 3 0 0 0 3-3v-.32l3.04 2.1c.83.57 1.96-.03 1.960-1.03v-7.5c0-1-1.13-1.6-1.96-1.03L13 7.32V7a3 3 0 0 0-3-3H5Zm8 4.54 3.6-2.5c.17-.1.4.01.4.21v7.5c0 .2-.23.32-.4.2L13 11.46V8.540ZM3 7c0-1.1.9-2 2-2h5a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"/></svg>@@ -1 +0,0 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-200v-560l440 280-440 280Z"/></svg>
@@ -1 +0,0 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-200v-560l440 280-440 280Z"/></svg>@@ -1 +0,0 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-280q83 0 141.5-58.5T680-480q0-83-58.5-141.5T480-680q-83 0-141.5 58.5T280-480q0 83 58.5 141.5T480-280Zm0 200q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Z"/></svg>
@@ -1 +0,0 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-280q83 0 141.5-58.5T680-480q0-83-58.5-141.5T480-680q-83 0-141.5 58.5T280-480q0 83 58.5 141.5T480-280Zm0 200q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Z"/></svg>@@ -1 +0,0 @@
1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-320h320v-320H320v320ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Z"/></svg>
@@ -1 +0,0 @@1
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-320h320v-320H320v320ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Z"/></svg>@@ -3,11 +3,12 @@ use gpui_kit::prelude::FluentBuilder as _;
3
3
use gpui_kit::*;
4
4
5
5
use super::avatar::person_avatar;
6
use super::call_notice::{RecapActions, notice_row};
6
7
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker};
7
8
use super::profile_card::opens_profile;
8
9
use super::widgets::symbol;
9
10
use crate::data::Directory;
10
use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow, RecordingCard};
11
use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow};
11
12
use crate::theme;
12
13
13
14
const SERIES_START_GAP: f32 = 8.;
@@ -20,19 +21,11 @@ const DETAIL_SIZE: f32 = 11.;
20
21
const JOIN_HEIGHT: f32 = 24.;
21
22
const PARTICIPANT_AVATAR: f32 = 20.;
22
23
const PARTICIPANT_GAP: f32 = 2.;
23
const TILE_WIDTH: f32 = 288.;
24
const TILE_HEIGHT: f32 = 162.;
25
const TILE_RADIUS: f32 = 8.;
26
const PLAY_CIRCLE: f32 = 40.;
27
const PLAY_GLYPH: f32 = 24.;
28
const DURATION_INSET: f32 = 6.;
29
const CHIP_HEIGHT: f32 = 26.;
30
24
31
25
pub struct CallActions {
32
26
pub call_back: RowAction,
33
27
pub join: RowAction,
34
pub open_recording: RowAction,
35
pub open_transcript: RowAction,
28
pub recap: RecapActions,
36
29
}
37
30
38
31
impl CallActions {
@@ -40,8 +33,12 @@ impl CallActions {
40
33
CallActions {
41
34
call_back: None,
42
35
join: None,
43
open_recording: None,
44
open_transcript: None,
36
recap: RecapActions {
37
view_recap: None,
38
open_recording: None,
39
transcript: None,
40
share: None,
41
},
45
42
}
46
43
}
47
44
}
@@ -51,12 +48,12 @@ fn icon_circle(call: &CallCard, own: bool) -> Div {
51
48
CallIcon::Missed => (theme::red().opacity(0.2), "call_missed", theme::red_soft()),
52
49
CallIcon::Call => (circle_fill(own), "call", theme::text()),
53
50
CallIcon::Video => (circle_fill(own), "videocam", theme::text()),
54
CallIcon::Record => (
51
CallIcon::Record | CallIcon::Saved => (
55
52
circle_fill(own),
56
"radio_button_checked",
53
"fluent_record",
57
54
theme::accent_text(),
58
55
),
59
CallIcon::RecordStop => (circle_fill(own), "stop_circle", theme::text()),
56
CallIcon::RecordStop => (circle_fill(own), "fluent_record_stop", theme::text()),
60
57
};
61
58
h_flex()
62
59
.size(px(ICON_CIRCLE))
@@ -161,130 +158,6 @@ fn participant_stack(
161
158
)
162
159
}
163
160
164
fn recording_thumbnail(recording: &RecordingCard, directory: &Directory) -> AnyElement {
165
let image = recording
166
.thumbnail
167
.as_ref()
168
.and_then(|thumbnail| directory.image(&thumbnail.url));
169
match image {
170
Some(entry) => img(entry.path.clone())
171
.size_full()
172
.object_fit(ObjectFit::Cover)
173
.into_any_element(),
174
None => div()
175
.size_full()
176
.bg(theme::code_surface())
177
.into_any_element(),
178
}
179
}
180
181
fn recording_tile(
182
recording: &RecordingCard,
183
index: usize,
184
directory: &Directory,
185
open_recording: RowAction,
186
) -> Stateful<Div> {
187
div()
188
.id(ElementId::Name(format!("call-recording-{index}").into()))
189
.relative()
190
.w(px(TILE_WIDTH))
191
.h(px(TILE_HEIGHT))
192
.flex_none()
193
.rounded(px(TILE_RADIUS))
194
.overflow_hidden()
195
.cursor_pointer()
196
.hover(|tile| tile.opacity(0.92))
197
.child(recording_thumbnail(recording, directory))
198
.child(
199
h_flex()
200
.absolute()
201
.inset_0()
202
.items_center()
203
.justify_center()
204
.child(
205
h_flex()
206
.size(px(PLAY_CIRCLE))
207
.items_center()
208
.justify_center()
209
.rounded_full()
210
.bg(black().opacity(0.55))
211
.child(symbol("play_arrow", PLAY_GLYPH, theme::white())),
212
),
213
)
214
.children(recording.duration.clone().map(|duration| {
215
div()
216
.absolute()
217
.bottom(px(DURATION_INSET))
218
.right(px(DURATION_INSET))
219
.px(px(6.))
220
.py(px(1.))
221
.rounded(px(4.))
222
.bg(black().opacity(0.65))
223
.text_size(px(DETAIL_SIZE))
224
.font_weight(FontWeight::SEMIBOLD)
225
.text_color(theme::white())
226
.child(duration)
227
}))
228
.when_some(open_recording, |tile, open| {
229
tile.on_click(move |_, _, cx| open(cx))
230
})
231
}
232
233
fn transcript_chip(index: usize, open_transcript: RowAction) -> Stateful<Div> {
234
h_flex()
235
.id(ElementId::Name(format!("call-transcript-{index}").into()))
236
.h(px(CHIP_HEIGHT))
237
.px(px(10.))
238
.gap(px(6.))
239
.flex_none()
240
.items_center()
241
.rounded(px(6.))
242
.border_1()
243
.border_color(theme::border())
244
.text_size(px(DETAIL_SIZE + 1.))
245
.font_weight(FontWeight::SEMIBOLD)
246
.text_color(theme::text())
247
.cursor_pointer()
248
.hover(|chip| chip.bg(theme::popup_hover()))
249
.child(symbol("description", 15., theme::accent_text()))
250
.child("Transcript")
251
.when_some(open_transcript, |chip, open| {
252
chip.on_click(move |_, _, cx| open(cx))
253
})
254
}
255
256
fn recording_block(
257
recording: &RecordingCard,
258
index: usize,
259
directory: &Directory,
260
open_recording: RowAction,
261
open_transcript: RowAction,
262
) -> Div {
263
v_flex()
264
.pt(px(4.))
265
.gap(px(8.))
266
.child(recording_tile(recording, index, directory, open_recording))
267
.child(
268
h_flex()
269
.w(px(TILE_WIDTH))
270
.gap(px(8.))
271
.items_center()
272
.child(
273
div()
274
.flex_1()
275
.min_w_0()
276
.truncate()
277
.text_size(px(TITLE_SIZE))
278
.font_weight(FontWeight::SEMIBOLD)
279
.text_color(theme::text())
280
.child(recording.title.clone()),
281
)
282
.when(recording.transcript, |line| {
283
line.child(transcript_chip(index, open_transcript))
284
}),
285
)
286
}
287
288
161
fn card(
289
162
call: &CallCard,
290
163
index: usize,
@@ -292,12 +165,7 @@ fn card(
292
165
actions: CallActions,
293
166
directory: &Directory,
294
167
) -> Div {
295
let CallActions {
296
call_back,
297
join,
298
open_recording,
299
open_transcript,
300
} = actions;
168
let CallActions { call_back, join, .. } = actions;
301
169
let show_join = call.started && join.is_some();
302
170
let summary = h_flex()
303
171
.gap(px(8.))
@@ -341,9 +209,6 @@ fn card(
341
209
theme::bubble_other()
342
210
})
343
211
.child(summary)
344
.children(call.recording.as_ref().map(|recording| {
345
recording_block(recording, index, directory, open_recording, open_transcript)
346
}))
347
212
}
348
213
349
214
pub(super) fn post_call_card(
@@ -362,6 +227,9 @@ pub(super) fn call_card_row(
362
227
directory: &Directory,
363
228
actions: CallActions,
364
229
) -> AnyElement {
230
if let Some(notice) = &call.notice {
231
return notice_row(row, call, notice, index, directory, actions.recap);
232
}
365
233
let own = row.own;
366
234
let body = if own {
367
235
h_flex()
@@ -3,11 +3,12 @@ use gpui_kit::prelude::FluentBuilder as _;3
use gpui_kit::*;3
use gpui_kit::*;4
4
5
use super::avatar::person_avatar;5
use super::avatar::person_avatar;6
use super::call_notice::{RecapActions, notice_row};6
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker};7
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker};7
use super::profile_card::opens_profile;8
use super::profile_card::opens_profile;8
use super::widgets::symbol;9
use super::widgets::symbol;9
use crate::data::Directory;10
use crate::data::Directory;10
use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow, RecordingCard};11
use crate::rows::{CallCard, CallIcon, CallParticipant, MessageRow};11
use crate::theme;12
use crate::theme;12
13
13
const SERIES_START_GAP: f32 = 8.;14
const SERIES_START_GAP: f32 = 8.;@@ -20,19 +21,11 @@ const DETAIL_SIZE: f32 = 11.;20
const JOIN_HEIGHT: f32 = 24.;21
const JOIN_HEIGHT: f32 = 24.;21
const PARTICIPANT_AVATAR: f32 = 20.;22
const PARTICIPANT_AVATAR: f32 = 20.;22
const PARTICIPANT_GAP: f32 = 2.;23
const PARTICIPANT_GAP: f32 = 2.;23
const TILE_WIDTH: f32 = 288.;24
const TILE_HEIGHT: f32 = 162.;25
const TILE_RADIUS: f32 = 8.;26
const PLAY_CIRCLE: f32 = 40.;27
const PLAY_GLYPH: f32 = 24.;28
const DURATION_INSET: f32 = 6.;29
const CHIP_HEIGHT: f32 = 26.;30
24
31
pub struct CallActions {25
pub struct CallActions {32
pub call_back: RowAction,26
pub call_back: RowAction,33
pub join: RowAction,27
pub join: RowAction,34
pub open_recording: RowAction,28
pub recap: RecapActions,35
pub open_transcript: RowAction,36
}29
}37
30
38
impl CallActions {31
impl CallActions {@@ -40,8 +33,12 @@ impl CallActions {40
CallActions {33
CallActions {41
call_back: None,34
call_back: None,42
join: None,35
join: None,43
open_recording: None,36
recap: RecapActions {44
open_transcript: None,37
view_recap: None,38
open_recording: None,39
transcript: None,40
share: None,41
},45
}42
}46
}43
}47
}44
}@@ -51,12 +48,12 @@ fn icon_circle(call: &CallCard, own: bool) -> Div {51
CallIcon::Missed => (theme::red().opacity(0.2), "call_missed", theme::red_soft()),48
CallIcon::Missed => (theme::red().opacity(0.2), "call_missed", theme::red_soft()),52
CallIcon::Call => (circle_fill(own), "call", theme::text()),49
CallIcon::Call => (circle_fill(own), "call", theme::text()),53
CallIcon::Video => (circle_fill(own), "videocam", theme::text()),50
CallIcon::Video => (circle_fill(own), "videocam", theme::text()),54
CallIcon::Record => (51
CallIcon::Record | CallIcon::Saved => (55
circle_fill(own),52
circle_fill(own),56
"radio_button_checked",53
"fluent_record",57
theme::accent_text(),54
theme::accent_text(),58
),55
),59
CallIcon::RecordStop => (circle_fill(own), "stop_circle", theme::text()),56
CallIcon::RecordStop => (circle_fill(own), "fluent_record_stop", theme::text()),60
};57
};61
h_flex()58
h_flex()62
.size(px(ICON_CIRCLE))59
.size(px(ICON_CIRCLE))@@ -161,130 +158,6 @@ fn participant_stack(161
)158
)162
}159
}163
160
164
fn recording_thumbnail(recording: &RecordingCard, directory: &Directory) -> AnyElement {165
let image = recording166
.thumbnail167
.as_ref()168
.and_then(|thumbnail| directory.image(&thumbnail.url));169
match image {170
Some(entry) => img(entry.path.clone())171
.size_full()172
.object_fit(ObjectFit::Cover)173
.into_any_element(),174
None => div()175
.size_full()176
.bg(theme::code_surface())177
.into_any_element(),178
}179
}180
181
fn recording_tile(182
recording: &RecordingCard,183
index: usize,184
directory: &Directory,185
open_recording: RowAction,186
) -> Stateful<Div> {187
div()188
.id(ElementId::Name(format!("call-recording-{index}").into()))189
.relative()190
.w(px(TILE_WIDTH))191
.h(px(TILE_HEIGHT))192
.flex_none()193
.rounded(px(TILE_RADIUS))194
.overflow_hidden()195
.cursor_pointer()196
.hover(|tile| tile.opacity(0.92))197
.child(recording_thumbnail(recording, directory))198
.child(199
h_flex()200
.absolute()201
.inset_0()202
.items_center()203
.justify_center()204
.child(205
h_flex()206
.size(px(PLAY_CIRCLE))207
.items_center()208
.justify_center()209
.rounded_full()210
.bg(black().opacity(0.55))211
.child(symbol("play_arrow", PLAY_GLYPH, theme::white())),212
),213
)214
.children(recording.duration.clone().map(|duration| {215
div()216
.absolute()217
.bottom(px(DURATION_INSET))218
.right(px(DURATION_INSET))219
.px(px(6.))220
.py(px(1.))221
.rounded(px(4.))222
.bg(black().opacity(0.65))223
.text_size(px(DETAIL_SIZE))224
.font_weight(FontWeight::SEMIBOLD)225
.text_color(theme::white())226
.child(duration)227
}))228
.when_some(open_recording, |tile, open| {229
tile.on_click(move |_, _, cx| open(cx))230
})231
}232
233
fn transcript_chip(index: usize, open_transcript: RowAction) -> Stateful<Div> {234
h_flex()235
.id(ElementId::Name(format!("call-transcript-{index}").into()))236
.h(px(CHIP_HEIGHT))237
.px(px(10.))238
.gap(px(6.))239
.flex_none()240
.items_center()241
.rounded(px(6.))242
.border_1()243
.border_color(theme::border())244
.text_size(px(DETAIL_SIZE + 1.))245
.font_weight(FontWeight::SEMIBOLD)246
.text_color(theme::text())247
.cursor_pointer()248
.hover(|chip| chip.bg(theme::popup_hover()))249
.child(symbol("description", 15., theme::accent_text()))250
.child("Transcript")251
.when_some(open_transcript, |chip, open| {252
chip.on_click(move |_, _, cx| open(cx))253
})254
}255
256
fn recording_block(257
recording: &RecordingCard,258
index: usize,259
directory: &Directory,260
open_recording: RowAction,261
open_transcript: RowAction,262
) -> Div {263
v_flex()264
.pt(px(4.))265
.gap(px(8.))266
.child(recording_tile(recording, index, directory, open_recording))267
.child(268
h_flex()269
.w(px(TILE_WIDTH))270
.gap(px(8.))271
.items_center()272
.child(273
div()274
.flex_1()275
.min_w_0()276
.truncate()277
.text_size(px(TITLE_SIZE))278
.font_weight(FontWeight::SEMIBOLD)279
.text_color(theme::text())280
.child(recording.title.clone()),281
)282
.when(recording.transcript, |line| {283
line.child(transcript_chip(index, open_transcript))284
}),285
)286
}287
288
fn card(161
fn card(289
call: &CallCard,162
call: &CallCard,290
index: usize,163
index: usize,@@ -292,12 +165,7 @@ fn card(292
actions: CallActions,165
actions: CallActions,293
directory: &Directory,166
directory: &Directory,294
) -> Div {167
) -> Div {295
let CallActions {168
let CallActions { call_back, join, .. } = actions;296
call_back,297
join,298
open_recording,299
open_transcript,300
} = actions;301
let show_join = call.started && join.is_some();169
let show_join = call.started && join.is_some();302
let summary = h_flex()170
let summary = h_flex()303
.gap(px(8.))171
.gap(px(8.))@@ -341,9 +209,6 @@ fn card(341
theme::bubble_other()209
theme::bubble_other()342
})210
})343
.child(summary)211
.child(summary)344
.children(call.recording.as_ref().map(|recording| {345
recording_block(recording, index, directory, open_recording, open_transcript)346
}))347
}212
}348
213
349
pub(super) fn post_call_card(214
pub(super) fn post_call_card(@@ -362,6 +227,9 @@ pub(super) fn call_card_row(362
directory: &Directory,227
directory: &Directory,363
actions: CallActions,228
actions: CallActions,364
) -> AnyElement {229
) -> AnyElement {230
if let Some(notice) = &call.notice {231
return notice_row(row, call, notice, index, directory, actions.recap);232
}365
let own = row.own;233
let own = row.own;366
let body = if own {234
let body = if own {367
h_flex()235
h_flex()@@ -0,0 +1,379 @@
1
use gpui_kit::component::{h_flex, v_flex};
2
use gpui_kit::prelude::FluentBuilder as _;
3
use gpui_kit::*;
4
5
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker};
6
use super::widgets::symbol;
7
use crate::data::Directory;
8
use crate::rows::{CallCard, CallIcon, CallNotice, MessageRow, RecapCard, RecordingCard};
9
use crate::theme;
10
11
const ROW_TOP: f32 = 8.;
12
const LINE_HEIGHT: f32 = 20.;
13
const TEXT_SIZE: f32 = 12.;
14
const ICON_SIZE: f32 = 20.;
15
const STAMP_GAP: &str = "\u{2003}";
16
const CARD_TOP: f32 = 14.;
17
const CARD_MAX_WIDTH: f32 = 646.;
18
const CARD_RADIUS: f32 = 8.;
19
const CARD_PADDING_X: f32 = 20.;
20
const CARD_PADDING_TOP: f32 = 14.;
21
const TITLE_SIZE: f32 = 16.;
22
const BUTTON_HEIGHT: f32 = 32.;
23
const BUTTON_RADIUS: f32 = 4.;
24
const VIEW_RECAP_WIDTH: f32 = 108.;
25
const VIEW_RECAP_SIZE: f32 = 14.;
26
const DIVIDER_GAP: f32 = 12.;
27
const CONTENT_GAP_TOP: f32 = 12.;
28
const CONTENT_GAP_BOTTOM: f32 = 16.;
29
const CHIP_MIN_WIDTH: f32 = 96.;
30
const CHIP_ICON_GAP: f32 = 6.;
31
const THUMB_WIDTH: f32 = 108.;
32
const THUMB_HEIGHT: f32 = 60.;
33
const THUMB_RADIUS: f32 = 6.;
34
const BADGE_INSET_RIGHT: f32 = 6.;
35
const BADGE_INSET_BOTTOM: f32 = 8.;
36
const EXPIRY_SIZE: f32 = 10.;
37
const EXPIRY_LINE: f32 = 24.;
38
const EXPIRY_ICON_GAP: f32 = 4.;
39
const CONTENT_LABEL: &str = "Content";
40
41
pub struct RecapActions {
42
pub view_recap: RowAction,
43
pub open_recording: RowAction,
44
pub transcript: RowAction,
45
pub share: RowAction,
46
}
47
48
fn notice_icon(icon: CallIcon) -> (&'static str, Hsla) {
49
match icon {
50
CallIcon::Record => ("fluent_record", theme::accent_text()),
51
CallIcon::RecordStop => ("fluent_record_stop", theme::text_muted()),
52
CallIcon::Saved => ("fluent_cloud_arrow_up", theme::text_muted()),
53
CallIcon::Video | CallIcon::Call | CallIcon::Missed => {
54
("fluent_video", theme::text_muted())
55
}
56
}
57
}
58
59
fn notice_text(notice: &CallNotice) -> StyledText {
60
let mut text = format!("{}{STAMP_GAP}{}", notice.stamp, notice.text);
61
let mut highlights = Vec::new();
62
if let Some(emphasis) = ¬ice.emphasis {
63
text.push('\u{a0}');
64
let start = text.len();
65
text.push_str(emphasis);
66
highlights.push((
67
start..text.len(),
68
HighlightStyle {
69
font_weight: Some(FontWeight::BOLD),
70
..HighlightStyle::default()
71
},
72
));
73
}
74
StyledText::new(text).with_highlights(highlights)
75
}
76
77
fn plain_button(id: String, action: RowAction) -> Stateful<Div> {
78
h_flex()
79
.id(ElementId::Name(id.into()))
80
.h(px(BUTTON_HEIGHT))
81
.flex_none()
82
.items_center()
83
.justify_center()
84
.rounded(px(BUTTON_RADIUS))
85
.cursor_pointer()
86
.when_some(action, |button, action| {
87
button.on_click(move |_, _, cx| action(cx))
88
})
89
}
90
91
fn recap_header(recap: &RecapCard, index: usize, open: RowAction, share: RowAction) -> Div {
92
h_flex()
93
.w_full()
94
.items_start()
95
.gap(px(4.))
96
.child(
97
v_flex()
98
.flex_1()
99
.min_w_0()
100
.line_height(px(LINE_HEIGHT))
101
.child(
102
div()
103
.truncate()
104
.text_size(px(TITLE_SIZE))
105
.font_weight(FontWeight::SEMIBOLD)
106
.text_color(theme::text())
107
.child(recap.title.clone()),
108
)
109
.child(
110
div()
111
.truncate()
112
.text_size(px(TEXT_SIZE))
113
.text_color(theme::text_muted())
114
.child(recap.date_line.clone()),
115
),
116
)
117
.child(
118
h_flex()
119
.pt(px(2.))
120
.gap(px(4.))
121
.child(
122
plain_button(format!("recap-share-{index}"), share)
123
.w(px(BUTTON_HEIGHT))
124
.hover(|button| button.bg(theme::popup_hover()))
125
.child(symbol("fluent_share", ICON_SIZE, theme::text_soft())),
126
)
127
.child(
128
plain_button(format!("recap-view-{index}"), open)
129
.w(px(VIEW_RECAP_WIDTH))
130
.bg(theme::accent())
131
.hover(|button| button.opacity(0.85))
132
.text_size(px(VIEW_RECAP_SIZE))
133
.font_weight(FontWeight::SEMIBOLD)
134
.text_color(theme::white())
135
.child("View recap"),
136
),
137
)
138
}
139
140
fn divider() -> Div {
141
div()
142
.w_full()
143
.py(px(DIVIDER_GAP))
144
.child(div().w_full().h(px(1.)).bg(theme::border_strong()))
145
}
146
147
fn transcript_chip(index: usize, transcript: RowAction) -> Stateful<Div> {
148
plain_button(format!("recap-transcript-{index}"), transcript)
149
.min_w(px(CHIP_MIN_WIDTH))
150
.px(px(8.))
151
.gap(px(CHIP_ICON_GAP))
152
.border_1()
153
.border_color(theme::border_strong())
154
.bg(theme::bubble_other())
155
.hover(|chip| chip.bg(theme::popup_hover()))
156
.text_size(px(TEXT_SIZE))
157
.font_weight(FontWeight::SEMIBOLD)
158
.text_color(theme::text())
159
.child(symbol(
160
"fluent_document_text",
161
ICON_SIZE,
162
theme::accent_text(),
163
))
164
.child("Transcript")
165
}
166
167
fn thumbnail_image(recording: &RecordingCard, directory: &Directory) -> AnyElement {
168
let image = recording
169
.thumbnail
170
.as_ref()
171
.and_then(|thumbnail| directory.image(&thumbnail.url));
172
match image {
173
Some(entry) => img(entry.path.clone())
174
.size_full()
175
.object_fit(ObjectFit::Cover)
176
.into_any_element(),
177
None => h_flex()
178
.size_full()
179
.items_center()
180
.justify_center()
181
.bg(theme::code_surface())
182
.when(recording.duration.is_none(), |tile| {
183
tile.child(symbol("fluent_video", ICON_SIZE, theme::text()))
184
})
185
.into_any_element(),
186
}
187
}
188
189
fn recording_thumbnail(
190
recording: &RecordingCard,
191
index: usize,
192
directory: &Directory,
193
open: RowAction,
194
) -> Div {
195
v_flex()
196
.w(px(THUMB_WIDTH))
197
.flex_none()
198
.child(
199
div()
200
.id(ElementId::Name(format!("recap-recording-{index}").into()))
201
.relative()
202
.w(px(THUMB_WIDTH))
203
.h(px(THUMB_HEIGHT))
204
.rounded(px(THUMB_RADIUS))
205
.overflow_hidden()
206
.cursor_pointer()
207
.hover(|tile| tile.opacity(0.92))
208
.child(thumbnail_image(recording, directory))
209
.children(recording.duration.clone().map(|duration| {
210
div()
211
.absolute()
212
.right(px(BADGE_INSET_RIGHT))
213
.bottom(px(BADGE_INSET_BOTTOM))
214
.px(px(6.))
215
.py(px(1.))
216
.rounded(px(2.))
217
.bg(black().opacity(0.5))
218
.text_size(px(TEXT_SIZE))
219
.line_height(px(16.))
220
.text_color(theme::white())
221
.child(duration)
222
}))
223
.when_some(open, |tile, open| tile.on_click(move |_, _, cx| open(cx))),
224
)
225
.children(recording.expires_in_days.map(|days| {
226
h_flex()
227
.h(px(EXPIRY_LINE))
228
.justify_center()
229
.items_center()
230
.gap(px(EXPIRY_ICON_GAP))
231
.text_size(px(EXPIRY_SIZE))
232
.text_color(theme::text_muted())
233
.child(symbol("fluent_clock", EXPIRY_SIZE, theme::text_muted()))
234
.child(if days == 1 {
235
"Expires in 1 day".to_owned()
236
} else {
237
format!("Expires in {days} days")
238
})
239
}))
240
}
241
242
fn recap_card(
243
recap: &RecapCard,
244
index: usize,
245
directory: &Directory,
246
actions: RecapActions,
247
) -> Div {
248
let RecapActions {
249
view_recap,
250
open_recording,
251
transcript,
252
share,
253
} = actions;
254
v_flex()
255
.mt(px(CARD_TOP))
256
.w_full()
257
.max_w(px(CARD_MAX_WIDTH))
258
.pt(px(CARD_PADDING_TOP))
259
.px(px(CARD_PADDING_X))
260
.rounded(px(CARD_RADIUS))
261
.bg(theme::bubble_other())
262
.shadow(card_shadow())
263
.child(recap_header(recap, index, view_recap, share))
264
.child(divider())
265
.child(
266
h_flex()
267
.w_full()
268
.items_start()
269
.child(
270
v_flex()
271
.flex_1()
272
.min_w_0()
273
.child(
274
div()
275
.text_size(px(TEXT_SIZE))
276
.line_height(px(16.))
277
.font_weight(FontWeight::SEMIBOLD)
278
.text_color(theme::text_soft())
279
.child(CONTENT_LABEL),
280
)
281
.child(
282
h_flex()
283
.mt(px(CONTENT_GAP_TOP))
284
.mb(px(CONTENT_GAP_BOTTOM))
285
.when(recap.recording.transcript, |chips| {
286
chips.child(transcript_chip(index, transcript))
287
}),
288
),
289
)
290
.child(recording_thumbnail(
291
&recap.recording,
292
index,
293
directory,
294
open_recording,
295
)),
296
)
297
}
298
299
fn card_shadow() -> Vec<BoxShadow> {
300
vec![
301
BoxShadow {
302
color: hsla(0., 0., 0., 0.24),
303
offset: point(px(0.), px(0.)),
304
blur_radius: px(1.),
305
spread_radius: px(0.),
306
inset: false,
307
},
308
BoxShadow {
309
color: hsla(0., 0., 0., 0.28),
310
offset: point(px(0.), px(2.)),
311
blur_radius: px(2.),
312
spread_radius: px(0.),
313
inset: false,
314
},
315
]
316
}
317
318
pub(super) fn notice_line(
319
call: &CallCard,
320
notice: &CallNotice,
321
index: usize,
322
directory: &Directory,
323
actions: RecapActions,
324
) -> Div {
325
let (glyph, tint) = notice_icon(call.icon);
326
h_flex()
327
.w_full()
328
.pt(px(ROW_TOP))
329
.items_start()
330
.gap(px(AVATAR_GAP))
331
.child(
332
h_flex()
333
.w(px(AVATAR_SIZE))
334
.h(px(LINE_HEIGHT))
335
.flex_none()
336
.justify_center()
337
.items_center()
338
.child(symbol(glyph, ICON_SIZE, tint)),
339
)
340
.child(
341
v_flex()
342
.flex_1()
343
.min_w_0()
344
.child(
345
div()
346
.text_size(px(TEXT_SIZE))
347
.line_height(px(LINE_HEIGHT))
348
.text_color(theme::text_muted())
349
.child(notice_text(notice)),
350
)
351
.children(
352
call.recap
353
.as_ref()
354
.map(|recap| recap_card(recap, index, directory, actions)),
355
),
356
)
357
}
358
359
pub(super) fn notice_row(
360
row: &MessageRow,
361
call: &CallCard,
362
notice: &CallNotice,
363
index: usize,
364
directory: &Directory,
365
actions: RecapActions,
366
) -> AnyElement {
367
v_flex()
368
.w_full()
369
.px(px(20.))
370
.children(row.day_header.as_deref().map(day_separator))
371
.when(row.new_marker, |column| column.child(new_marker()))
372
.child(
373
div()
374
.id(ElementId::Name(format!("row-{index}").into()))
375
.w_full()
376
.child(notice_line(call, notice, index, directory, actions)),
377
)
378
.into_any_element()
379
}
@@ -0,0 +1,379 @@1
use gpui_kit::component::{h_flex, v_flex};2
use gpui_kit::prelude::FluentBuilder as _;3
use gpui_kit::*;4
5
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, RowAction, day_separator, new_marker};6
use super::widgets::symbol;7
use crate::data::Directory;8
use crate::rows::{CallCard, CallIcon, CallNotice, MessageRow, RecapCard, RecordingCard};9
use crate::theme;10
11
const ROW_TOP: f32 = 8.;12
const LINE_HEIGHT: f32 = 20.;13
const TEXT_SIZE: f32 = 12.;14
const ICON_SIZE: f32 = 20.;15
const STAMP_GAP: &str = "\u{2003}";16
const CARD_TOP: f32 = 14.;17
const CARD_MAX_WIDTH: f32 = 646.;18
const CARD_RADIUS: f32 = 8.;19
const CARD_PADDING_X: f32 = 20.;20
const CARD_PADDING_TOP: f32 = 14.;21
const TITLE_SIZE: f32 = 16.;22
const BUTTON_HEIGHT: f32 = 32.;23
const BUTTON_RADIUS: f32 = 4.;24
const VIEW_RECAP_WIDTH: f32 = 108.;25
const VIEW_RECAP_SIZE: f32 = 14.;26
const DIVIDER_GAP: f32 = 12.;27
const CONTENT_GAP_TOP: f32 = 12.;28
const CONTENT_GAP_BOTTOM: f32 = 16.;29
const CHIP_MIN_WIDTH: f32 = 96.;30
const CHIP_ICON_GAP: f32 = 6.;31
const THUMB_WIDTH: f32 = 108.;32
const THUMB_HEIGHT: f32 = 60.;33
const THUMB_RADIUS: f32 = 6.;34
const BADGE_INSET_RIGHT: f32 = 6.;35
const BADGE_INSET_BOTTOM: f32 = 8.;36
const EXPIRY_SIZE: f32 = 10.;37
const EXPIRY_LINE: f32 = 24.;38
const EXPIRY_ICON_GAP: f32 = 4.;39
const CONTENT_LABEL: &str = "Content";40
41
pub struct RecapActions {42
pub view_recap: RowAction,43
pub open_recording: RowAction,44
pub transcript: RowAction,45
pub share: RowAction,46
}47
48
fn notice_icon(icon: CallIcon) -> (&'static str, Hsla) {49
match icon {50
CallIcon::Record => ("fluent_record", theme::accent_text()),51
CallIcon::RecordStop => ("fluent_record_stop", theme::text_muted()),52
CallIcon::Saved => ("fluent_cloud_arrow_up", theme::text_muted()),53
CallIcon::Video | CallIcon::Call | CallIcon::Missed => {54
("fluent_video", theme::text_muted())55
}56
}57
}58
59
fn notice_text(notice: &CallNotice) -> StyledText {60
let mut text = format!("{}{STAMP_GAP}{}", notice.stamp, notice.text);61
let mut highlights = Vec::new();62
if let Some(emphasis) = ¬ice.emphasis {63
text.push('\u{a0}');64
let start = text.len();65
text.push_str(emphasis);66
highlights.push((67
start..text.len(),68
HighlightStyle {69
font_weight: Some(FontWeight::BOLD),70
..HighlightStyle::default()71
},72
));73
}74
StyledText::new(text).with_highlights(highlights)75
}76
77
fn plain_button(id: String, action: RowAction) -> Stateful<Div> {78
h_flex()79
.id(ElementId::Name(id.into()))80
.h(px(BUTTON_HEIGHT))81
.flex_none()82
.items_center()83
.justify_center()84
.rounded(px(BUTTON_RADIUS))85
.cursor_pointer()86
.when_some(action, |button, action| {87
button.on_click(move |_, _, cx| action(cx))88
})89
}90
91
fn recap_header(recap: &RecapCard, index: usize, open: RowAction, share: RowAction) -> Div {92
h_flex()93
.w_full()94
.items_start()95
.gap(px(4.))96
.child(97
v_flex()98
.flex_1()99
.min_w_0()100
.line_height(px(LINE_HEIGHT))101
.child(102
div()103
.truncate()104
.text_size(px(TITLE_SIZE))105
.font_weight(FontWeight::SEMIBOLD)106
.text_color(theme::text())107
.child(recap.title.clone()),108
)109
.child(110
div()111
.truncate()112
.text_size(px(TEXT_SIZE))113
.text_color(theme::text_muted())114
.child(recap.date_line.clone()),115
),116
)117
.child(118
h_flex()119
.pt(px(2.))120
.gap(px(4.))121
.child(122
plain_button(format!("recap-share-{index}"), share)123
.w(px(BUTTON_HEIGHT))124
.hover(|button| button.bg(theme::popup_hover()))125
.child(symbol("fluent_share", ICON_SIZE, theme::text_soft())),126
)127
.child(128
plain_button(format!("recap-view-{index}"), open)129
.w(px(VIEW_RECAP_WIDTH))130
.bg(theme::accent())131
.hover(|button| button.opacity(0.85))132
.text_size(px(VIEW_RECAP_SIZE))133
.font_weight(FontWeight::SEMIBOLD)134
.text_color(theme::white())135
.child("View recap"),136
),137
)138
}139
140
fn divider() -> Div {141
div()142
.w_full()143
.py(px(DIVIDER_GAP))144
.child(div().w_full().h(px(1.)).bg(theme::border_strong()))145
}146
147
fn transcript_chip(index: usize, transcript: RowAction) -> Stateful<Div> {148
plain_button(format!("recap-transcript-{index}"), transcript)149
.min_w(px(CHIP_MIN_WIDTH))150
.px(px(8.))151
.gap(px(CHIP_ICON_GAP))152
.border_1()153
.border_color(theme::border_strong())154
.bg(theme::bubble_other())155
.hover(|chip| chip.bg(theme::popup_hover()))156
.text_size(px(TEXT_SIZE))157
.font_weight(FontWeight::SEMIBOLD)158
.text_color(theme::text())159
.child(symbol(160
"fluent_document_text",161
ICON_SIZE,162
theme::accent_text(),163
))164
.child("Transcript")165
}166
167
fn thumbnail_image(recording: &RecordingCard, directory: &Directory) -> AnyElement {168
let image = recording169
.thumbnail170
.as_ref()171
.and_then(|thumbnail| directory.image(&thumbnail.url));172
match image {173
Some(entry) => img(entry.path.clone())174
.size_full()175
.object_fit(ObjectFit::Cover)176
.into_any_element(),177
None => h_flex()178
.size_full()179
.items_center()180
.justify_center()181
.bg(theme::code_surface())182
.when(recording.duration.is_none(), |tile| {183
tile.child(symbol("fluent_video", ICON_SIZE, theme::text()))184
})185
.into_any_element(),186
}187
}188
189
fn recording_thumbnail(190
recording: &RecordingCard,191
index: usize,192
directory: &Directory,193
open: RowAction,194
) -> Div {195
v_flex()196
.w(px(THUMB_WIDTH))197
.flex_none()198
.child(199
div()200
.id(ElementId::Name(format!("recap-recording-{index}").into()))201
.relative()202
.w(px(THUMB_WIDTH))203
.h(px(THUMB_HEIGHT))204
.rounded(px(THUMB_RADIUS))205
.overflow_hidden()206
.cursor_pointer()207
.hover(|tile| tile.opacity(0.92))208
.child(thumbnail_image(recording, directory))209
.children(recording.duration.clone().map(|duration| {210
div()211
.absolute()212
.right(px(BADGE_INSET_RIGHT))213
.bottom(px(BADGE_INSET_BOTTOM))214
.px(px(6.))215
.py(px(1.))216
.rounded(px(2.))217
.bg(black().opacity(0.5))218
.text_size(px(TEXT_SIZE))219
.line_height(px(16.))220
.text_color(theme::white())221
.child(duration)222
}))223
.when_some(open, |tile, open| tile.on_click(move |_, _, cx| open(cx))),224
)225
.children(recording.expires_in_days.map(|days| {226
h_flex()227
.h(px(EXPIRY_LINE))228
.justify_center()229
.items_center()230
.gap(px(EXPIRY_ICON_GAP))231
.text_size(px(EXPIRY_SIZE))232
.text_color(theme::text_muted())233
.child(symbol("fluent_clock", EXPIRY_SIZE, theme::text_muted()))234
.child(if days == 1 {235
"Expires in 1 day".to_owned()236
} else {237
format!("Expires in {days} days")238
})239
}))240
}241
242
fn recap_card(243
recap: &RecapCard,244
index: usize,245
directory: &Directory,246
actions: RecapActions,247
) -> Div {248
let RecapActions {249
view_recap,250
open_recording,251
transcript,252
share,253
} = actions;254
v_flex()255
.mt(px(CARD_TOP))256
.w_full()257
.max_w(px(CARD_MAX_WIDTH))258
.pt(px(CARD_PADDING_TOP))259
.px(px(CARD_PADDING_X))260
.rounded(px(CARD_RADIUS))261
.bg(theme::bubble_other())262
.shadow(card_shadow())263
.child(recap_header(recap, index, view_recap, share))264
.child(divider())265
.child(266
h_flex()267
.w_full()268
.items_start()269
.child(270
v_flex()271
.flex_1()272
.min_w_0()273
.child(274
div()275
.text_size(px(TEXT_SIZE))276
.line_height(px(16.))277
.font_weight(FontWeight::SEMIBOLD)278
.text_color(theme::text_soft())279
.child(CONTENT_LABEL),280
)281
.child(282
h_flex()283
.mt(px(CONTENT_GAP_TOP))284
.mb(px(CONTENT_GAP_BOTTOM))285
.when(recap.recording.transcript, |chips| {286
chips.child(transcript_chip(index, transcript))287
}),288
),289
)290
.child(recording_thumbnail(291
&recap.recording,292
index,293
directory,294
open_recording,295
)),296
)297
}298
299
fn card_shadow() -> Vec<BoxShadow> {300
vec![301
BoxShadow {302
color: hsla(0., 0., 0., 0.24),303
offset: point(px(0.), px(0.)),304
blur_radius: px(1.),305
spread_radius: px(0.),306
inset: false,307
},308
BoxShadow {309
color: hsla(0., 0., 0., 0.28),310
offset: point(px(0.), px(2.)),311
blur_radius: px(2.),312
spread_radius: px(0.),313
inset: false,314
},315
]316
}317
318
pub(super) fn notice_line(319
call: &CallCard,320
notice: &CallNotice,321
index: usize,322
directory: &Directory,323
actions: RecapActions,324
) -> Div {325
let (glyph, tint) = notice_icon(call.icon);326
h_flex()327
.w_full()328
.pt(px(ROW_TOP))329
.items_start()330
.gap(px(AVATAR_GAP))331
.child(332
h_flex()333
.w(px(AVATAR_SIZE))334
.h(px(LINE_HEIGHT))335
.flex_none()336
.justify_center()337
.items_center()338
.child(symbol(glyph, ICON_SIZE, tint)),339
)340
.child(341
v_flex()342
.flex_1()343
.min_w_0()344
.child(345
div()346
.text_size(px(TEXT_SIZE))347
.line_height(px(LINE_HEIGHT))348
.text_color(theme::text_muted())349
.child(notice_text(notice)),350
)351
.children(352
call.recap353
.as_ref()354
.map(|recap| recap_card(recap, index, directory, actions)),355
),356
)357
}358
359
pub(super) fn notice_row(360
row: &MessageRow,361
call: &CallCard,362
notice: &CallNotice,363
index: usize,364
directory: &Directory,365
actions: RecapActions,366
) -> AnyElement {367
v_flex()368
.w_full()369
.px(px(20.))370
.children(row.day_header.as_deref().map(day_separator))371
.when(row.new_marker, |column| column.child(new_marker()))372
.child(373
div()374
.id(ElementId::Name(format!("row-{index}").into()))375
.w_full()376
.child(notice_line(call, notice, index, directory, actions)),377
)378
.into_any_element()379
}@@ -1271,6 +1271,7 @@ impl ConversationView {
1271
1271
card_overrides,
1272
1272
translation,
1273
1273
skin_tone: teams_core::skin_tone(&app.store),
1274
meeting: self.meeting_info(app),
1274
1275
}
1275
1276
}
1276
1277
@@ -1271,6 +1271,7 @@ impl ConversationView {1271
card_overrides,1271
card_overrides,1272
translation,1272
translation,1273
skin_tone: teams_core::skin_tone(&app.store),1273
skin_tone: teams_core::skin_tone(&app.store),1274
meeting: self.meeting_info(app),1274
}1275
}1275
}1276
}1276
1277
@@ -5,6 +5,7 @@ use std::rc::Rc;
5
5
6
6
use chatsvc::{
7
7
Attendance, Occurrence, Recap, RecordingDetails, TranscriptFormat, TranscriptTurn,
8
days_until_expiry,
8
9
};
9
10
use chrono::Utc;
10
11
use gpui_kit::component::button::{Button, ButtonVariants as _};
@@ -14,7 +15,8 @@ use gpui_kit::component::WindowExt as _;
14
15
use gpui_kit::*;
15
16
16
17
use super::ConversationView;
17
use crate::app_state::Selection;
18
use crate::app_state::{AppState, Selection};
19
use crate::rows::{MeetingInfo, MeetingSlot};
18
20
use crate::channel_files::SharedContent;
19
21
use crate::demo_recap;
20
22
use crate::downloads::{self, DownloadState};
@@ -27,6 +29,7 @@ use crate::views::shared_tab::{SharedCommand, SharedRun};
27
29
28
30
const SEARCH_PLACEHOLDER: &str = "Search transcript";
29
31
const RECORDING_EXTENSION: &str = "mp4";
32
const EXPIRY_OCCURRENCES: usize = 3;
30
33
31
34
pub(super) fn search_input(
32
35
window: &mut Window,
@@ -44,6 +47,7 @@ pub(super) struct RecapState {
44
47
query: String,
45
48
downloads: HashMap<RecapDownload, DownloadState>,
46
49
generation: u64,
50
expiry_days: HashMap<String, i64>,
47
51
}
48
52
49
53
impl Default for RecapState {
@@ -57,6 +61,7 @@ impl Default for RecapState {
57
61
query: String::new(),
58
62
downloads: HashMap::new(),
59
63
generation: 0,
64
expiry_days: HashMap::new(),
60
65
}
61
66
}
62
67
}
@@ -119,7 +124,19 @@ impl ConversationView {
119
124
let state = self.app.read(cx);
120
125
let (demo, engine) = (state.mode.demo, state.engine.clone());
121
126
if demo {
122
self.recap.listing = Load::Ready(demo_recap::occurrences(&conversation_id, Utc::now()));
127
let now = Utc::now();
128
let occurrences = demo_recap::occurrences(&conversation_id, now);
129
self.recap.expiry_days = occurrences
130
.iter()
131
.filter_map(|occurrence| {
132
let expires_at = demo_recap::details(occurrence, now).expires_at?;
133
Some((
134
occurrence.message_id.clone(),
135
days_until_expiry(expires_at, now),
136
))
137
})
138
.collect();
139
self.recap.listing = Load::Ready(occurrences);
123
140
return;
124
141
}
125
142
let Some(engine) = engine else {
@@ -142,7 +159,10 @@ impl ConversationView {
142
159
return;
143
160
}
144
161
this.recap.listing = match outcome {
145
Ok(occurrences) => Load::Ready(occurrences),
162
Ok(occurrences) => {
163
this.load_expiry(&occurrences, cx);
164
Load::Ready(occurrences)
165
}
146
166
Err(reason) => Load::Failed(reason),
147
167
};
148
168
if this.pane == ChannelPane::Recap {
@@ -155,6 +175,74 @@ impl ConversationView {
155
175
.detach();
156
176
}
157
177
178
/// The chat's recording lines and recap cards say when a recording expires; the value comes
179
/// from the same SharePoint list item the Recap tab reads.
180
fn load_expiry(&mut self, occurrences: &[Occurrence], cx: &mut Context<Self>) {
181
let (Some(engine), Some(conversation_id)) =
182
(self.app.read(cx).engine.clone(), self.conversation_id())
183
else {
184
return;
185
};
186
let newest: Vec<Occurrence> = occurrences
187
.iter()
188
.take(EXPIRY_OCCURRENCES)
189
.cloned()
190
.collect();
191
if newest.is_empty() {
192
return;
193
}
194
let receiver = runtime::spawn(async move {
195
let recap = Recap::new(engine.remote().session());
196
let mut found = Vec::new();
197
for occurrence in newest {
198
if let Ok(details) = recap.details(&occurrence).await {
199
found.push((occurrence.message_id, details.expires_at));
200
}
201
}
202
found
203
});
204
cx.spawn(async move |this, cx| {
205
let Ok(found) = receiver.await else {
206
return;
207
};
208
this.update(cx, |this, cx| {
209
if this.conversation_id().as_deref() != Some(conversation_id.as_str()) {
210
return;
211
}
212
let now = Utc::now();
213
this.recap.expiry_days = found
214
.into_iter()
215
.filter_map(|(message_id, expires_at)| {
216
Some((message_id, days_until_expiry(expires_at?, now)))
217
})
218
.collect();
219
this.rebuild(false, cx);
220
})
221
.ok();
222
})
223
.detach();
224
}
225
226
pub(super) fn meeting_info(&self, app: &AppState) -> MeetingInfo {
227
let Some(current) = self.current.as_ref() else {
228
return MeetingInfo::default();
229
};
230
let conversation_id = current.selection.conversation_id();
231
MeetingInfo {
232
title: Some(current.title.clone()),
233
slots: app
234
.calendar_events
235
.iter()
236
.filter(|event| event.thread_id.as_deref() == Some(conversation_id))
237
.map(|event| MeetingSlot {
238
start: event.start,
239
end: event.end,
240
})
241
.collect(),
242
expiry_days: self.recap.expiry_days.clone(),
243
}
244
}
245
158
246
/// Teams opens a meeting chat recording in the Recap tab at its occurrence and plays any
159
247
/// other recording (channel meetings) in the browser.
160
248
pub(super) fn open_recording(
@@ -5,6 +5,7 @@ use std::rc::Rc;5
5
6
use chatsvc::{6
use chatsvc::{7
Attendance, Occurrence, Recap, RecordingDetails, TranscriptFormat, TranscriptTurn,7
Attendance, Occurrence, Recap, RecordingDetails, TranscriptFormat, TranscriptTurn,8
days_until_expiry,8
};9
};9
use chrono::Utc;10
use chrono::Utc;10
use gpui_kit::component::button::{Button, ButtonVariants as _};11
use gpui_kit::component::button::{Button, ButtonVariants as _};@@ -14,7 +15,8 @@ use gpui_kit::component::WindowExt as _;14
use gpui_kit::*;15
use gpui_kit::*;15
16
16
use super::ConversationView;17
use super::ConversationView;17
use crate::app_state::Selection;18
use crate::app_state::{AppState, Selection};19
use crate::rows::{MeetingInfo, MeetingSlot};18
use crate::channel_files::SharedContent;20
use crate::channel_files::SharedContent;19
use crate::demo_recap;21
use crate::demo_recap;20
use crate::downloads::{self, DownloadState};22
use crate::downloads::{self, DownloadState};@@ -27,6 +29,7 @@ use crate::views::shared_tab::{SharedCommand, SharedRun};27
29
28
const SEARCH_PLACEHOLDER: &str = "Search transcript";30
const SEARCH_PLACEHOLDER: &str = "Search transcript";29
const RECORDING_EXTENSION: &str = "mp4";31
const RECORDING_EXTENSION: &str = "mp4";32
const EXPIRY_OCCURRENCES: usize = 3;30
33
31
pub(super) fn search_input(34
pub(super) fn search_input(32
window: &mut Window,35
window: &mut Window,@@ -44,6 +47,7 @@ pub(super) struct RecapState {44
query: String,47
query: String,45
downloads: HashMap<RecapDownload, DownloadState>,48
downloads: HashMap<RecapDownload, DownloadState>,46
generation: u64,49
generation: u64,50
expiry_days: HashMap<String, i64>,47
}51
}48
52
49
impl Default for RecapState {53
impl Default for RecapState {@@ -57,6 +61,7 @@ impl Default for RecapState {57
query: String::new(),61
query: String::new(),58
downloads: HashMap::new(),62
downloads: HashMap::new(),59
generation: 0,63
generation: 0,64
expiry_days: HashMap::new(),60
}65
}61
}66
}62
}67
}@@ -119,7 +124,19 @@ impl ConversationView {119
let state = self.app.read(cx);124
let state = self.app.read(cx);120
let (demo, engine) = (state.mode.demo, state.engine.clone());125
let (demo, engine) = (state.mode.demo, state.engine.clone());121
if demo {126
if demo {122
self.recap.listing = Load::Ready(demo_recap::occurrences(&conversation_id, Utc::now()));127
let now = Utc::now();128
let occurrences = demo_recap::occurrences(&conversation_id, now);129
self.recap.expiry_days = occurrences130
.iter()131
.filter_map(|occurrence| {132
let expires_at = demo_recap::details(occurrence, now).expires_at?;133
Some((134
occurrence.message_id.clone(),135
days_until_expiry(expires_at, now),136
))137
})138
.collect();139
self.recap.listing = Load::Ready(occurrences);123
return;140
return;124
}141
}125
let Some(engine) = engine else {142
let Some(engine) = engine else {@@ -142,7 +159,10 @@ impl ConversationView {142
return;159
return;143
}160
}144
this.recap.listing = match outcome {161
this.recap.listing = match outcome {145
Ok(occurrences) => Load::Ready(occurrences),162
Ok(occurrences) => {163
this.load_expiry(&occurrences, cx);164
Load::Ready(occurrences)165
}146
Err(reason) => Load::Failed(reason),166
Err(reason) => Load::Failed(reason),147
};167
};148
if this.pane == ChannelPane::Recap {168
if this.pane == ChannelPane::Recap {@@ -155,6 +175,74 @@ impl ConversationView {155
.detach();175
.detach();156
}176
}157
177
178
/// The chat's recording lines and recap cards say when a recording expires; the value comes179
/// from the same SharePoint list item the Recap tab reads.180
fn load_expiry(&mut self, occurrences: &[Occurrence], cx: &mut Context<Self>) {181
let (Some(engine), Some(conversation_id)) =182
(self.app.read(cx).engine.clone(), self.conversation_id())183
else {184
return;185
};186
let newest: Vec<Occurrence> = occurrences187
.iter()188
.take(EXPIRY_OCCURRENCES)189
.cloned()190
.collect();191
if newest.is_empty() {192
return;193
}194
let receiver = runtime::spawn(async move {195
let recap = Recap::new(engine.remote().session());196
let mut found = Vec::new();197
for occurrence in newest {198
if let Ok(details) = recap.details(&occurrence).await {199
found.push((occurrence.message_id, details.expires_at));200
}201
}202
found203
});204
cx.spawn(async move |this, cx| {205
let Ok(found) = receiver.await else {206
return;207
};208
this.update(cx, |this, cx| {209
if this.conversation_id().as_deref() != Some(conversation_id.as_str()) {210
return;211
}212
let now = Utc::now();213
this.recap.expiry_days = found214
.into_iter()215
.filter_map(|(message_id, expires_at)| {216
Some((message_id, days_until_expiry(expires_at?, now)))217
})218
.collect();219
this.rebuild(false, cx);220
})221
.ok();222
})223
.detach();224
}225
226
pub(super) fn meeting_info(&self, app: &AppState) -> MeetingInfo {227
let Some(current) = self.current.as_ref() else {228
return MeetingInfo::default();229
};230
let conversation_id = current.selection.conversation_id();231
MeetingInfo {232
title: Some(current.title.clone()),233
slots: app234
.calendar_events235
.iter()236
.filter(|event| event.thread_id.as_deref() == Some(conversation_id))237
.map(|event| MeetingSlot {238
start: event.start,239
end: event.end,240
})241
.collect(),242
expiry_days: self.recap.expiry_days.clone(),243
}244
}245
158
/// Teams opens a meeting chat recording in the Recap tab at its occurrence and plays any246
/// Teams opens a meeting chat recording in the Recap tab at its occurrence and plays any159
/// other recording (channel meetings) in the browser.247
/// other recording (channel meetings) in the browser.160
pub(super) fn open_recording(248
pub(super) fn open_recording(@@ -15,6 +15,7 @@ use crate::agent_api::agent_label;
15
15
use crate::agents::AgentRun;
16
16
use crate::app_state::AppState;
17
17
use crate::rows::{Delivery, MessageRow, PostRow, RecordingCard};
18
use crate::views::call_notice::RecapActions;
18
19
use crate::scheduled_rows::SCHEDULED_KEY_PREFIX;
19
20
use crate::translation::TranslationLine;
20
21
use crate::views::adaptive_card::{ensure_cards_inputs, request_card_refreshes};
@@ -72,7 +73,7 @@ impl RenderEnv {
72
73
message
73
74
.call
74
75
.as_ref()
75
.and_then(|call| call.recording.as_ref()?.thumbnail.clone()),
76
.and_then(|call| call.recap.as_ref()?.recording.thumbnail.clone()),
76
77
)
77
78
.filter(|image| self.app.read(cx).directory.image(&image.url).is_none())
78
79
.collect();
@@ -340,11 +341,19 @@ impl RenderEnv {
340
341
.ok();
341
342
})
342
343
};
344
let recording = call.recap.as_ref().map(|recap| &recap.recording);
345
let share = recording.and_then(|recording| recording.url.clone()).map(|url| {
346
boxed(move |cx| cx.write_to_clipboard(ClipboardItem::new_string(url.clone())))
347
});
343
348
CallActions {
344
349
call_back,
345
350
join,
346
open_recording: call.recording.as_ref().map(open),
347
open_transcript: call.recording.as_ref().map(open),
351
recap: RecapActions {
352
view_recap: recording.map(open),
353
open_recording: recording.map(open),
354
transcript: recording.map(open),
355
share,
356
},
348
357
}
349
358
}
350
359
@@ -15,6 +15,7 @@ use crate::agent_api::agent_label;15
use crate::agents::AgentRun;15
use crate::agents::AgentRun;16
use crate::app_state::AppState;16
use crate::app_state::AppState;17
use crate::rows::{Delivery, MessageRow, PostRow, RecordingCard};17
use crate::rows::{Delivery, MessageRow, PostRow, RecordingCard};18
use crate::views::call_notice::RecapActions;18
use crate::scheduled_rows::SCHEDULED_KEY_PREFIX;19
use crate::scheduled_rows::SCHEDULED_KEY_PREFIX;19
use crate::translation::TranslationLine;20
use crate::translation::TranslationLine;20
use crate::views::adaptive_card::{ensure_cards_inputs, request_card_refreshes};21
use crate::views::adaptive_card::{ensure_cards_inputs, request_card_refreshes};@@ -72,7 +73,7 @@ impl RenderEnv {72
message73
message73
.call74
.call74
.as_ref()75
.as_ref()75
.and_then(|call| call.recording.as_ref()?.thumbnail.clone()),76
.and_then(|call| call.recap.as_ref()?.recording.thumbnail.clone()),76
)77
)77
.filter(|image| self.app.read(cx).directory.image(&image.url).is_none())78
.filter(|image| self.app.read(cx).directory.image(&image.url).is_none())78
.collect();79
.collect();@@ -340,11 +341,19 @@ impl RenderEnv {340
.ok();341
.ok();341
})342
})342
};343
};344
let recording = call.recap.as_ref().map(|recap| &recap.recording);345
let share = recording.and_then(|recording| recording.url.clone()).map(|url| {346
boxed(move |cx| cx.write_to_clipboard(ClipboardItem::new_string(url.clone())))347
});343
CallActions {348
CallActions {344
call_back,349
call_back,345
join,350
join,346
open_recording: call.recording.as_ref().map(open),351
recap: RecapActions {347
open_transcript: call.recording.as_ref().map(open),352
view_recap: recording.map(open),353
open_recording: recording.map(open),354
transcript: recording.map(open),355
share,356
},348
}357
}349
}358
}350
359
@@ -5,6 +5,7 @@ pub mod attachment_tray;
5
5
pub mod attachments;
6
6
pub mod avatar;
7
7
pub mod call_card;
8
pub mod call_notice;
8
9
pub mod call_control_fold;
9
10
pub mod call_end_view;
10
11
pub mod call_controls;
@@ -5,6 +5,7 @@ pub mod attachment_tray;5
pub mod attachments;5
pub mod attachments;6
pub mod avatar;6
pub mod avatar;7
pub mod call_card;7
pub mod call_card;8
pub mod call_notice;8
pub mod call_control_fold;9
pub mod call_control_fold;9
pub mod call_end_view;10
pub mod call_end_view;10
pub mod call_controls;11
pub mod call_controls;@@ -7,6 +7,7 @@ use super::adaptive_card::cards_view;
7
7
use super::attachments::{attachments_view, message_body};
8
8
use super::avatar::{bot_avatar, person_avatar};
9
9
use super::call_card::{CallActions, post_call_card};
10
use super::call_notice::notice_line;
10
11
use super::link_preview::{link_preview_card, meeting_join_chip};
11
12
use super::message_actions::message_toolbar;
12
13
use super::message_row::{BODY_SIZE, RowActions, delivery_note, forwarded_header, has_text};
@@ -199,6 +200,18 @@ fn message_block(
199
200
Some(bot) => bot_avatar(bot, size),
200
201
None => person_avatar(directory, row.sender_id.as_deref(), &row.author, size),
201
202
};
203
if let (Role::Reply, Some(call)) = (role, &row.call)
204
&& let Some(notice) = &call.notice
205
{
206
let recap = std::mem::replace(&mut actions.call, CallActions::none()).recap;
207
return div()
208
.id(ElementId::Name(format!("post-message-{index}").into()))
209
.w_full()
210
.px(px(CARD_PADDING))
211
.pb(px(CARD_PADDING))
212
.bg(theme::reply_surface())
213
.child(notice_line(call, notice, index, directory, recap));
214
}
202
215
let profile_user = row.sender_id.as_deref().filter(|_| actions.bot.is_none());
203
216
let content = match &row.call {
204
217
Some(call) => v_flex().child(post_call_card(
@@ -7,6 +7,7 @@ use super::adaptive_card::cards_view;7
use super::attachments::{attachments_view, message_body};7
use super::attachments::{attachments_view, message_body};8
use super::avatar::{bot_avatar, person_avatar};8
use super::avatar::{bot_avatar, person_avatar};9
use super::call_card::{CallActions, post_call_card};9
use super::call_card::{CallActions, post_call_card};10
use super::call_notice::notice_line;10
use super::link_preview::{link_preview_card, meeting_join_chip};11
use super::link_preview::{link_preview_card, meeting_join_chip};11
use super::message_actions::message_toolbar;12
use super::message_actions::message_toolbar;12
use super::message_row::{BODY_SIZE, RowActions, delivery_note, forwarded_header, has_text};13
use super::message_row::{BODY_SIZE, RowActions, delivery_note, forwarded_header, has_text};@@ -199,6 +200,18 @@ fn message_block(199
Some(bot) => bot_avatar(bot, size),200
Some(bot) => bot_avatar(bot, size),200
None => person_avatar(directory, row.sender_id.as_deref(), &row.author, size),201
None => person_avatar(directory, row.sender_id.as_deref(), &row.author, size),201
};202
};203
if let (Role::Reply, Some(call)) = (role, &row.call)204
&& let Some(notice) = &call.notice205
{206
let recap = std::mem::replace(&mut actions.call, CallActions::none()).recap;207
return div()208
.id(ElementId::Name(format!("post-message-{index}").into()))209
.w_full()210
.px(px(CARD_PADDING))211
.pb(px(CARD_PADDING))212
.bg(theme::reply_surface())213
.child(notice_line(call, notice, index, directory, recap));214
}202
let profile_user = row.sender_id.as_deref().filter(|_| actions.bot.is_none());215
let profile_user = row.sender_id.as_deref().filter(|_| actions.bot.is_none());203
let content = match &row.call {216
let content = match &row.call {204
Some(call) => v_flex().child(post_call_card(217
Some(call) => v_flex().child(post_call_card(