Conditional Lazy Listener?
@seratch 已經在處理了。
開始於 2021年10月4日。
評估
這個 Issue 還沒有評估資料。
描述
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 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.
Reproducible in:
The slack_bolt version
slack-bolt==1.9.1
Python runtime version
Python 3.8.12
OS info
ProductName: macOS
ProductVersion: 11.5.2
BuildVersion: 20G95
Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64
Steps to reproduce:
Run something like this:
def validate_the_stuff(ack, view):
#errors = validate_inputs(view)
errors = { "environment-select-block": "Nope" }
if len(errors) > 0:
ack(response_action="errors", errors=errors)
return False
else:
ack(response_action="clear")
def do_the_thing(view):
logging.error("You should not get this far")
app.view_submission('environment_select_submit')(
ack=validate_the_stuff,
lazy=[do_the_thing]
)
Expected result:
Don't do the thing if validation fails.
Actual result:
Does the thing even if validation fails.
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
- 主要語言
- Python
- 星號
- 1.3k
- 分支
- 288
- 平均合併
- 1 天 8 小時
- 30 天內合併 PR
- 10
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
slackapi/bolt-python 的其他 Issue
-
docs enhancement server-side
難度 1/5 1 小時以內 新手友好度 88/100
slackapi/bolt-python#1576 · 1 則留言 ·
-
auto-triage-skip bug security semver:major
難度 2/5 1-3 小時 新手友好度 72/100
slackapi/bolt-python#1447 · 9 則留言 ·
-
難度 3/5 1-2 天 新手友好度 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
難度 3/5 1-2 天 新手友好度 65/100
slackapi/bolt-python#1472 · 1 則留言 · 1 個 reaction ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 則留言 · 已指派 1 人 ·
查看 slackapi/bolt-python 的全部 Issue
相似的 Issue
-
area: harness bug status: needs-triage
難度 2/5 1-3 小時 新手友好度 75/100
Human-Agent-Society/reef#625 ·
-
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 1/5 1 小時以內 新手友好度 80/100
learningequality/kolibri#15351 · 2 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
Name consistency 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
eellak/triplestore#65 · 1 則留言 ·