Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
httpd: Add `assignees` to `Issues::create`
Sebastian Martinez committed 3 years ago
commit 43f32c8360c4461f6990980509eedc74b5513ed4
parent 2395d5c32822cdfc1308f16248a4de9622034d6b
2 files changed +15 -6
modified radicle-httpd/src/api/test.rs
@@ -23,7 +23,7 @@ use crate::api::{auth, Context};
pub const HEAD: &str = "1e978d19f251cd9821d9d9a76d1bd436bf0690d5";
pub const HEAD_1: &str = "f604ce9fd5b7cc77b7609beda45ea8760bee78f7";
pub const PATCH_ID: &str = "4250f0117659ee4de9af99e699a63395cd6ffa1c";
-
pub const ISSUE_ID: &str = "d8131af9738258fac139c4c96b71c02411f94892";
+
pub const ISSUE_ID: &str = "8adca8aad2a2cb99b9847d20193930cde2042a57";

const PASSWORD: &str = "radicle";

@@ -113,6 +113,7 @@ pub fn seed(dir: &Path) -> Context {
            "Issue #1".to_string(),
            "Change 'hello world' to 'hello everyone'".to_string(),
            &[],
+
            &[],
            &signer,
        )
        .unwrap();
modified radicle-httpd/src/api/v1/projects.rs
@@ -14,7 +14,7 @@ use tower_http::set_header::SetResponseHeaderLayer;

use radicle::cob::issue::{Action, Issues};
use radicle::cob::patch::Patches;
-
use radicle::cob::{thread, Tag};
+
use radicle::cob::{thread, ActorId, Tag};
use radicle::identity::Id;
use radicle::node::NodeId;
use radicle::storage::{git::paths, ReadRepository, WriteStorage};
@@ -404,6 +404,7 @@ pub struct IssueCreate {
    pub title: String,
    pub description: String,
    pub tags: Vec<Tag>,
+
    pub assignees: Vec<ActorId>,
}

/// Create a new issue.
@@ -424,7 +425,13 @@ async fn issue_create_handler(
    let repo = storage.repository(project)?;
    let mut issues = Issues::open(ctx.profile.public_key, &repo)?;
    let issue = issues
-
        .create(issue.title, issue.description, &issue.tags, &signer)
+
        .create(
+
            issue.title,
+
            issue.description,
+
            &issue.tags,
+
            &issue.assignees,
+
            &signer,
+
        )
        .map_err(Error::from)?;

    Ok::<_, Error>((
@@ -551,7 +558,7 @@ mod routes {

    use crate::api::test::{self, get, patch, post, HEAD, HEAD_1, ISSUE_ID, PATCH_ID};

-
    const CREATED_ISSUE_ID: &str = "768c6735912a34856552ae6a9ca77d728962bf31";
+
    const CREATED_ISSUE_ID: &str = "b56febfba1e7dd20f4aea43ca2fe9dcf1fd448ba";

    #[tokio::test]
    async fn test_projects_root() {
@@ -1041,6 +1048,7 @@ mod routes {
            "title": "Issue #2",
            "description": "Change 'hello world' to 'hello everyone'",
            "tags": ["bug"],
+
            "assignees": [],
        }))
        .unwrap();
        let response = post(
@@ -1147,7 +1155,7 @@ mod routes {
                  "replyTo": null,
                },
                {
-
                  "id": "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/4",
+
                  "id": "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/5",
                  "author": {
                      "id": "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi",
                  },
@@ -1217,7 +1225,7 @@ mod routes {
                  "replyTo": null,
                },
                {
-
                  "id": "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/4",
+
                  "id": "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/5",
                  "author": {
                      "id": "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi",
                  },