Conditional Lazy Listener?
@seratch já está trabalhando nisso.
Desde 4/10/2021.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 1.3k
- Forks
- 288
- Merge médio
- 1d 8h
- PRs com merge (30d)
- 10
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de slackapi/bolt-python
-
docs enhancement server-side
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
slackapi/bolt-python#1576 · 1 comentário ·
-
auto-triage-skip bug security semver:major
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
slackapi/bolt-python#1447 · 9 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 65/100
slackapi/bolt-python#1472 · 1 comentário · 1 reação ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 comentários · 1 responsável ·
Todas as issues de slackapi/bolt-python
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
huggingface/Repo2RLEnv#163 · 1 comentário ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
NousResearch/hermes-agent#121143 ·