diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/access.go | 2 | ||||
-rw-r--r-- | models/action.go | 2 | ||||
-rw-r--r-- | models/models.go | 3 | ||||
-rw-r--r-- | models/update.go | 38 |
4 files changed, 6 insertions, 39 deletions
diff --git a/models/access.go b/models/access.go index 43a51775..0b114376 100644 --- a/models/access.go +++ b/models/access.go @@ -86,7 +86,7 @@ func AccessLevel(u *User, repo *Repository) (AccessMode, error) { func hasAccess(e Engine, u *User, repo *Repository, testMode AccessMode) (bool, error) { mode, err := accessLevel(e, u, repo) - return testMode <= mode, err + return mode >= testMode, err } // HasAccess returns true if someone has the request access level. User can be nil! diff --git a/models/action.go b/models/action.go index 37103523..ab8d9167 100644 --- a/models/action.go +++ b/models/action.go @@ -468,7 +468,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { } if err = UpdateIssuesCommit(pusher, repo, opts.Commits.Commits); err != nil { - log.Error(4, "UpdateIssuesCommit: %v", err) + log.Error(2, "UpdateIssuesCommit: %v", err) } } diff --git a/models/models.go b/models/models.go index 7b32f8bd..30110225 100644 --- a/models/models.go +++ b/models/models.go @@ -66,7 +66,7 @@ func init() { new(Issue), new(PullRequest), new(Comment), new(Attachment), new(IssueUser), new(Label), new(IssueLabel), new(Milestone), new(Mirror), new(Release), new(LoginSource), new(Webhook), - new(UpdateTask), new(HookTask), + new(HookTask), new(Team), new(OrgUser), new(TeamUser), new(TeamRepo), new(Notice), new(EmailAddress)) @@ -254,7 +254,6 @@ func GetStatistic() (stats Statistic) { stats.Counter.Label, _ = x.Count(new(Label)) stats.Counter.HookTask, _ = x.Count(new(HookTask)) stats.Counter.Team, _ = x.Count(new(Team)) - stats.Counter.UpdateTask, _ = x.Count(new(UpdateTask)) stats.Counter.Attachment, _ = x.Count(new(Attachment)) return } diff --git a/models/update.go b/models/update.go index 18d6c9dc..507150be 100644 --- a/models/update.go +++ b/models/update.go @@ -15,38 +15,6 @@ import ( git "github.com/gogits/git-module" ) -type UpdateTask struct { - ID int64 `xorm:"pk autoincr"` - UUID string `xorm:"index"` - RefName string - OldCommitID string - NewCommitID string -} - -func AddUpdateTask(task *UpdateTask) error { - _, err := x.Insert(task) - return err -} - -// GetUpdateTaskByUUID returns update task by given UUID. -func GetUpdateTaskByUUID(uuid string) (*UpdateTask, error) { - task := &UpdateTask{ - UUID: uuid, - } - has, err := x.Get(task) - if err != nil { - return nil, err - } else if !has { - return nil, ErrUpdateTaskNotExist{uuid} - } - return task, nil -} - -func DeleteUpdateTaskByUUID(uuid string) error { - _, err := x.Delete(&UpdateTask{UUID: uuid}) - return err -} - // CommitToPushCommit transforms a git.Commit to PushCommit type. func CommitToPushCommit(commit *git.Commit) *PushCommit { return &PushCommit{ @@ -74,13 +42,13 @@ func ListToPushCommits(l *list.List) *PushCommits { } type PushUpdateOptions struct { + OldCommitID string + NewCommitID string + RefFullName string PusherID int64 PusherName string RepoUserName string RepoName string - RefFullName string - OldCommitID string - NewCommitID string } // PushUpdate must be called for any push actions in order to |