Skip to content

Commit d7a06e8

Browse files
authored
Add support for multiflag triggers (#69)
* add support for multiflag triggers * merge flag and multiFlag triggers
1 parent a9077b1 commit d7a06e8

1 file changed

Lines changed: 71 additions & 9 deletions

File tree

ctf/templates/init/schemas/post.json

Lines changed: 71 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,81 @@
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+
"score",
30+
"timer"
2931
]
30-
},
31-
"tag": {
32-
"description": "Value of the trigger. For a flag trigger, this is the flag value.",
33-
"type": "string",
34-
"minLength": 1
3532
}
3633
},
3734
"required": [
38-
"type",
39-
"tag"
40-
]
35+
"type"
36+
],
37+
"if": {
38+
"properties": {
39+
"type": {
40+
"const": "flag"
41+
}
42+
}
43+
},
44+
"then": {
45+
"properties": {
46+
"tag": {
47+
"description": "Discourse tags of the flags to trigger on.",
48+
"type": ["string", "array"],
49+
"items": {
50+
"type": "string",
51+
"minLength": 1
52+
},
53+
"minLength": 1
54+
},
55+
"threshold": {
56+
"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.",
57+
"type": "number"
58+
}
59+
},
60+
"required": [
61+
"type",
62+
"tag"
63+
]
64+
},
65+
"else": {
66+
"if": {
67+
"properties": {
68+
"type": {
69+
"const": "score"
70+
}
71+
}
72+
},
73+
"then": {
74+
"value": {
75+
"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.",
76+
"type": "number"
77+
},
78+
"required": [
79+
"type",
80+
"value"
81+
]
82+
},
83+
"else": {
84+
"if": {
85+
"properties": {
86+
"type": {
87+
"const": "timer"
88+
}
89+
}
90+
},
91+
"then": {
92+
"after": {
93+
"description": "Time at which to trigger. The layout of this string is \"2006/01/02 15:04\"",
94+
"type": "string"
95+
},
96+
"required": [
97+
"type",
98+
"after"
99+
]
100+
}
101+
}
102+
}
41103
},
42104
"api": {
43105
"type": "object",

0 commit comments

Comments
 (0)