Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
bin/inbox: Improve loading times
Erik Kundt committed 6 months ago
commit c7aff1b4b97a7b8c544e11b46d8486c6ffd0924a
parent df8eedef7a81a92e66fec7edaab05988d4491241
2 files changed +7 -8
modified bin/commands/inbox/list.rs
@@ -119,7 +119,7 @@ impl TryFrom<&Context> for State {

                    let items = inbox::all(&repo, &context.profile)?
                        .iter()
-
                        .map(|notif| Notification::new(&context.profile, &repo, notif))
+
                        .map(|notif| Notification::new(&context.profile, &project, &repo, notif))
                        .filter_map(|item| item.ok())
                        .flatten()
                        .collect::<Vec<_>>();
@@ -134,7 +134,9 @@ impl TryFrom<&Context> for State {

                notifs
                    .iter()
-
                    .map(|notif| Notification::new(&context.profile, &context.repository, notif))
+
                    .map(|notif| {
+
                        Notification::new(&context.profile, &project, &context.repository, notif)
+
                    })
                    .filter_map(|item| item.ok())
                    .flatten()
                    .collect::<Vec<_>>()
@@ -145,7 +147,7 @@ impl TryFrom<&Context> for State {

                notifs
                    .iter()
-
                    .map(|notif| Notification::new(&context.profile, &repo, notif))
+
                    .map(|notif| Notification::new(&context.profile, &project, &repo, notif))
                    .filter_map(|item| item.ok())
                    .flatten()
                    .collect::<Vec<_>>()
modified bin/ui/items/notification.rs
@@ -6,6 +6,7 @@ use radicle::issue::Issues;
use radicle::node;

use radicle::patch::Patches;
+
use radicle::prelude::Project;
use radicle::storage::git::Repository;
use radicle::storage::{ReadRepository, RefUpdate};
use radicle::Profile;
@@ -181,14 +182,10 @@ pub struct Notification {
impl Notification {
    pub fn new(
        profile: &Profile,
+
        project: &Project,
        repo: &Repository,
        notification: &node::notifications::Notification,
    ) -> Result<Option<Self>, anyhow::Error> {
-
        let project = profile
-
            .storage
-
            .repository(repo.id)?
-
            .identity_doc()?
-
            .project()?;
        let name = project.name().to_string();
        let kind = NotificationKind::new(repo, notification)?;