Migrate WatchInfo struct to api (#1492)

* Remove WatchInfo and link to api struct

* Add vendor temporary update

* Return to gitea vendor source
This commit is contained in:
Antoine GIRARD 2017-04-16 14:51:04 +02:00 committed by Bo-Yi Wu
parent 237270ef50
commit cf91cfb993
5 changed files with 142 additions and 18 deletions

View file

@ -5,8 +5,6 @@
package user
import (
"time"
api "code.gitea.io/sdk/gitea"
"code.gitea.io/gitea/models"
@ -14,16 +12,6 @@ import (
"code.gitea.io/gitea/modules/setting"
)
// WatchInfo contains information about a watched repository
type WatchInfo struct {
Subscribed bool `json:"subscribed"`
Ignored bool `json:"ignored"`
Reason interface{} `json:"reason"`
CreatedAt time.Time `json:"created_at"`
URL string `json:"url"`
RepositoryURL string `json:"repository_url"`
}
// getWatchedRepos returns the repos that the user with the specified userID is
// watching
func getWatchedRepos(userID int64, private bool) ([]*api.Repository, error) {
@ -67,7 +55,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) {
// specified in ctx
func IsWatching(ctx *context.APIContext) {
if models.IsWatching(ctx.User.ID, ctx.Repo.Repository.ID) {
ctx.JSON(200, WatchInfo{
ctx.JSON(200, api.WatchInfo{
Subscribed: true,
Ignored: false,
Reason: nil,
@ -87,7 +75,7 @@ func Watch(ctx *context.APIContext) {
ctx.Error(500, "WatchRepo", err)
return
}
ctx.JSON(200, WatchInfo{
ctx.JSON(200, api.WatchInfo{
Subscribed: true,
Ignored: false,
Reason: nil,