diff --git a/services/companion-bot/case-actions.mjs b/services/companion-bot/case-actions.mjs index 4d46df901d..5353dc2a36 100644 --- a/services/companion-bot/case-actions.mjs +++ b/services/companion-bot/case-actions.mjs @@ -8,23 +8,28 @@ const titles = { awaiting:'Awaiting deploy', investigate:'Further investigation', overview:'Report overview', question:'Ask the reporter', testing:'Request User Testing', commaTesting:'Request Comma Testing', appTesting:'Test latest app beta', rename:'Rename Thread', duplicate:'Link Duplicate', appLogs:'Request Phone App Logs', connection:'Request Comma Connection Logs', controller:'Request Controller Logs', starport:'Request StarPort Logs', removeTags:'Remove topic tags' }; -const descriptions={ - appTesting:'Ask the reporter to install the latest available phone beta and retry.', - investigate:'Send this report back for investigation.', - commaTesting:'Ask the reporter to update the comma and test the fix. Include a phone build if needed.', - awaiting:'Record a fix that is waiting for deployment without pinging the reporter.', - overview:'See status, priority, assignment and the latest available diagnostic link privately.', - question:'Mention the reporter and give them a feedback button.', - tags:'Add topics such as Galaxy, Navigation or CarPlay.', removeTags:'Remove selected topics while keeping the platform and status.', - working:'Show that you are actively working on the report.', assign:'Pick and notify the person handling the report.', - unassign:'Remove the current assignee.', priority:'Set urgency from 0 (highest) to 5, or clear it.', - status:'Open, mark in progress, or close and archive the thread.', testing:'Mention the reporter with the build and steps to test.', - rename:'Update the title people see in the forum.', duplicate:'Link to the original report by thread link or ID.', - appLogs:'Ask the reporter for fresh diagnostics from the phone app in this ticket.', - connection:'Phone app pairing, Bluetooth bridge, Wi-Fi and discovery on the comma.', - starport:'Request the original StarPort session ZIP for Android Auto troubleshooting.', - controller:'USB and Bluetooth input inventory for a physical controller.' -}; +const staffActions = [ + ["tags", "๐Ÿท๏ธ", "Add topic tags to this report."], + ["working", "๐Ÿ› ๏ธ", "Show that youโ€™re working on this report."], + ["assign", "๐Ÿ‘ค", "Choose and notify a staff member."], + ["priority", "๐Ÿšฆ", "Set priority from 0 (highest) to 5, or clear it."], + ["status", "๐Ÿ“‹", "Open, mark in progress, or close and archive this report."], + ["question", "๐Ÿ’ฌ", "Ask the reporter for more information."], + ["testing", "๐Ÿงช", "Send the reporter your test steps and build details."], + ["appTesting", "๐Ÿ“ฑ", "Ask the reporter to try the latest phone app beta."], + ["commaTesting", "๐Ÿš—", "Ask the reporter to update their comma and test again."], + ["appLogs", "๐Ÿ“ฒ", "Request fresh logs from the reporterโ€™s phone app."], + ["connection", "๐Ÿ“ถ", "Request comma logs for pairing, Wi-Fi, or device discovery."], + ["controller", "๐ŸŽฎ", "Request Bluetooth or USB logs for a physical controller."], + ["starport", "๐Ÿ–ฅ๏ธ", "Request StarPort session logs for Android Auto projection."], + ["awaiting", "๐Ÿ“ฆ", "Record a fix thatโ€™s waiting for release."], + ["investigate", "๐Ÿ”Ž", "Mark the report for further investigation."], + ["overview", "๐Ÿ—‚๏ธ", "Privately view status, priority, assignment, and diagnostics."], + ["rename", "โœ๏ธ", "Change the title displayed in the forum."], + ["duplicate", "๐Ÿ”—", "Link this duplicate to the original report."], + ["unassign", "๐Ÿ‘ฅ", "Clear the current staff assignment."], + ["removeTags", "โž–", "Remove selected topic tags."], +]; const statusNames=['Open','In Progress','Closed']; const row = component => ({type:1,components:[component]}); const ephemeral = (content,controls) => Response.json({type:4,data:privateCard(content,controls)}); @@ -41,8 +46,10 @@ export function caseButtons(user, platform) { } function staffMenu(base,channel){ - const options=Object.entries(titles).filter(([key])=>key!=='note').map(([value,label])=>({label,value,description:descriptions[value]})); - return privateCard('**Staff Actions**',[row({type:3,custom_id:base+'pick:'+channel,placeholder:'Choose a staff action',options})]); + const options=staffActions.map(([value,icon,description])=>({ + label:titles[value], value, description, emoji:{name:icon} + })); + return privateCard('**Staff Actions**',[row({type:3,custom_id:base+'pick:'+channel,placeholder:'Choose an actionโ€ฆ',options})]); } export function privateStaffCommand(i,env,ctx){ diff --git a/services/companion-bot/case-actions.test.mjs b/services/companion-bot/case-actions.test.mjs index 9f8c85864e..313e19d223 100644 --- a/services/companion-bot/case-actions.test.mjs +++ b/services/companion-bot/case-actions.test.mjs @@ -13,7 +13,11 @@ test('reporter can add details and staff get a private action menu',async()=>{ assert.equal((await (await caseInteraction(interaction('menu','2'),env)).json()).data.components[0].components.length,1); const menu=await (await caseInteraction(interaction('menu','3'),env)).json(); assert.equal(menu.data.flags,32832); - assert.deepEqual(menu.data.components[0].components[1].components[0].options.slice(0,3).map(o=>o.value),['tags','working','assign']); + const picker=menu.data.components[0].components[1].components[0]; + assert.equal(picker.type,3); + assert.deepEqual(picker.options.slice(0,3).map(o=>o.value),['tags','working','assign']); + assert.equal(new Set(picker.options.map(o=>o.value)).size,20); + for(const option of picker.options) assert.ok(option.label && option.emoji.name && option.description.length <= 100 && option.description.length > 0); assert.match((await (await caseInteraction(interaction('priority:5','2'),env)).json()).data.components[0].components[0].content,/original/); }); test('priority is stored on the verified ticket and a repeated interaction posts once',async()=>{