package models
import (
+ "encoding/json"
"time"
)
// CommitRepoAction records action for commit repository.
func CommitRepoAction(userId int64, userName string,
- repoId int64, repoName string, msg string) error {
- _, err := orm.InsertOne(&Action{
+ repoId int64, repoName string, commits [][]string) error {
+ bs, err := json.Marshal(commits)
+ if err != nil {
+ return err
+ }
+ _, err = orm.InsertOne(&Action{
UserId: userId,
ActUserId: userId,
ActUserName: userName,
OpType: OP_COMMIT_REPO,
- Content: msg,
+ Content: string(bs),
RepoId: repoId,
RepoName: repoName,
})
if err != nil {
return
}
+
sUserId, err := strconv.Atoi(userId)
if err != nil {
log.Error("runUpdate.Parse userId: %v", err)
log.Error("runUpdate.Parse repoId: %v", err)
return
}
+ commits := make([][]string, 0)
+ commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()})
if err = models.CommitRepoAction(int64(sUserId), userName,
- int64(sRepoId), repoName, lastCommit.Message()); err != nil {
+ int64(sRepoId), repoName, commits); err != nil {
log.Error("runUpdate.models.CommitRepoAction: %v", err)
}
}