mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 03:00:21 +00:00
fix: keep message-tool buttons optional for Telegram and Mattermost (#52589) (thanks @tylerliu612)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../runtime-api.js";
|
||||
import { createChannelReplyPipeline } from "../runtime-api.js";
|
||||
@@ -181,6 +182,26 @@ describe("mattermostPlugin", () => {
|
||||
expect(actions).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps buttons optional in message tool schema", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
mattermost: {
|
||||
enabled: true,
|
||||
botToken: "test-token",
|
||||
baseUrl: "https://chat.example.com",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const discovery = mattermostPlugin.actions?.describeMessageTool?.({ cfg });
|
||||
const schema = discovery?.schema;
|
||||
if (!schema || Array.isArray(schema)) {
|
||||
throw new Error("expected mattermost message-tool schema");
|
||||
}
|
||||
|
||||
expect(Type.Object(schema.properties).required).toBeUndefined();
|
||||
});
|
||||
|
||||
it("hides react when actions.reactions is false", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
||||
import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
||||
import { createMessageToolButtonsSchema } from "openclaw/plugin-sdk/channel-actions";
|
||||
@@ -97,7 +98,7 @@ function describeMattermostMessageTool({
|
||||
enabledAccounts.length > 0
|
||||
? {
|
||||
properties: {
|
||||
buttons: createMessageToolButtonsSchema(),
|
||||
buttons: Type.Optional(createMessageToolButtonsSchema()),
|
||||
},
|
||||
}
|
||||
: null,
|
||||
|
||||
Reference in New Issue
Block a user