summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-03-17 21:51:39 -0400
committerUnknwon <u@gogs.io>2015-03-17 21:51:39 -0400
commit466facc0097bf636b6a945a0daebb7c4c5c33c91 (patch)
tree614c2782ff5b59dd40cea9a9caadb93d46570258 /models/action.go
parent33894591a6d391674e938d018801d88d0011f0b7 (diff)
downloadgitea-466facc0097bf636b6a945a0daebb7c4c5c33c91.tar.gz
gitea-466facc0097bf636b6a945a0daebb7c4c5c33c91.zip
#1067: Deleting users should remove them from collaborator lists
- fix delete user but repository watches are not decreased
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go35
1 files changed, 22 insertions, 13 deletions
diff --git a/models/action.go b/models/action.go
index 46ce44e26b..037ccbd611 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,