Title: Conditional Lazy Listener? · Issue #482 · slackapi/bolt-python · GitHub
Open Graph Title: Conditional Lazy Listener? · Issue #482 · slackapi/bolt-python
X Title: Conditional Lazy Listener? · Issue #482 · slackapi/bolt-python
Description: Is there a way to make it so that the lazy function triggers conditionally based on the ack response? For example, I want my ack to do parameter validation and potentially reject the request. Right now, my solution is to have the lazy fu...
Open Graph Description: Is there a way to make it so that the lazy function triggers conditionally based on the ack response? For example, I want my ack to do parameter validation and potentially reject the request. Right...
X Description: Is there a way to make it so that the lazy function triggers conditionally based on the ack response? For example, I want my ack to do parameter validation and potentially reject the request. Right...
Opengraph URL: https://github.com/slackapi/bolt-python/issues/482
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Conditional Lazy Listener?","articleBody":"Is there a way to make it so that the lazy function triggers conditionally based on the ack response?\r\n\r\nFor example, I want my ack to do parameter validation and potentially reject the request. Right now, my solution is to have the lazy function run the same parameter validation as the ack function, but it seems a bit wasteful. I'd much rather the lazy function not get triggered at all in the scenario where the ack function returns errors to the user.\r\n\r\n### Reproducible in:\r\n#### The `slack_bolt` version\r\n\r\n`slack-bolt==1.9.1`\r\n\r\n#### Python runtime version\r\n\r\n`Python 3.8.12`\r\n\r\n#### OS info\r\n\r\n```\r\nProductName: macOS\r\nProductVersion: 11.5.2\r\nBuildVersion: 20G95\r\nDarwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64\r\n```\r\n\r\n#### Steps to reproduce:\r\n\r\nRun something like this:\r\n\r\n```python\r\ndef validate_the_stuff(ack, view):\r\n #errors = validate_inputs(view)\r\n errors = { \"environment-select-block\": \"Nope\" }\r\n if len(errors) > 0:\r\n ack(response_action=\"errors\", errors=errors)\r\n return False\r\n else:\r\n ack(response_action=\"clear\")\r\n\r\ndef do_the_thing(view):\r\n logging.error(\"You should not get this far\")\r\n\r\napp.view_submission('environment_select_submit')(\r\n ack=validate_the_stuff,\r\n lazy=[do_the_thing]\r\n)\r\n```\r\n\r\n### Expected result:\r\n\r\nDon't do the thing if validation fails.\r\n\r\n### Actual result:\r\n\r\nDoes the thing even if validation fails.\r\n\r\n## Requirements\r\n\r\nPlease read the [Contributing guidelines](https://github.com/slackapi/bolt-python/blob/main/.github/contributing.md) and [Code of Conduct](https://slackhq.github.io/code-of-conduct) before creating this issue or pull request. By submitting, you are agreeing to those rules.\r\n","author":{"url":"https://github.com/sigJoe","@type":"Person","name":"sigJoe"},"datePublished":"2021-10-01T15:41:45Z","url":"https://github.com/slackapi/bolt-python/issues/482"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c084ecbf-7e13-de07-2f47-31a877fda70b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9FA6:C7386:152B118:1D2DC0C:6AFEB8B9 |
| html-safe-nonce | 0cc490752243e42f2ca50997a8a474657b5d8611193d965b876b661bb7e251ae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RkE2OkM3Mzg2OjE1MkIxMTg6MUQyREMwQzo2QUZFQjhCOSIsInZpc2l0b3JfaWQiOiI0NDc0MTM5NTc2NjAzOTQ5MjQyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ec331b67174116f06a573a72a07e83a7b63eafe5f0c9069accff9ed6329759cc |
| hovercard-subject-tag | issue:1013494164 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/slackapi/bolt-python/482/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1abb9334e6c428493c72ab40a4fa206c0c720cc29b8f2e96e62b53407bee6668/slackapi/bolt-python/issues/482 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1abb9334e6c428493c72ab40a4fa206c0c720cc29b8f2e96e62b53407bee6668/slackapi/bolt-python/issues/482 |
| og:image:alt | Is there a way to make it so that the lazy function triggers conditionally based on the ack response? For example, I want my ack to do parameter validation and potentially reject the request. Right... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sigJoe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 95b2753c978240785d6cca00783c00a371b2d7d9879bb32e305170a1b19bd28e |
| turbo-cache-control | no-preview |
| go-import | github.com/slackapi/bolt-python git https://github.com/slackapi/bolt-python.git |
| octolytics-dimension-user_id | 6962987 |
| octolytics-dimension-user_login | slackapi |
| octolytics-dimension-repository_id | 268795735 |
| octolytics-dimension-repository_nwo | slackapi/bolt-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 268795735 |
| octolytics-dimension-repository_network_root_nwo | slackapi/bolt-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3f25273206cd841171bca0002261ae4c9757d934 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width