mirror of
1
Fork 0

improved activity

This commit is contained in:
Lunny Xiao 2014-03-23 18:00:09 +08:00
parent d6619cfe15
commit 24630e0c9b
2 changed files with 8 additions and 3 deletions

View 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

View File

@ -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)