summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-19 23:39:00 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-19 23:39:00 -0400
commit59ea3c0413723521e7504fa5b1be2c3780cbb2ea (patch)
tree2c8ee0aa410e590f7ecadeec7f46ddedd4191a24 /models/action.go
parenta922c3ff6a65d6d0550f36d866a301a6737ca8a2 (diff)
downloadgitea-59ea3c0413723521e7504fa5b1be2c3780cbb2ea.tar.gz
gitea-59ea3c0413723521e7504fa5b1be2c3780cbb2ea.zip
Finish watch backend
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go31
1 files changed, 21 insertions, 10 deletions
diff --git a/models/action.go b/models/action.go
index d388bca991..b3be093533 100644
--- a/models/action.go
+++ b/models/action.go
@@ -55,16 +55,27 @@ func CommitRepoAction(userId int64, userName string,
if err != nil {
return err
}
- _, err = orm.InsertOne(&Action{
- UserId: userId,
- ActUserId: userId,
- ActUserName: userName,
- OpType: OP_COMMIT_REPO,
- Content: string(bs),
- RepoId: repoId,
- RepoName: repoName,
- })
- return err
+
+ // Add feeds for user self and all watchers.
+ watches, err := GetWatches(repoId)
+ if err != nil {
+ return err
+ }
+ watches = append(watches, Watch{UserId: userId})
+
+ for i := range watches {
+ _, err = orm.InsertOne(&Action{
+ UserId: watches[i].UserId,
+ ActUserId: userId,
+ ActUserName: userName,
+ OpType: OP_COMMIT_REPO,
+ Content: string(bs),
+ RepoId: repoId,
+ RepoName: repoName,
+ })
+ return err
+ }
+ return nil
}
// NewRepoAction records action for create repository.