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時間
- マージ済み PR(30日)
- 10
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 件 ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · コメント 2 件 · 担当者 1 名 ·
slackapi/bolt-python の issue をすべて見る
似ている issue
-
fix: inaccuracy ⚠️
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
uabrc/uabrc.github.io#1255 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
ethereum-optimism/factory#64 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
duckdb/duckdb-python#627 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
Qiskit/qiskit-addon-sqd#376 ·