chore: fix menu anchoring to trigger bounds
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s

This commit is contained in:
2026-11-28 14:30:57 +07:00
parent 3c5fb68f7e
commit cf81443411
14 changed files with 239 additions and 185 deletions
+2
View File
@@ -20,6 +20,7 @@ where
L: Fn(EventId) -> Option<Event>,
{
let resolver = ThreadResolver::new(lookup);
let mut groups: HashMap<EventId, Vec<Event>> = HashMap::new();
for event in events {
if event.pubkey == me {
@@ -46,6 +47,7 @@ where
.map(|root| {
let mut events = groups.remove(&root).unwrap_or_default();
let mut own_events = own_groups.remove(&root).unwrap_or_default();
sort_newest_first(&mut events);
sort_newest_first(&mut own_events);
+1 -1
View File
@@ -72,8 +72,8 @@ impl InboxItem {
.then_with(|| b.id.to_hex().cmp(&a.id.to_hex()))
});
rest.truncate(limit.saturating_sub(events.len()));
events.extend(rest);
events.extend(rest);
events.sort_by_key(|event| event.created_at);
events
}
@@ -47,6 +47,7 @@ impl InboxReadState {
/// Marks all events from other authors within the window as read.
pub fn mark_all_read(&mut self, all: &[Event], me: PublicKey, now: Timestamp) {
let cutoff = now - MARK_ALL_WINDOW;
self.read_before = cutoff;
self.read_ids = all
.iter()
+2
View File
@@ -131,9 +131,11 @@ where
/// Parses a four-value `e` tag carrying the given marker.
fn e_tag_with_marker(&self, tag: &Tag, marker: &str) -> Option<EventId> {
let slice = tag.as_slice();
if tag.kind() != "e" || slice.len() != 4 || slice[3] != marker {
return None;
}
tag.content()
.and_then(|content| EventId::from_hex(content).ok())
}
+11
View File
@@ -24,6 +24,7 @@ impl<'a> PullRequest<'a> {
let Some(tip) = pr.current_commit() else {
return Vec::new();
};
let Some(last) = patches
.iter()
.filter(|patch| Self::patch_produces_commit(patch, &tip))
@@ -35,10 +36,12 @@ impl<'a> PullRequest<'a> {
let mut series = vec![last];
let mut tail = last;
loop {
let Some(prev_id) = tail.tags.event_ids().next() else {
break;
};
let Some(prev) = patches
.iter()
.find(|patch| patch.id == prev_id && !series.contains(patch))
@@ -46,9 +49,11 @@ impl<'a> PullRequest<'a> {
else {
break;
};
series.push(prev);
tail = prev;
}
series.reverse();
series
}
@@ -58,9 +63,11 @@ impl<'a> PullRequest<'a> {
let pr = self.0;
let patches: Vec<&'a Event> = patches.into_iter().collect();
let series = self.patches(patches.iter().copied());
if series.is_empty() {
return pr.content.clone();
}
series
.iter()
.map(|patch| patch.content.as_str())
@@ -89,18 +96,22 @@ impl<'a> PullRequest<'a> {
fn forward_series(root: &'a Event, patches: &[&'a Event]) -> Vec<&'a Event> {
let mut series = vec![root];
let mut tail = root;
loop {
let next = patches
.iter()
.filter(|patch| !series.contains(patch))
.filter(|patch| patch.tags.event_ids().any(|id| id == tail.id))
.max_by_key(|patch| patch.created_at);
let Some(next) = next else {
break;
};
series.push(next);
tail = next;
}
series
}
+1
View File
@@ -17,6 +17,7 @@ impl Upstream {
.ok()
.filter(|coordinate| coordinate.kind == Kind::GitRepoAnnouncement)
.map(RepoAddr::from);
Self {
raw: raw.to_owned(),
addr,