RepoId int64
RepoName string
RefName string
+ IsPrivate bool `xorm:"not null"`
Content string `xorm:"TEXT"`
Created time.Time `xorm:"created"`
}
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)
// 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
}
// 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
}
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)
}
return nil, err
}
- if !repo.IsPrivate {
- if err = NewRepoAction(user, repo); err != nil {
- log.Error("repo.CreateRepository(NewRepoAction): %v", err)
- }
- }
-
if err = WatchRepo(user.Id, repo.Id, true); err != nil {
log.Error("repo.CreateRepository(WatchRepo): %v", err)
}
+ if err = NewRepoAction(user, repo); err != nil {
+ log.Error("repo.CreateRepository(NewRepoAction): %v", err)
+ }
+
// No need for init for mirror.
if mirror {
return repo, nil