summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-01 09:00:30 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-01 09:00:30 -0400
commit480a4ae8c558a9946addda06b2a7d4ece8c145af (patch)
treeb06fe0a068e309f59bead93c2c0e5121c3c22741 /models/action.go
parenta2333d95d594a6aa4e77e78c2efe32991d3cf1ef (diff)
downloadgitea-480a4ae8c558a9946addda06b2a7d4ece8c145af.tar.gz
gitea-480a4ae8c558a9946addda06b2a7d4ece8c145af.zip
Fix #150
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go27
1 files changed, 10 insertions, 17 deletions
diff --git a/models/action.go b/models/action.go
index 77576a995a..2fc8173443 100644
--- a/models/action.go
+++ b/models/action.go
@@ -40,6 +40,7 @@ type Action struct {
RepoId int64
RepoName string
RefName string
+ IsPrivate bool `xorm:"not null"`
Content string `xorm:"TEXT"`
Created time.Time `xorm:"created"`
}
@@ -100,12 +101,11 @@ func CommitRepoAction(userId int64, userName, actEmail string,
return err
}
- if !repo.IsPrivate {
- if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
- OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil {
- log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
- return err
- }
+ if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
+ OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName,
+ IsPrivate: repo.IsPrivate}); err != nil {
+ log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
+ return err
}
log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName)
@@ -114,12 +114,8 @@ func CommitRepoAction(userId int64, userName, actEmail string,
// NewRepoAction adds new action for creating repository.
func NewRepoAction(user *User, repo *Repository) (err error) {
- if repo.IsPrivate {
- return nil
- }
-
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
- OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoName: repo.Name}); err != nil {
+ OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoName: repo.Name, IsPrivate: repo.IsPrivate}); err != nil {
log.Error("action.NewRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
return err
}
@@ -130,12 +126,9 @@ func NewRepoAction(user *User, repo *Repository) (err error) {
// TransferRepoAction adds new action for transfering repository.
func TransferRepoAction(user, newUser *User, repo *Repository) (err error) {
- if repo.IsPrivate {
- return nil
- }
-
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 {
+ OpType: OP_TRANSFER_REPO, RepoId: repo.Id, RepoName: repo.Name, Content: newUser.Name,
+ IsPrivate: repo.IsPrivate}); err != nil {
log.Error("action.TransferRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
return err
}
@@ -149,7 +142,7 @@ func GetFeeds(userid, offset int64, isProfile bool) ([]Action, error) {
actions := make([]Action, 0, 20)
sess := orm.Limit(20, int(offset)).Desc("id").Where("user_id=?", userid)
if isProfile {
- sess.And("act_user_id=?", userid)
+ sess.Where("is_private=?", false).And("act_user_id=?", userid)
} else {
sess.And("act_user_id!=?", userid)
}