fix(team,repo,org,wiki,auth): detect a kept admin permission, validate topics up front, page public members, name disabled wikis, treat auth switch's account as --user

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-18 20:40:25 +02:00
1 parent 339527b26c
commit dd2ec74d96
12 files changed
+289 -64

No files matched your search

+7 -7
View File
@@ -273,17 +273,17 @@ func (s Repositories) Edit(ctx context.Context, repo string, opts RepositoryEdit
return item, Classify(err, "repository", repo, "")
}
// AddTopic adds a topic to the repository.
func (s Repositories) AddTopic(ctx context.Context, repo, topic string) error {
return repoDo(ctx, s.Client, repo, func(ctx context.Context, c *gitea.Client, owner, name string) (*gitea.Response, error) {
return c.Repositories.AddRepoTopic(ctx, owner, name, topic)
// Topics lists the topics of the repository. Gitea allows at most 25, so one page holds them all.
func (s Repositories) Topics(ctx context.Context, repo string) ([]string, error) {
return repoCall(ctx, s.Client, repo, func(ctx context.Context, c *gitea.Client, owner, name string) ([]string, *gitea.Response, error) {
return c.Repositories.ListRepoTopics(ctx, owner, name, gitea.ListRepoTopicsOptions{ListOptions: gitea.ListOptions{Page: 1, PageSize: 50}})
})
}
// RemoveTopic removes a topic from the repository.
func (s Repositories) RemoveTopic(ctx context.Context, repo, topic string) error {
// SetTopics replaces the topics of the repository.
func (s Repositories) SetTopics(ctx context.Context, repo string, topics []string) error {
return repoDo(ctx, s.Client, repo, func(ctx context.Context, c *gitea.Client, owner, name string) (*gitea.Response, error) {
return c.Repositories.DeleteRepoTopic(ctx, owner, name, topic)
return c.Repositories.SetRepoTopics(ctx, owner, name, topics)
})
}