Skip to content

Commit c55cda6

Browse files
committed
add support for multiflag triggers
1 parent eccb076 commit c55cda6

1 file changed

Lines changed: 93 additions & 4 deletions

File tree

ctf/templates/init/schemas/post.json

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
"description": "Type of trigger: use `flag` to post after a given flag is submitted (the value of the flag should be set in the `tag` property.)",
2626
"type": "string",
2727
"enum": [
28-
"flag"
28+
"flag",
29+
"multiFlag",
30+
"score",
31+
"timer"
2932
]
3033
},
3134
"tag": {
@@ -35,9 +38,95 @@
3538
}
3639
},
3740
"required": [
38-
"type",
39-
"tag"
40-
]
41+
"type"
42+
],
43+
"if": {
44+
"properties": {
45+
"type": {
46+
"const": "flag"
47+
}
48+
}
49+
},
50+
"then": {
51+
"properties": {
52+
"tag": {
53+
"description": "Discourse tag of the flag to trigger on.",
54+
"type": "string",
55+
"minLength": 1
56+
}
57+
},
58+
"required": [
59+
"type",
60+
"tag"
61+
]
62+
},
63+
"else": {
64+
"if": {
65+
"properties": {
66+
"type": {
67+
"const": "multiFlag"
68+
}
69+
}
70+
},
71+
"then": {
72+
"properties": {
73+
"tags": {
74+
"description": "List of discourse tags of relevant flags.",
75+
"type": "array",
76+
"items": {
77+
"type": "string",
78+
"minLength": 1
79+
}
80+
},
81+
"threshold": {
82+
"description": "Number of relevant flags required for the multiFlag trigger. Ex: If this is set to 2, the trigger will only fire if 2 or more of the tags in the `tags` list are present.",
83+
"type": "number"
84+
}
85+
},
86+
"required": [
87+
"type",
88+
"tags"
89+
]
90+
},
91+
"else": {
92+
"if": {
93+
"properties": {
94+
"type": {
95+
"const": "score"
96+
}
97+
}
98+
},
99+
"then": {
100+
"value": {
101+
"description": "Value of the score trigger. Ex: If this is set to 10, the trigger will only fire if the user's score is 10 or more.",
102+
"type": "number"
103+
},
104+
"required": [
105+
"type",
106+
"value"
107+
]
108+
},
109+
"else": {
110+
"if": {
111+
"properties": {
112+
"type": {
113+
"const": "timer"
114+
}
115+
}
116+
},
117+
"then": {
118+
"after": {
119+
"description": "Time at which to trigger. The layout of this string is \"2006/01/02 15:04\"",
120+
"type": "string"
121+
},
122+
"required": [
123+
"type",
124+
"after"
125+
]
126+
}
127+
}
128+
}
129+
}
41130
},
42131
"api": {
43132
"type": "object",

0 commit comments

Comments
 (0)