From 1fb457ac1f46ef07557f5c8c5b84438f2325a5cf Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 16 Mar 2014 23:02:59 +0800 Subject: commit format improved --- models/action.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'models') diff --git a/models/action.go b/models/action.go index 9e075646..ceee9997 100644 --- a/models/action.go +++ b/models/action.go @@ -5,6 +5,7 @@ package models import ( + "encoding/json" "time" ) @@ -45,13 +46,17 @@ func (a Action) GetRepoName() string { // 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, }) -- cgit v1.2.3