Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Optimize how the issues are collected
✗ CI failure Matthias Beyer committed 8 months ago
commit 5c0a48c657125a46afdb9f2fd3468b7d43abe62e
parent 775b96ca83c45d48270e4b6470a27db09a320d6b
2 passed 1 failed (3 total) View logs
1 file changed +24 -21
modified crates/radicle-cli/src/commands/issue.rs
@@ -734,30 +734,33 @@ where
        None => None,
    };

-
    let mut all = Vec::new();
-
    let issues = cache.list()?;
-
    for result in issues {
-
        let (id, issue) = match result {
-
            Ok((id, issue)) => (id, issue),
-
            Err(e) => {
-
                // Skip issues that failed to load.
-
                log::error!(target: "cli", "Issue load error: {e}");
-
                continue;
-
            }
-
        };
+
    let mut all = cache
+
        .list()?
+
        .filter_map(|result| {
+
            let (id, issue) = match result {
+
                Ok((id, issue)) => (id, issue),
+
                Err(e) => {
+
                    // Skip issues that failed to load.
+
                    log::error!(target: "cli", "Issue load error: {e}");
+
                    return None;
+
                }
+
            };

-
        if let Some(a) = assignee {
-
            if !issue.assignees().any(|v| v == &Did::from(a)) {
-
                continue;
+
            if let Some(a) = assignee {
+
                if !issue.assignees().any(|v| v == &Did::from(a)) {
+
                    return None;
+
                }
            }
-
        }
-
        if let Some(s) = state {
-
            if s != issue.state() {
-
                continue;
+

+
            if let Some(s) = state {
+
                if s != issue.state() {
+
                    return None;
+
                }
            }
-
        }
-
        all.push((id, issue))
-
    }
+

+
            Some((id, issue))
+
        })
+
        .collect::<Vec<_>>();

    all.sort_by(|(id1, i1), (id2, i2)| {
        let by_timestamp = i2.timestamp().cmp(&i1.timestamp());