From 15070c4074372bf898fdda49cb6e405361359c8e Mon Sep 17 00:00:00 2001 From: xphoniex Date: Wed, 24 May 2023 16:28:49 +0000 Subject: [PATCH] httpd: Add author to revision of a patch Signed-off-by: xphoniex --- radicle-httpd/src/api/json.rs | 1 + radicle-httpd/src/api/v1/projects.rs | 30 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/radicle-httpd/src/api/json.rs b/radicle-httpd/src/api/json.rs index 31368180..a150f30e 100644 --- a/radicle-httpd/src/api/json.rs +++ b/radicle-httpd/src/api/json.rs @@ -134,6 +134,7 @@ pub(crate) fn patch( "revisions": patch.revisions().map(|(id, rev)| { json!({ "id": id, + "author": author(rev.author(), aliases.alias(rev.author().id())), "description": rev.description(), "base": rev.base(), "oid": rev.head(), diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index 15257096..c18c68b2 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -1746,6 +1746,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [ @@ -1785,6 +1788,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [ @@ -1863,6 +1869,9 @@ mod routes { { "id": CREATED_PATCH_ID, "description": "Do some changes to README", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": INITIAL_COMMIT, "oid": HEAD, "refs": [ @@ -1926,6 +1935,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [ @@ -1986,6 +1998,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [ @@ -1997,6 +2012,9 @@ mod routes { }, { "id": "181e4219bc132e7716126a84200d4dbd628dd6be", + "author": { + "id": CONTRIBUTOR_DID, + }, "description": "This is a new revision", "base": PARENT, "oid": HEAD, @@ -2058,6 +2076,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [ @@ -2140,6 +2161,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [ @@ -2236,6 +2260,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [ @@ -2328,6 +2355,9 @@ mod routes { { "id": CONTRIBUTOR_PATCH_ID, "description": "change `hello world` in README to something else", + "author": { + "id": CONTRIBUTOR_DID, + }, "base": PARENT, "oid": HEAD, "refs": [