]> source.dussan.org Git - gitea.git/commitdiff
bug fixed
authorLunny Xiao <xiaolunwen@gmail.com>
Sat, 29 Mar 2014 11:59:02 +0000 (19:59 +0800)
committerLunny Xiao <xiaolunwen@gmail.com>
Sat, 29 Mar 2014 11:59:02 +0000 (19:59 +0800)
models/action.go
update.go

index 894855784ff6701dc15beff0d03666a561dfdf92..1e55df85e9e862609a5ce9c326b8c1d4f5e6cb54 100644 (file)
@@ -64,7 +64,7 @@ func (a Action) GetContent() string {
 }
 
 // CommitRepoAction adds new action for committing repository.
-func CommitRepoAction(userId int64, userName string,
+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)
 
@@ -74,7 +74,7 @@ func CommitRepoAction(userId int64, userName string,
                return err
        }
 
-       if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: "",
+       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 {
                log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
                return err
index 9743dcc480cc262e24981badeb24c619ee11593a..246c5d8f9d069defad1ad4d157609e8981bf1525 100644 (file)
--- a/update.go
+++ b/update.go
@@ -132,8 +132,12 @@ func runUpdate(c *cli.Context) {
 
        commits := make([]*base.PushCommit, 0)
        var maxCommits = 3
+       var actEmail string
        for e := l.Front(); e != nil; e = e.Next() {
                commit := e.Value.(*git.Commit)
+               if actEmail == "" {
+                       actEmail = commit.Committer.Email
+               }
                commits = append(commits,
                        &base.PushCommit{commit.Id().String(),
                                commit.Message(),
@@ -145,7 +149,7 @@ func runUpdate(c *cli.Context) {
        }
 
        //commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()})
-       if err = models.CommitRepoAction(int64(sUserId), userName,
+       if err = models.CommitRepoAction(int64(sUserId), userName, actEmail,
                repos.Id, repoName, git.BranchName(refName), &base.PushCommits{l.Len(), commits}); err != nil {
                log.Error("runUpdate.models.CommitRepoAction: %v", err)
        }