fix(mattermost): add groups property to config schema (#57618) (#58271)

Merged via squash.

Prepared head SHA: 8d478fc092
Co-authored-by: MoerAI <26067127+MoerAI@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
This commit is contained in:
ToToKr
2026-04-04 22:37:53 +09:00
committed by GitHub
parent 8ca5a9174a
commit 3b80f42152
4 changed files with 52 additions and 0 deletions

View File

@@ -107,6 +107,7 @@ Docs: https://docs.openclaw.ai
- Gateway/auth: serialize async shared-secret auth attempts per client so concurrent Tailscale-capable failures cannot overrun the intended auth rate-limit budget. Thanks @Telecaster2147.
- Doctor/config: compare normalized `talk` configs by deep structural equality instead of key-order-sensitive serialization so `openclaw doctor --fix` stops repeatedly reporting/applying no-op `talk.provider/providers` normalization. (#59911) Thanks @ejames-dev.
- Gateway/device auth: reuse cached device-token scopes only for cached-token reconnects, while keeping explicit `deviceToken` scope requests and empty-cache fallbacks intact so reconnects preserve `operator.read` without breaking explicit auth flows. (#46032) Thanks @caicongyang.
- Mattermost/config schema: accept `groups.*.requireMention` again so existing Mattermost configs no longer fail strict validation after upgrade. (#58271) Thanks @MoerAI.
## 2026.4.2

View File

@@ -8,6 +8,13 @@ import {
import { z } from "openclaw/plugin-sdk/zod";
import { buildSecretInputSchema } from "./secret-input.js";
const MattermostGroupSchema = z
.object({
/** Whether mentions are required to trigger the bot in this group. */
requireMention: z.boolean().optional(),
})
.strict();
function requireMattermostOpenAllowFrom(params: {
policy?: string;
allowFrom?: Array<string | number>;
@@ -98,6 +105,8 @@ const MattermostAccountSchemaBase = z
allowedSourceIps: z.array(z.string()).optional(),
})
.optional(),
/** Per-group configuration (keyed by Mattermost channel ID or "*" for default). */
groups: z.record(z.string(), MattermostGroupSchema.optional()).optional(),
/** Allow fetching from private/internal IP addresses (e.g. localhost). Required for self-hosted Mattermost on LAN/VPN. */
allowPrivateNetwork: z.boolean().optional(),
/** Retry configuration for DM channel creation */

View File

@@ -29,6 +29,39 @@ describe("MattermostConfigSchema", () => {
expect(result.success).toBe(true);
});
it("accepts groups with requireMention", () => {
const result = MattermostConfigSchema.safeParse({
groups: {
"*": { requireMention: true },
"channel-123": { requireMention: false },
},
});
expect(result.success).toBe(true);
});
it("accepts groups on account", () => {
const result = MattermostConfigSchema.safeParse({
accounts: {
main: {
baseUrl: "https://chat.example.com",
groups: {
"*": { requireMention: true },
},
},
},
});
expect(result.success).toBe(true);
});
it("rejects unknown properties inside groups entry", () => {
const result = MattermostConfigSchema.safeParse({
groups: {
"*": { requireMention: true, unknownProp: "bad" },
},
});
expect(result.success).toBe(false);
});
it("rejects unsupported direct-message reply threading config", () => {
const result = MattermostConfigSchema.safeParse({
dm: {

View File

@@ -8,6 +8,13 @@ import {
} from "./config-runtime.js";
import { buildSecretInputSchema } from "./secret-input.js";
const MattermostGroupSchema = z
.object({
/** Whether mentions are required to trigger the bot in this group. */
requireMention: z.boolean().optional(),
})
.strict();
function requireMattermostOpenAllowFrom(params: {
policy?: string;
allowFrom?: Array<string | number>;
@@ -98,6 +105,8 @@ const MattermostAccountSchemaBase = z
allowedSourceIps: z.array(z.string()).optional(),
})
.optional(),
/** Per-group configuration (keyed by Mattermost channel ID or "*" for default). */
groups: z.record(z.string(), MattermostGroupSchema.optional()).optional(),
/** Allow fetching from private/internal IP addresses (e.g. localhost). Required for self-hosted Mattermost on LAN/VPN. */
allowPrivateNetwork: z.boolean().optional(),
/** Retry configuration for DM channel creation */