aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-23 19:24:18 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-23 19:24:18 +0800
commit2dd5259f8e499b0749ecb21faa5e6ad1acb39ff7 (patch)
treee607b7a37be6e18f49561e77720dcf9fcd29ea2c /models
parente9a3432d984d19b675ee4a1ff82b2a148f970645 (diff)
parentc386bb4bd314843a532012877e148ae70ee44672 (diff)
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'models')
-rw-r--r--models/action.go12
-rw-r--r--models/issue.go26
2 files changed, 19 insertions, 19 deletions
diff --git a/models/action.go b/models/action.go
index ca2ff3cb..11749293 100644
--- a/models/action.go
+++ b/models/action.go
@@ -8,6 +8,7 @@ import (
"encoding/json"
"time"
+ "github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/log"
)
@@ -47,18 +48,17 @@ func (a Action) GetRepoName() string {
return a.RepoName
}
-func (a Action) GetContent() string {
- return a.Content
+func (a Action) GetBranch() string {
+ return a.RefName
}
-type PushCommits struct {
- Len int
- Commits [][]string
+func (a Action) GetContent() string {
+ return a.Content
}
// CommitRepoAction records action for commit repository.
func CommitRepoAction(userId int64, userName string,
- repoId int64, repoName string, refName string, commits *PushCommits) error {
+ repoId int64, repoName string, refName string, commits *base.PushCommits) error {
bs, err := json.Marshal(commits)
if err != nil {
return err
diff --git a/models/issue.go b/models/issue.go
index f78c240c..929567b1 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -83,42 +83,42 @@ func GetIssues(userId, repoId, posterId, milestoneId int64, page int, isClosed,
sess := orm.Limit(20, (page-1)*20)
if repoId > 0 {
- sess = sess.Where("repo_id=?", repoId).And("is_closed=?", isClosed)
+ sess.Where("repo_id=?", repoId).And("is_closed=?", isClosed)
} else {
- sess = sess.Where("is_closed=?", isClosed)
+ sess.Where("is_closed=?", isClosed)
}
if userId > 0 {
- sess = sess.And("assignee_id=?", userId)
+ sess.And("assignee_id=?", userId)
} else if posterId > 0 {
- sess = sess.And("poster_id=?", posterId)
+ sess.And("poster_id=?", posterId)
} else if isMention {
- sess = sess.And("mentions like '%$" + base.ToStr(userId) + "|%'")
+ sess.And("mentions like '%$" + base.ToStr(userId) + "|%'")
}
if milestoneId > 0 {
- sess = sess.And("milestone_id=?", milestoneId)
+ sess.And("milestone_id=?", milestoneId)
}
if len(labels) > 0 {
for _, label := range strings.Split(labels, ",") {
- sess = sess.And("mentions like '%$" + label + "|%'")
+ sess.And("mentions like '%$" + label + "|%'")
}
}
switch sortType {
case "oldest":
- sess = sess.Asc("created")
+ sess.Asc("created")
case "recentupdate":
- sess = sess.Desc("updated")
+ sess.Desc("updated")
case "leastupdate":
- sess = sess.Asc("updated")
+ sess.Asc("updated")
case "mostcomment":
- sess = sess.Desc("num_comments")
+ sess.Desc("num_comments")
case "leastcomment":
- sess = sess.Asc("num_comments")
+ sess.Asc("num_comments")
default:
- sess = sess.Desc("created")
+ sess.Desc("created")
}
var issues []Issue