Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

metal0
Copy link
Contributor

@metal0 metal0 commented Feb 27, 2023

#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 PR

example:

plugins:
  mod_actions:
   config:
     reason_aliases:
       advertising: This is an alias for advertising

!ban @user advertising

@Ibotmealot added support for the update case command (request)

@cla-bot

This comment was marked as resolved.

@metal0

This comment was marked as resolved.

@cla-bot cla-bot bot removed the cla-signed label Dec 27, 2023
@almeidx almeidx force-pushed the mod_actions-reason-aliases branch from 96b1087 to 03c7ec9 Compare December 28, 2023 09:36
@ZeppelinBot ZeppelinBot deleted a comment from cla-bot bot Dec 28, 2023
@ZeppelinBot ZeppelinBot deleted a comment from cla-bot bot Dec 28, 2023
@ZeppelinBot ZeppelinBot deleted a comment from cla-bot bot Dec 28, 2023
@ZeppelinBot ZeppelinBot deleted a comment from cla-bot bot Dec 28, 2023
@ZeppelinBot ZeppelinBot deleted a comment from cla-bot bot Dec 28, 2023
@almeidx almeidx force-pushed the mod_actions-reason-aliases branch from 03c7ec9 to 80c195f Compare December 28, 2023 10:40
@cla-bot cla-bot bot added the cla-signed label Dec 28, 2023
@metal0 metal0 requested review from almeidx and Dragory and removed request for almeidx December 28, 2023 10:59
Copy link

@Pukimaa Pukimaa left a 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)),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants