Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: fix rad inbox clear output
Fintan Halpenny committed 2 years ago
commit 35567583869c2c24a2e040a0f1e755d4e3d17880
parent 8bf871903a79c3492ccdece14b8957eeecbe4650
2 files changed +6 -2
modified radicle-cli/examples/rad-inbox.md
@@ -85,7 +85,7 @@ $ rad inbox show 1
```

``` ~alice
-
$ rad inbox clear
+
$ rad inbox clear 1 2
✓ Cleared 2 item(s) from your inbox
$ rad inbox
Your inbox is empty.
modified radicle/src/node/notifications/store.rs
@@ -196,12 +196,16 @@ impl Store<Write> {
                .db
                .prepare("DELETE FROM `repository-notifications` WHERE rowid = ?")?;

+
            // N.b. we need to keep the count manually since the change count
+
            // will always be `1` because of each reset.
+
            let mut count = 0;
            for id in ids {
                stmt.bind((1, *id as i64))?;
                stmt.next()?;
                stmt.reset()?;
+
                count += self.db.change_count();
            }
-
            Ok(self.db.change_count())
+
            Ok(count)
        })
    }