fix: reconcile the pull request stream

Share one shortSHA helper, keep Markdown raw in view tests through the
markdown preference, and drop rawWindow now that pull request lists use
the paged helpers.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 23:56:25 +02:00
1 parent 2c14ec2adf
commit 81b0c1b99e
5 files changed
+11 -25

No files matched your search

-16
View File
@@ -10,8 +10,6 @@ import (
"errors"
"io"
"net/http"
"net/url"
"strconv"
"gitea.dev/tea/internal/transport"
)
@@ -39,20 +37,6 @@ func sendJSON(ctx context.Context, client *transport.Client, method, endpoint st
return err
}
// rawWindow is listWindow over a raw JSON collection endpoint; it sets limit and page on query.
func rawWindow[T any](ctx context.Context, client *transport.Client, endpoint string, query url.Values, limit, page int) ([]T, bool, error) {
if query == nil {
query = url.Values{}
}
return listWindow(limit, page, func(limit, page int) ([]T, http.Header, error) {
query.Set("limit", strconv.Itoa(limit))
query.Set("page", strconv.Itoa(page))
var response []T
headers, err := rawJSON(ctx, client, http.MethodGet, endpoint+"?"+query.Encode(), nil, &response)
return response, headers, err
})
}
func rawJSON(ctx context.Context, client *transport.Client, method, endpoint string, body io.Reader, out any) (http.Header, error) {
resp, err := client.Do(ctx, method, endpoint, body, nil)
if err != nil {