aboutsummaryrefslogtreecommitdiff
path: root/models/action.go
diff options
context:
space:
mode:
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 d388bca9..b3be0935 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.