From cba008fecea96b507444d644f57b4047c546b954 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Tue, 15 Sep 2026 22:44:25 +0900 Subject: [PATCH] lexicons: rich `feed.listComments` Signed-off-by: Seongmin Lee --- bobbin/crates/xrpc/src/feed.rs | 8 ++++++++ lexicons/embed/commit.json | 12 ++++++++++++ lexicons/feed/defs.json | 32 ++++++++++++++++++++++++++++++++ lexicons/feed/listComments.json | 3 ++- 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 lexicons/feed/defs.json diff --git a/bobbin/crates/xrpc/src/feed.rs b/bobbin/crates/xrpc/src/feed.rs index 1885febe4..29ed942ad 100644 --- a/bobbin/crates/xrpc/src/feed.rs +++ b/bobbin/crates/xrpc/src/feed.rs @@ -1,6 +1,7 @@ use axum::extract::State; use axum::response::Response; use futures::stream::{self, StreamExt}; +use lexicons::sh_tangled::feed::list_comments::ListComments; use serde::Deserialize; use bobbin_edge_index::{EdgeItem, EdgePage, EdgeStore, PageCursor, PageLimit, PageToken, SortDir}; @@ -29,6 +30,13 @@ const FOLLOW_BY_NSID: &str = "sh.tangled.graph.follow.by"; const HYDRATE_CONCURRENCY: usize = 8; +pub(crate) async fn list_comments( + State(state): State, + XrpcQuery(q): XrpcQuery, +) -> Result { + todo!() +} + #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] pub(crate) struct GetTimelineQuery { diff --git a/lexicons/embed/commit.json b/lexicons/embed/commit.json index ace51b8a9..98dcf2ca2 100644 --- a/lexicons/embed/commit.json +++ b/lexicons/embed/commit.json @@ -12,6 +12,18 @@ "repo": { "type": "string", "format": "did" }, "commit": { "type": "union", "refs": ["sh.tangled.git.oid"] } } + }, + "view": { + "type": "object", + "required": [ + "repo", + "commit" + ], + "properties": { + "repo": { "type": "string", "format": "did" }, + "commit": { "type": "string", "maxLength": 64 }, + "change": { "type": "string", "maxLength": 32 } + } } } } diff --git a/lexicons/feed/defs.json b/lexicons/feed/defs.json new file mode 100644 index 000000000..47b3b4b23 --- /dev/null +++ b/lexicons/feed/defs.json @@ -0,0 +1,32 @@ +{ + "lexicon": 1, + "id": "sh.tangled.feed.defs", + "needsCbor": true, + "needsType": true, + "defs": { + "commentView": { + "type": "object", + "required": [ + "uri", + "cid", + "subject", + "body", + "createdAt" + ], + "properties": { + "uri": { "type": "string", "format": "at-uri" }, + "cid": { "type": "string", "format": "cid" }, + "subject": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, + "body": { "type": "union", "refs": ["sh.tangled.markup.markdown"] }, + "createdAt": { "type": "string", "format": "datetime" }, + "replyTo": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, + "embed": { + "type": "union", + "refs": [ + "sh.tangled.embed.commit#view" + ] + } + } + } + } +} diff --git a/lexicons/feed/listComments.json b/lexicons/feed/listComments.json index ce09641cc..8457bf03b 100644 --- a/lexicons/feed/listComments.json +++ b/lexicons/feed/listComments.json @@ -44,7 +44,7 @@ "properties": { "items": { "type": "array", - "items": { "type": "ref", "ref": "#listItem" } + "items": { "type": "ref", "ref": "sh.tangled.feed.defs#commentView" } }, "cursor": { "type": "string" }, "total": { @@ -57,6 +57,7 @@ }, "listItem": { "type": "object", + "description": "DEPRECATED: only sh.tangled.feed.listCommentsBy still answers with this shape. Use #commentView.", "required": ["uri", "value"], "properties": { "uri": { "type": "string", "format": "at-uri" }, -- 2.54.0