File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
extensions/mattermost/src/mattermost Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,21 @@ function mergeMattermostAccountConfig(
6565 const { accounts : _ignored , ...base } = ( cfg . channels ?. mattermost ??
6666 { } ) as MattermostAccountConfig & { accounts ?: unknown } ;
6767 const account = resolveAccountConfig ( cfg , accountId ) ?? { } ;
68- return { ...base , ...account } ;
68+
69+ // Shallow merging is fine for most keys, but `commands` should be merged
70+ // so that account-specific overrides (callbackPath/callbackUrl) do not
71+ // accidentally reset global settings like `native: true`.
72+ const mergedCommands = {
73+ ...( base . commands ?? { } ) ,
74+ ...( account . commands ?? { } ) ,
75+ } ;
76+
77+ const merged = { ...base , ...account } ;
78+ if ( Object . keys ( mergedCommands ) . length > 0 ) {
79+ merged . commands = mergedCommands ;
80+ }
81+
82+ return merged ;
6983}
7084
7185function resolveMattermostRequireMention ( config : MattermostAccountConfig ) : boolean | undefined {
Original file line number Diff line number Diff line change @@ -146,11 +146,13 @@ async function authorizeSlashInvocation(params: {
146146
147147 const channelType = channelInfo ?. type ?? undefined ;
148148 const isDirectMessage = channelType ?. toUpperCase ( ) === "D" ;
149- const kind = isDirectMessage
149+ const kind : SlashInvocationAuth [ "kind" ] = isDirectMessage
150150 ? "direct"
151- : channelType ?. toUpperCase ( ) === "G"
152- ? "group"
153- : "channel" ;
151+ : channelInfo
152+ ? channelType ?. toUpperCase ( ) === "G"
153+ ? "group"
154+ : "channel"
155+ : "direct" ;
154156
155157 const chatType = kind === "direct" ? "direct" : kind === "group" ? "group" : "channel" ;
156158
You can’t perform that action at this time.
0 commit comments