diff options
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/models/action.go b/models/action.go index 46ce44e2..037ccbd6 100644 --- a/models/action.go +++ b/models/action.go @@ -61,14 +61,14 @@ func init() { // Action represents user operation type and other information to repository., // it implemented interface base.Actioner so that can be used in template render. type Action struct { - Id int64 - UserId int64 // Receiver user id. + ID int64 `xorm:"pk autoincr"` + UserID int64 // Receiver user id. OpType ActionType - ActUserId int64 // Action user id. + ActUserID int64 // Action user id. ActUserName string // Action user name. ActEmail string ActAvatar string `xorm:"-"` - RepoId int64 + RepoID int64 RepoUserName string RepoName string RefName string @@ -319,10 +319,18 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, log.Debug("action.CommitRepoAction(updateIssuesCommit): ", err) } - if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail, - OpType: opType, Content: string(bs), RepoId: repoId, RepoUserName: repoUserName, - RepoName: repoName, RefName: refName, - IsPrivate: repo.IsPrivate}); err != nil { + if err = NotifyWatchers(&Action{ + ActUserID: userId, + ActUserName: userName, + ActEmail: actEmail, + OpType: opType, + Content: string(bs), + RepoID: repoId, + RepoUserName: repoUserName, + RepoName: repoName, + RefName: refName, + IsPrivate: repo.IsPrivate, + }); err != nil { return errors.New("action.CommitRepoAction(NotifyWatchers): " + err.Error()) } @@ -443,14 +451,15 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, func newRepoAction(e Engine, u *User, repo *Repository) (err error) { if err = notifyWatchers(e, &Action{ - ActUserId: u.Id, + ActUserID: u.Id, ActUserName: u.Name, ActEmail: u.Email, OpType: CREATE_REPO, - RepoId: repo.Id, + RepoID: repo.Id, RepoUserName: repo.Owner.Name, RepoName: repo.Name, - IsPrivate: repo.IsPrivate}); err != nil { + IsPrivate: repo.IsPrivate, + }); err != nil { return fmt.Errorf("notify watchers '%d/%s'", u.Id, repo.Id) } @@ -465,11 +474,11 @@ func NewRepoAction(u *User, repo *Repository) (err error) { func transferRepoAction(e Engine, actUser, oldOwner, newOwner *User, repo *Repository) (err error) { action := &Action{ - ActUserId: actUser.Id, + ActUserID: actUser.Id, ActUserName: actUser.Name, ActEmail: actUser.Email, OpType: TRANSFER_REPO, - RepoId: repo.Id, + RepoID: repo.Id, RepoUserName: newOwner.Name, RepoName: repo.Name, IsPrivate: repo.IsPrivate, |