diff options
author | 6543 <6543@obermui.de> | 2020-04-21 15:48:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-21 14:48:53 +0100 |
commit | bb4261a5ed678235fadef279fe1ba1505993a406 (patch) | |
tree | e3134123a4ccd273ddf5cd93701fef6db21d593b /routers/api/v1/user | |
parent | 33176e8d27eeb47c6d63fbd24bf11ac9e5c60acd (diff) | |
download | gitea-bb4261a5ed678235fadef279fe1ba1505993a406.tar.gz gitea-bb4261a5ed678235fadef279fe1ba1505993a406.zip |
Add issue subscription check to API (#10967)
close #10962
Adds `GET /api/v1/repos/{owner}/{repo}/issues/{index}/subscriptions/check`
-> return a `WachInfo`
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r-- | routers/api/v1/user/watch.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go index 1fc736deba..1b55863034 100644 --- a/routers/api/v1/user/watch.go +++ b/routers/api/v1/user/watch.go @@ -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" } |