1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Add issue subscription check to API (#10967)

close #10962

Adds `GET /api/v1​/repos​/{owner}​/{repo}​/issues​/{index}​/subscriptions​/check`
 -> return a `WachInfo`
This commit is contained in:
6543
2020-04-21 15:48:53 +02:00
committed by GitHub
parent 33176e8d27
commit bb4261a5ed
8 changed files with 205 additions and 20 deletions

View File

@@ -9,7 +9,6 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/routers/api/v1/utils"
)
@@ -124,7 +123,7 @@ func IsWatching(ctx *context.APIContext) {
Reason: nil,
CreatedAt: ctx.Repo.Repository.CreatedUnix.AsTime(),
URL: subscriptionURL(ctx.Repo.Repository),
RepositoryURL: repositoryURL(ctx.Repo.Repository),
RepositoryURL: ctx.Repo.Repository.APIURL(),
})
} else {
ctx.NotFound()
@@ -162,7 +161,7 @@ func Watch(ctx *context.APIContext) {
Reason: nil,
CreatedAt: ctx.Repo.Repository.CreatedUnix.AsTime(),
URL: subscriptionURL(ctx.Repo.Repository),
RepositoryURL: repositoryURL(ctx.Repo.Repository),
RepositoryURL: ctx.Repo.Repository.APIURL(),
})
}
@@ -197,10 +196,5 @@ func Unwatch(ctx *context.APIContext) {
// subscriptionURL returns the URL of the subscription API endpoint of a repo
func subscriptionURL(repo *models.Repository) string {
return repositoryURL(repo) + "/subscription"
}
// repositoryURL returns the URL of the API endpoint of a repo
func repositoryURL(repo *models.Repository) string {
return setting.AppURL + "api/v1/" + repo.FullName()
return repo.APIURL() + "/subscription"
}