aboutsummaryrefslogtreecommitdiffstats
path: root/models/actions/run_list.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/actions/run_list.go')
-rw-r--r--models/actions/run_list.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/actions/run_list.go b/models/actions/run_list.go
index f9d8417227..bc69c65840 100644
--- a/models/actions/run_list.go
+++ b/models/actions/run_list.go
@@ -68,6 +68,8 @@ type FindRunOptions struct {
OwnerID int64
IsClosed util.OptionalBool
WorkflowFileName string
+ TriggerUserID int64
+ Approved bool // not util.OptionalBool, it works only when it's true
}
func (opts FindRunOptions) toConds() builder.Cond {
@@ -89,6 +91,12 @@ func (opts FindRunOptions) toConds() builder.Cond {
if opts.WorkflowFileName != "" {
cond = cond.And(builder.Eq{"workflow_id": opts.WorkflowFileName})
}
+ if opts.TriggerUserID > 0 {
+ cond = cond.And(builder.Eq{"trigger_user_id": opts.TriggerUserID})
+ }
+ if opts.Approved {
+ cond = cond.And(builder.Gt{"approved_by": 0})
+ }
return cond
}