Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions crates/openloops-desktop/src/claim_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,56 @@ pub struct LoopItem {
pub from_call_summary: bool,
pub meeting_time: Option<i64>,
pub meeting_time_approx: bool,
pub mentions: Vec<Mention>,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MentionOrigin {
Restated,
OwnerLink,
Duplicate,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Mention {
pub message: String,
pub block: usize,
pub quote: String,
pub timestamp: i64,
pub origin: MentionOrigin,
}

pub(crate) fn fold_into(
survivor: &mut LoopItem,
dropped: LoopItem,
origin: MentionOrigin,
timestamp: i64,
) {
let mention = Mention {
message: dropped.evidence.message.clone(),
block: dropped.evidence.block,
quote: dropped.evidence.quote.clone(),
timestamp,
origin,
};
if (mention.message != survivor.evidence.message || mention.block != survivor.evidence.block)
&& !survivor
.mentions
.iter()
.any(|existing| existing.message == mention.message && existing.block == mention.block)
{
survivor.mentions.push(mention);
}
for mention in dropped.mentions {
if (mention.message != survivor.evidence.message
|| mention.block != survivor.evidence.block)
&& !survivor.mentions.iter().any(|existing| {
existing.message == mention.message && existing.block == mention.block
})
{
survivor.mentions.push(mention);
}
}
}

pub struct LoopItems {
Expand Down
1 change: 1 addition & 0 deletions crates/openloops-desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub(crate) mod app_model;
pub mod claim_view;
#[cfg(feature = "native-ui")]
pub(crate) mod deadline_view;
pub(crate) mod link_state;
#[cfg(feature = "native-ui")]
pub(crate) mod loop_state;
#[cfg(feature = "native-ui")]
Expand Down
Loading
Loading