diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-04-05 15:30:49 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-04-05 15:30:49 +0800 |
commit | a92826a8feee904440d86fd851ac4ecce35520fd (patch) | |
tree | e813b36b2b6db0807e02abd61a4f220a971cc84e /models/action.go | |
parent | 493b0c5ac212a28f46938cf8dfb2efb79f658548 (diff) | |
parent | e41ab839c7dbbdffc60a4e02775f24add9d126d9 (diff) |
Merge branch 'dev' of github.com:gogits/gogs into dev
Conflicts:
routers/repo/repo.go
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/action.go b/models/action.go index 1e55df85..a642a82c 100644 --- a/models/action.go +++ b/models/action.go @@ -21,6 +21,7 @@ const ( OP_COMMIT_REPO OP_CREATE_ISSUE OP_PULL_REQUEST + OP_TRANSFER_REPO ) // Action represents user operation type and other information to repository., @@ -108,6 +109,18 @@ func NewRepoAction(user *User, repo *Repository) (err error) { return err } +// TransferRepoAction adds new action for transfering repository. +func TransferRepoAction(user, newUser *User, repo *Repository) (err error) { + if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email, + OpType: OP_TRANSFER_REPO, RepoId: repo.Id, RepoName: repo.Name, Content: newUser.Name}); err != nil { + log.Error("action.TransferRepoAction(notify watchers): %d/%s", user.Id, repo.Name) + return err + } + + log.Trace("action.TransferRepoAction: %s/%s", user.LowerName, repo.LowerName) + return err +} + // GetFeeds returns action list of given user in given context. func GetFeeds(userid, offset int64, isProfile bool) ([]Action, error) { actions := make([]Action, 0, 20) |