From 5681670e298ed831e42ad5b6ed1423c675df3561 Mon Sep 17 00:00:00 2001 From: Yanay Date: Wed, 24 Jun 2026 15:02:18 +0300 Subject: [PATCH] feat(comments): add createdAt sortBy + sortDir, deprecate new/old MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the server change. Adds "createdAt" as the canonical comment time sort plus a "sortDir" param, and marks the directional aliases "new" (createdAt DESC) and "old" (createdAt ASC) deprecated — the server still accepts them (identical behavior, removed in v8) but responds with deprecation headers. Co-Authored-By: Claude Opus 4.8 --- src/modules/comments/fetchManyComments.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/modules/comments/fetchManyComments.ts b/src/modules/comments/fetchManyComments.ts index e9709dd..0e6b117 100644 --- a/src/modules/comments/fetchManyComments.ts +++ b/src/modules/comments/fetchManyComments.ts @@ -9,7 +9,20 @@ export interface FetchManyCommentsProps extends SpaceReputationContextParams { parentId?: string; page?: number; limit?: number; - sortBy?: "new" | "old" | "top" | "controversial"; + sortBy?: + | "createdAt" + | "top" + | "controversial" + /** @deprecated Use "createdAt" instead. "new" is a directional alias for + * createdAt DESC, removed in v8; the server still accepts it (identical + * behavior) but responds with deprecation headers. */ + | "new" + /** @deprecated Use "createdAt" with sortDir:"asc" instead. "old" is a + * directional alias for createdAt ASC, removed in v8; the server still + * accepts it (identical behavior) but responds with deprecation headers. */ + | "old"; + /** Sort direction for `sortBy: "createdAt"`. Defaults to "desc". */ + sortDir?: "asc" | "desc"; include?: string; sourceId?: string; }