diff options
author | Unknown <joe2010xtmf@163.com> | 2014-04-13 21:00:12 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-04-13 21:00:12 -0400 |
commit | d2b53dd43b3bc9719985033bc92b76abb9515b4d (patch) | |
tree | f6c038f0b8c11e8a01d7cd26d6bbdb14144696b3 /models | |
parent | 4b9b8024ba59b5b84d92dca650761b35ebf6408a (diff) | |
download | gitea-d2b53dd43b3bc9719985033bc92b76abb9515b4d.tar.gz gitea-d2b53dd43b3bc9719985033bc92b76abb9515b4d.zip |
Add weibo oauth
Diffstat (limited to 'models')
-rw-r--r-- | models/action.go | 14 | ||||
-rw-r--r-- | models/oauth2.go | 6 | ||||
-rw-r--r-- | models/repo.go | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/models/action.go b/models/action.go index a642a82c98..3edb884e27 100644 --- a/models/action.go +++ b/models/action.go @@ -8,6 +8,8 @@ import ( "encoding/json" "time" + // "github.com/gogits/git" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" ) @@ -22,6 +24,7 @@ const ( OP_CREATE_ISSUE OP_PULL_REQUEST OP_TRANSFER_REPO + OP_PUSH_TAG ) // Action represents user operation type and other information to repository., @@ -67,7 +70,14 @@ func (a Action) GetContent() string { // CommitRepoAction adds new action for committing repository. func CommitRepoAction(userId int64, userName, actEmail string, repoId int64, repoName string, refName string, commit *base.PushCommits) error { - log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName) + // log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName) + + opType := OP_COMMIT_REPO + // Check it's tag push or branch. + // if git.IsTagExist(RepoPath(userName, repoName), refName) { + // opType = OP_PUSH_TAG + // commit = &base.PushCommits{} + // } bs, err := json.Marshal(commit) if err != nil { @@ -76,7 +86,7 @@ func CommitRepoAction(userId int64, userName, actEmail string, } if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail, - OpType: OP_COMMIT_REPO, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil { + OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil { log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName) return err } diff --git a/models/oauth2.go b/models/oauth2.go index 38d21fda1c..d1ae4611b8 100644 --- a/models/oauth2.go +++ b/models/oauth2.go @@ -68,3 +68,9 @@ func GetOauth2ById(id int64) (oa *Oauth2, err error) { } return oa, nil } + +// GetOauthByUserId returns list of oauthes that are releated to given user. +func GetOauthByUserId(uid int64) (oas []*Oauth2, err error) { + err = orm.Find(&oas, Oauth2{Uid: uid}) + return oas, err +} diff --git a/models/repo.go b/models/repo.go index 1a5a95f047..bb0c164e24 100644 --- a/models/repo.go +++ b/models/repo.go @@ -75,9 +75,9 @@ type Repository struct { NumStars int NumForks int NumIssues int - NumReleases int `xorm:"NOT NULL"` NumClosedIssues int NumOpenIssues int `xorm:"-"` + NumTags int `xorm:"-"` IsPrivate bool IsMirror bool IsBare bool |