diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-13 02:09:36 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-13 02:09:36 -0400 |
commit | ea765d25e21a5e2ff67ff39891962f5f23facda8 (patch) | |
tree | 10635b6b10b06df8c01b7eba4c9215cd180caf4a /models/action.go | |
parent | 3005a0f13e8861c79e3ea84ce480124fbc3c181d (diff) | |
download | gitea-ea765d25e21a5e2ff67ff39891962f5f23facda8.tar.gz gitea-ea765d25e21a5e2ff67ff39891962f5f23facda8.zip |
Update action struct
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/models/action.go b/models/action.go index cae093ecbe..810f24b656 100644 --- a/models/action.go +++ b/models/action.go @@ -5,7 +5,6 @@ package models import ( - "encoding/json" "time" ) @@ -21,30 +20,24 @@ const ( // An Action represents type Action struct { - Id int64 - UserId int64 - OpType int - RepoId int64 - Content string - Created time.Time `xorm:"created"` -} - -type NewRepoContent struct { + Id int64 + UserId int64 UserName string + OpType int + RepoId int64 RepoName string + Content string + Created time.Time `xorm:"created"` } // NewRepoAction inserts action for create repository. func NewRepoAction(user *User, repo *Repository) error { - content, err := json.Marshal(&NewRepoContent{user.Name, repo.Name}) - if err != nil { - return err - } - _, err = orm.InsertOne(&Action{ - UserId: user.Id, - OpType: OP_CREATE_REPO, - RepoId: repo.Id, - Content: string(content), + _, err := orm.InsertOne(&Action{ + UserId: user.Id, + UserName: user.Name, + OpType: OP_CREATE_REPO, + RepoId: repo.Id, + RepoName: repo.Name, }) return err } |