Skip to content

Migrate WatchInfo struct to api #1492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions routers/api/v1/user/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,13 @@
package user

import (
"time"

api "code.gitea.io/sdk/gitea"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
"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) {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion vendor/code.gitea.io/sdk/gitea/issue_comment.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions vendor/code.gitea.io/sdk/gitea/repo_watch.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 95 additions & 0 deletions vendor/code.gitea.io/sdk/gitea/status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"revisionTime": "2017-04-07T07:44:04Z"
},
{
"checksumSHA1": "32qRX47gRmdBW4l4hCKGRZbuIJk=",
"checksumSHA1": "7/pZpgSIh/M76hwvldhgRqege/Q=",
"path": "code.gitea.io/sdk/gitea",
"revision": "9ceaabb8c70aba1ff73718332db2356356e26ffb",
"revisionTime": "2017-03-09T22:08:57Z"
"revision": "cad003b49151391f9a22f2e2edb2f348f51f9dde",
"revisionTime": "2017-04-15T14:32:48Z"
},
{
"checksumSHA1": "IyfS7Rbl6OgR83QR7TOfKdDCq+M=",
Expand Down