]> source.dussan.org Git - gitea.git/commitdiff
improved activity
authorLunny Xiao <xiaolunwen@gmail.com>
Sun, 23 Mar 2014 10:00:09 +0000 (18:00 +0800)
committerLunny Xiao <xiaolunwen@gmail.com>
Sun, 23 Mar 2014 10:00:09 +0000 (18:00 +0800)
models/action.go
serve.go

index 4f78deb30e64f7d5e3a2d819846455e77a1fc6f4..ca2ff3cbf1774d3dfbee64e2720067f9f74c9e01 100644 (file)
@@ -51,9 +51,14 @@ func (a Action) GetContent() string {
        return a.Content
 }
 
+type PushCommits struct {
+       Len     int
+       Commits [][]string
+}
+
 // CommitRepoAction records action for commit repository.
 func CommitRepoAction(userId int64, userName string,
-       repoId int64, repoName string, refName string, commits [][]string) error {
+       repoId int64, repoName string, refName string, commits *PushCommits) error {
        bs, err := json.Marshal(commits)
        if err != nil {
                return err
index 812c37bb58048c73b658caa2e261fba7ea95415a..71abf5fdd6f2b696a51f043944c22cb42940383e 100644 (file)
--- a/serve.go
+++ b/serve.go
@@ -262,7 +262,7 @@ func runServ(k *cli.Context) {
        }
 
        commits := make([][]string, 0)
-       var maxCommits = 5
+       var maxCommits = 3
        for e := l.Back(); e != nil; e = e.Prev() {
                commit := e.Value.(*git.Commit)
                commits = append(commits, []string{commit.Id().String(), commit.Message()})
@@ -272,7 +272,7 @@ func runServ(k *cli.Context) {
        }
 
        if err = models.CommitRepoAction(user.Id, user.Name,
-               repo.Id, repoName, refname, commits); err != nil {
+               repo.Id, repoName, refname, &models.PushCommits{l.Len(), commits}); err != nil {
                log.Error("runUpdate.models.CommitRepoAction: %v", err, commits)
        } else {
                //log.Info("refname", refname)