diff --git a/src/core/api/robot.go b/src/core/api/robot.go index 1f6c2bdfd..ded3a8d58 100644 --- a/src/core/api/robot.go +++ b/src/core/api/robot.go @@ -108,6 +108,7 @@ func (r *RobotAPI) Post() { return } robotReq.Visible = true + robotReq.ProjectID = r.project.ProjectID if err := validateRobotReq(r.project, &robotReq); err != nil { r.SendBadRequestError(err) @@ -144,7 +145,7 @@ func (r *RobotAPI) List() { } keywords := make(map[string]interface{}) - keywords["ProjectID"] = r.robot.ProjectID + keywords["ProjectID"] = r.project.ProjectID keywords["Visible"] = true query := &q.Query{ Keywords: keywords, diff --git a/src/pkg/robot/dao/robot.go b/src/pkg/robot/dao/robot.go index fbfe1509d..eef25fdf5 100644 --- a/src/pkg/robot/dao/robot.go +++ b/src/pkg/robot/dao/robot.go @@ -99,23 +99,3 @@ func (r *robotAccountDao) DeleteRobotAccount(id int64) error { _, err := dao.GetOrmer().QueryTable(&model.Robot{}).Filter("ID", id).Delete() return err } - -func getRobotQuerySetter(query *model.RobotQuery) orm.QuerySeter { - qs := dao.GetOrmer().QueryTable(&model.Robot{}) - - if query == nil { - return qs - } - - if len(query.Name) > 0 { - if query.FuzzyMatchName { - qs = qs.Filter("Name__icontains", query.Name) - } else { - qs = qs.Filter("Name", query.Name) - } - } - if query.ProjectID != 0 { - qs = qs.Filter("ProjectID", query.ProjectID) - } - return qs -}