Browse Source

Bug fix

for-closed-social
Unknown 10 years ago
parent
commit
e05b1385fb
4 changed files with 9 additions and 9 deletions
  1. +3
    -3
      models/issue.go
  2. +4
    -4
      models/repo.go
  3. +1
    -1
      models/user.go
  4. +1
    -1
      modules/mailer/mail.go

+ 3
- 3
models/issue.go View File

@ -174,15 +174,15 @@ func NewIssueUserPairs(rid, iid, oid, uid, aid int64) (err error) {
}
// In case owner is not watching.
ws = append(ws, &Watch{Uid: id})
ws = append(ws, &Watch{UserId: id})
}
for _, w := range ws {
if w.Uid == 0 {
if w.UserId == 0 {
continue
}
iu.Uid = w.Uid
iu.Uid = w.UserId
iu.IsPoster = iu.Uid == uid
iu.IsAssigned = iu.Uid == aid
if _, err = orm.Insert(iu); err != nil {

+ 4
- 4
models/repo.go View File

@ -725,14 +725,14 @@ func GetCollaborators(repoName string) ([]string, error) {
// Watch is connection request for receiving repository notifycation.
type Watch struct {
Id int64
Uid int64 `xorm:"UNIQUE(watch)"`
UserId int64 `xorm:"UNIQUE(watch)"`
RepoId int64 `xorm:"UNIQUE(watch)"`
}
// Watch or unwatch repository.
func WatchRepo(uid, rid int64, watch bool) (err error) {
if watch {
if _, err = orm.Insert(&Watch{RepoId: rid, Uid: uid}); err != nil {
if _, err = orm.Insert(&Watch{RepoId: rid, UserId: uid}); err != nil {
return err
}
@ -770,12 +770,12 @@ func NotifyWatchers(act *Action) error {
}
for i := range watches {
if act.ActUserId == watches[i].Uid {
if act.ActUserId == watches[i].UserId {
continue
}
act.Id = 0
act.UserId = watches[i].Uid
act.UserId = watches[i].UserId
if _, err = orm.InsertOne(act); err != nil {
return errors.New("repo.NotifyWatchers(create action): " + err.Error())
}

+ 1
- 1
models/user.go View File

@ -304,7 +304,7 @@ func DeleteUser(user *User) error {
}
// Delete all watches.
if _, err = orm.Delete(&Watch{Uid: user.Id}); err != nil {
if _, err = orm.Delete(&Watch{UserId: user.Id}); err != nil {
return err
}

+ 1
- 1
modules/mailer/mail.go View File

@ -121,7 +121,7 @@ func SendIssueNotifyMail(user, owner *models.User, repo *models.Repository, issu
tos := make([]string, 0, len(ws))
for i := range ws {
uid := ws[i].Uid
uid := ws[i].UserId
if user.Id == uid {
continue
}

Loading…
Cancel
Save