@@ -245,6 +245,36 @@ function isGitHubCommand(text: string): boolean {
245245 return / ^ \/ g h \b / i. test ( text . trim ( ) ) ;
246246}
247247
248+ type SettingsLauncherButton = {
249+ actionId : string ;
250+ label : string ;
251+ } ;
252+
253+ function buildSettingsLauncherBlocks (
254+ channelId : string ,
255+ description : string ,
256+ buttons : SettingsLauncherButton [ ]
257+ ) : any [ ] {
258+ return [
259+ {
260+ type : "section" ,
261+ text : {
262+ type : "mrkdwn" ,
263+ text : description ,
264+ } ,
265+ } ,
266+ {
267+ type : "actions" ,
268+ elements : buttons . map ( ( button ) => ( {
269+ type : "button" ,
270+ action_id : button . actionId ,
271+ text : { type : "plain_text" , text : button . label } ,
272+ value : channelId ,
273+ } ) ) ,
274+ } ,
275+ ] ;
276+ }
277+
248278async function postChannelSettingsLauncher (
249279 channelId : string ,
250280 userId : string ,
@@ -254,26 +284,11 @@ async function postChannelSettingsLauncher(
254284 channel : channelId ,
255285 user : userId ,
256286 text : "Open channel settings" ,
257- blocks : [
258- {
259- type : "section" ,
260- text : {
261- type : "mrkdwn" ,
262- text : "Open channel settings for agent, working directory, base branch, and optional channel system message (model appears for OpenCode and Codex)." ,
263- } ,
264- } ,
265- {
266- type : "actions" ,
267- elements : [
268- {
269- type : "button" ,
270- action_id : "open_settings_modal" ,
271- text : { type : "plain_text" , text : "Open settings" } ,
272- value : channelId ,
273- } ,
274- ] ,
275- } ,
276- ] ,
287+ blocks : buildSettingsLauncherBlocks (
288+ channelId ,
289+ "Open channel settings for agent, working directory, base branch, and optional channel system message (model appears for OpenCode and Codex)." ,
290+ [ { actionId : "open_settings_modal" , label : "Open settings" } ]
291+ ) ,
277292 } ) ;
278293}
279294
@@ -286,32 +301,14 @@ async function postGeneralSettingsLauncher(
286301 channel : channelId ,
287302 user : userId ,
288303 text : "Open settings" ,
289- blocks : [
290- {
291- type : "section" ,
292- text : {
293- type : "mrkdwn" ,
294- text : "Choose which settings page to open." ,
295- } ,
296- } ,
297- {
298- type : "actions" ,
299- elements : [
300- {
301- type : "button" ,
302- action_id : "open_general_settings_modal" ,
303- text : { type : "plain_text" , text : "general setting" } ,
304- value : channelId ,
305- } ,
306- {
307- type : "button" ,
308- action_id : "open_settings_modal" ,
309- text : { type : "plain_text" , text : "channel setting" } ,
310- value : channelId ,
311- } ,
312- ] ,
313- } ,
314- ] ,
304+ blocks : buildSettingsLauncherBlocks (
305+ channelId ,
306+ "Choose which settings page to open." ,
307+ [
308+ { actionId : "open_general_settings_modal" , label : "general setting" } ,
309+ { actionId : "open_settings_modal" , label : "channel setting" } ,
310+ ]
311+ ) ,
315312 } ) ;
316313}
317314
0 commit comments