Add commenter targeting mode
This commit is contained in:
1 parent
0dfdda61fd
commit
e9a4c965ee
23 files changed
+374
-10
No files matched your search
@@ -53,10 +53,19 @@ export const SubredditConfigSchema = z.strictObject({
|
||||
name: z.string(),
|
||||
enabled: z.boolean().default(true),
|
||||
type: z.union([z.literal('image'), z.literal('chat')]),
|
||||
targetingMode: z.union([z.literal('post-author'), z.literal('comment-author')]).default('post-author'),
|
||||
weight: z.number().optional(),
|
||||
tone: ToneKeySchema,
|
||||
scripted: z.string().optional(),
|
||||
conversation: ConversationBehaviourSchema,
|
||||
}).superRefine((subreddit, context) => {
|
||||
if (subreddit.type === 'chat' && subreddit.targetingMode === 'comment-author') {
|
||||
context.addIssue({
|
||||
code: 'custom',
|
||||
path: ['targetingMode'],
|
||||
message: 'Comment-author targeting is available only for image posts.',
|
||||
});
|
||||
}
|
||||
});
|
||||
export const ConfigResponseSchema = RuntimeConfigSchema.extend({
|
||||
subreddits: z.array(SubredditConfigSchema),
|
||||
|
||||
@@ -166,6 +166,7 @@ describe('dashboard endpoint contracts', () => {
|
||||
...payload,
|
||||
subreddits: [{
|
||||
...payload.subreddits[0],
|
||||
targetingMode: 'post-author',
|
||||
conversation: { mode: 'legacy', maxAutomatedTurns: 3, rapportTurnsBeforeMediaAsk: 3 },
|
||||
}],
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user