|
|
@ -243,15 +243,29 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, |
|
|
|
if !strings.HasPrefix(oldCommitId, "0000000") { |
|
|
|
if !strings.HasPrefix(oldCommitId, "0000000") { |
|
|
|
compareUrl = fmt.Sprintf("%s/compare/%s...%s", repoLink, oldCommitId, newCommitId) |
|
|
|
compareUrl = fmt.Sprintf("%s/compare/%s...%s", repoLink, oldCommitId, newCommitId) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pusher_email, pusher_name := "", "" |
|
|
|
|
|
|
|
pusher, err := GetUserByName(userName) |
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
|
|
pusher_email = pusher.Email |
|
|
|
|
|
|
|
pusher_name = pusher.GetFullNameFallback() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
commits := make([]*PayloadCommit, len(commit.Commits)) |
|
|
|
commits := make([]*PayloadCommit, len(commit.Commits)) |
|
|
|
for i, cmt := range commit.Commits { |
|
|
|
for i, cmt := range commit.Commits { |
|
|
|
|
|
|
|
author_username := "" |
|
|
|
|
|
|
|
author, err := GetUserByEmail(cmt.AuthorEmail) |
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
|
|
author_username = author.Name |
|
|
|
|
|
|
|
} |
|
|
|
commits[i] = &PayloadCommit{ |
|
|
|
commits[i] = &PayloadCommit{ |
|
|
|
Id: cmt.Sha1, |
|
|
|
Id: cmt.Sha1, |
|
|
|
Message: cmt.Message, |
|
|
|
Message: cmt.Message, |
|
|
|
Url: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1), |
|
|
|
Url: fmt.Sprintf("%s/commit/%s", repoLink, cmt.Sha1), |
|
|
|
Author: &PayloadAuthor{ |
|
|
|
Author: &PayloadAuthor{ |
|
|
|
Name: cmt.AuthorName, |
|
|
|
Name: cmt.AuthorName, |
|
|
|
Email: cmt.AuthorEmail, |
|
|
|
Email: cmt.AuthorEmail, |
|
|
|
|
|
|
|
UserName: author_username, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -266,14 +280,16 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, |
|
|
|
Website: repo.Website, |
|
|
|
Website: repo.Website, |
|
|
|
Watchers: repo.NumWatches, |
|
|
|
Watchers: repo.NumWatches, |
|
|
|
Owner: &PayloadAuthor{ |
|
|
|
Owner: &PayloadAuthor{ |
|
|
|
Name: repoUserName, |
|
|
|
Name: repo.Owner.GetFullNameFallback(), |
|
|
|
Email: actEmail, |
|
|
|
Email: repo.Owner.Email, |
|
|
|
|
|
|
|
UserName: repo.Owner.Name, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Private: repo.IsPrivate, |
|
|
|
Private: repo.IsPrivate, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Pusher: &PayloadAuthor{ |
|
|
|
Pusher: &PayloadAuthor{ |
|
|
|
Name: repo.Owner.LowerName, |
|
|
|
Name: pusher_name, |
|
|
|
Email: repo.Owner.Email, |
|
|
|
Email: pusher_email, |
|
|
|
|
|
|
|
UserName: userName, |
|
|
|
}, |
|
|
|
}, |
|
|
|
Before: oldCommitId, |
|
|
|
Before: oldCommitId, |
|
|
|
After: newCommitId, |
|
|
|
After: newCommitId, |
|
|
|