mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-21 00:05:00 +00:00
fix(mattermost): merge commands config + be lenient on DM channel lookup
This commit is contained in:
committed by
Muhammed Mukhthar CM
parent
5e62c4a3eb
commit
66cfba8221
@@ -83,7 +83,21 @@ function mergeMattermostAccountConfig(
|
||||
defaultAccount?: unknown;
|
||||
};
|
||||
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
||||
return { ...base, ...account };
|
||||
|
||||
// Shallow merging is fine for most keys, but `commands` should be merged
|
||||
// so that account-specific overrides (callbackPath/callbackUrl) do not
|
||||
// accidentally reset global settings like `native: true`.
|
||||
const mergedCommands = {
|
||||
...(base.commands ?? {}),
|
||||
...(account.commands ?? {}),
|
||||
};
|
||||
|
||||
const merged = { ...base, ...account };
|
||||
if (Object.keys(mergedCommands).length > 0) {
|
||||
merged.commands = mergedCommands;
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
|
||||
function resolveMattermostRequireMention(config: MattermostAccountConfig): boolean | undefined {
|
||||
|
||||
@@ -146,11 +146,13 @@ async function authorizeSlashInvocation(params: {
|
||||
|
||||
const channelType = channelInfo?.type ?? undefined;
|
||||
const isDirectMessage = channelType?.toUpperCase() === "D";
|
||||
const kind = isDirectMessage
|
||||
const kind: SlashInvocationAuth["kind"] = isDirectMessage
|
||||
? "direct"
|
||||
: channelType?.toUpperCase() === "G"
|
||||
? "group"
|
||||
: "channel";
|
||||
: channelInfo
|
||||
? channelType?.toUpperCase() === "G"
|
||||
? "group"
|
||||
: "channel"
|
||||
: "direct";
|
||||
|
||||
const chatType = kind === "direct" ? "direct" : kind === "group" ? "group" : "channel";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user