Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
httpd: Allow removing of reactions from issues
Sebastian Martinez committed 2 years ago
commit 6abbd39926f37545ed9981b6130018cf8325d1c2
parent 15b50ce6a544bdb7d22e124d486eeb933456f87e
3 files changed +17 -7
modified radicle-cli/src/commands/issue.rs
@@ -323,7 +323,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
                    let (comment_id, _) = term::io::comment_select(&issue).unwrap();
                    *comment_id
                });
-
                issue.react(comment_id, reaction, &signer)?;
+
                issue.react(comment_id, reaction, true, &signer)?;
            }
        }
        Operation::Open {
modified radicle-httpd/src/api/v1/projects.rs
@@ -553,8 +553,12 @@ async fn issue_update_handler(
                return Err(Error::BadRequest("`replyTo` missing".to_owned()));
            }
        }
-
        issue::Action::CommentReact { id, reaction, .. } => {
-
            issue.react(id, reaction, &signer)?;
+
        issue::Action::CommentReact {
+
            id,
+
            reaction,
+
            active,
+
        } => {
+
            issue.react(id, reaction, active, &signer)?;
        }
        issue::Action::CommentEdit { .. } => {
            todo!();
modified radicle/src/cob/issue.rs
@@ -291,11 +291,16 @@ impl store::Transaction<Issue> {
    }

    /// React to an issue comment.
-
    pub fn react(&mut self, id: CommentId, reaction: Reaction) -> Result<(), store::Error> {
+
    pub fn react(
+
        &mut self,
+
        id: CommentId,
+
        reaction: Reaction,
+
        active: bool,
+
    ) -> Result<(), store::Error> {
        self.push(Action::CommentReact {
            id,
            reaction,
-
            active: true,
+
            active,
        })
    }

@@ -406,9 +411,10 @@ where
        &mut self,
        to: CommentId,
        reaction: Reaction,
+
        active: bool,
        signer: &G,
    ) -> Result<EntryId, Error> {
-
        self.transaction("React", signer, |tx| tx.react(to, reaction))
+
        self.transaction("React", signer, |tx| tx.react(to, reaction, active))
    }

    pub fn transaction<G, F>(
@@ -875,7 +881,7 @@ mod test {
        let (comment, _) = issue.root();
        let comment = *comment;
        let reaction = Reaction::new('🥳').unwrap();
-
        issue.react(comment, reaction, &node.signer).unwrap();
+
        issue.react(comment, reaction, true, &node.signer).unwrap();

        let id = issue.id;
        let issue = issues.get(&id).unwrap().unwrap();