-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mod actions reason aliases (continued) #390
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
96b1087
to
03c7ec9
Compare
Co-authored-by: metal0 <[email protected]>
03c7ec9
to
80c195f
Compare
Signed-off-by: GitHub <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works really well on my instance of Zeppelin. However due to the recent switch to Zod a few things break, so I requested some changes. However I'm not sure if there might be a better way to get the mod action config in parseReason.ts
.
Also you might wanna rebase this PR before implementing the changes, since I had issues with merging it to my instance initially with all the recent changes.
@@ -44,6 +44,7 @@ export const ConfigSchema = t.type({ | |||
can_deletecase: t.boolean, | |||
can_act_as_other: t.boolean, | |||
create_cases_for_manual_actions: t.boolean, | |||
reason_aliases: tNullable(t.record(t.string, t.string)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reason_aliases: tNullable(t.record(t.string, t.string)), | |
reason_aliases: z.nullable(z.record(z.string(), z.string())), |
@@ -0,0 +1,14 @@ | |||
import { TConfigSchema } from "../types"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { TConfigSchema } from "../types"; | |
import z from "zod"; | |
import { zModActionsConfig } from "../types"; |
|
||
const MAX_REASON_LENGTH = 512; | ||
|
||
export function parseReason(config: TConfigSchema, reason: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function parseReason(config: TConfigSchema, reason: string): string { | |
export function parseReason(config: z.infer<typeof zModActionsConfig>, reason: string): string { |
I don't know whether there is a nicer way of getting the config schema without having to import zod, but this works.
#296 was broken due to me deleting the head branch (
and repo) and it wasn't registering new commits so I thought I'd recreate the PRexample:
@Ibotmealot added support for the update case command (request)