* /aao whoami - Show linked account info
(command: SlackSlashCommand)
| 250 | * /aao whoami - Show linked account info |
| 251 | */ |
| 252 | async function handleWhoamiCommand(command: SlackSlashCommand): Promise<CommandResponse> { |
| 253 | try { |
| 254 | const mapping = await slackDb.getBySlackUserId(command.user_id); |
| 255 | |
| 256 | if (!mapping) { |
| 257 | return { |
| 258 | response_type: 'ephemeral', |
| 259 | text: 'Your Slack account is not in our system yet', |
| 260 | blocks: [ |
| 261 | { |
| 262 | type: 'section', |
| 263 | text: { |
| 264 | type: 'mrkdwn', |
| 265 | text: ':question: *Account Not Found*\n\nYour Slack account is not yet synced with AAO. An admin may need to sync Slack users first.', |
| 266 | }, |
| 267 | }, |
| 268 | ], |
| 269 | }; |
| 270 | } |
| 271 | |
| 272 | if (!mapping.workos_user_id) { |
| 273 | return { |
| 274 | response_type: 'ephemeral', |
| 275 | text: 'Your Slack account is not linked to an AAO account', |
| 276 | blocks: [ |
| 277 | { |
| 278 | type: 'section', |
| 279 | text: { |
| 280 | type: 'mrkdwn', |
| 281 | text: ':link: *Account Not Linked*', |
| 282 | }, |
| 283 | }, |
| 284 | { |
| 285 | type: 'section', |
| 286 | fields: [ |
| 287 | { |
| 288 | type: 'mrkdwn', |
| 289 | text: `*Slack User:*\n${mapping.slack_real_name || mapping.slack_display_name || command.user_name}`, |
| 290 | }, |
| 291 | { |
| 292 | type: 'mrkdwn', |
| 293 | text: `*Slack Email:*\n${mapping.slack_email || 'Not available'}`, |
| 294 | }, |
| 295 | ], |
| 296 | }, |
| 297 | { |
| 298 | type: 'section', |
| 299 | text: { |
| 300 | type: 'mrkdwn', |
| 301 | text: 'Use `/aao link` to link your Slack account to your AAO account.', |
| 302 | }, |
| 303 | }, |
| 304 | ], |
| 305 | }; |
| 306 | } |
| 307 | |
| 308 | // Get all organizations for this user |
| 309 | const userOrgs = await getOrganizationsForUser(mapping.workos_user_id); |
no test coverage detected