Browse Source

#2225

fix bug
tags/v1.22.9.2^2
chenyifan01 3 years ago
parent
commit
4d2f89ca80
4 changed files with 18 additions and 4 deletions
  1. +1
    -1
      models/attachment.go
  2. +5
    -0
      models/repo_watch.go
  3. +1
    -1
      models/reward_periodic_task.go
  4. +11
    -2
      services/task/task.go

+ 1
- 1
models/attachment.go View File

@@ -667,7 +667,7 @@ func Attachments(opts *AttachmentsOptions) ([]*AttachmentInfo, int64, error) {

func GetAllDatasetContributorByDatasetId(datasetId int64) ([]*User, error) {
r := make([]*User, 0)
if err := x.Select("distinct(user.*)").Table("attachment").Join("LEFT", "user", "user.ID = attachment.uploader_id").Where("attachment.dataset_id = ?", datasetId).Find(&r); err != nil {
if err := x.Select("distinct(public.user.*)").Table("attachment").Join("LEFT", "user", "public.user.ID = attachment.uploader_id").Where("attachment.dataset_id = ?", datasetId).Find(&r); err != nil {
return nil, err
}
return r, nil


+ 5
- 0
models/repo_watch.go View File

@@ -204,6 +204,11 @@ func notifyWatchers(e Engine, actions ...*Action) error {
// Send the act to task chan
ActionChan4Task <- *act

// If it has nothing to do with repo, return directly
if act.Repo == nil && act.RepoID == 0 {
return nil
}

if repoChanged {
act.loadRepo()
repo = act.Repo


+ 1
- 1
models/reward_periodic_task.go View File

@@ -90,7 +90,7 @@ func GetPeriodicTaskBySourceIdAndType(sourceType SourceType, sourceId string, op
r := RewardPeriodicTask{}
_, err := x.SQL("select rpt.* from reward_periodic_task rpt "+
"inner join reward_operate_record ror on rpt.operate_serial_no = ror.serial_no"+
" where ror.source_type = ? and source_id = ? and operate_type = ? ", sourceType.Name(), sourceId, operateType.Name()).Get(&r)
" where ror.source_type = ? and ror.source_id = ? and ror.operate_type = ? ", sourceType.Name(), sourceId, operateType.Name()).Get(&r)
if err != nil {
return nil, err
}


+ 11
- 2
services/task/task.go View File

@@ -9,13 +9,22 @@ import (
)

func Accomplish(action models.Action) {
defer func() {
if err := recover(); err != nil {
combinedErr := fmt.Errorf("%s\n%s", err, log.Stack(2))
log.Error("PANIC:%v", combinedErr)
}
}()
action.OpType = models.GetTaskOptType(action)
switch action.OpType {
case models.ActionCreateRepo,
models.ActionCreateImage:
case models.ActionCreateRepo:
if action.Repo.IsPrivate {
return
}
case models.ActionCreateImage:
if action.IsPrivate {
return
}
case models.ActionBindWechat:
n, err := models.CountWechatBindLog(action.Content, models.WECHAT_BIND)
if err != nil {


Loading…
Cancel
Save