# Prevent keybindings from triggering requests that should be disabled \(\#30221\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/b4109a2376a9393693a7b95886091d48820e1628)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: b4109a2376a9393693a7b95886091d48820e1628

Requested commit: b4109a2376a9393693a7b95886091d48820e1628

Commit: b4109a2376a9393693a7b95886091d48820e1628

Tree: 352b4da5b4a94537501c8233611dd95b625cdd65

Author: Ben Brandt

Committer: GitHub

## Message

```
Prevent keybindings from triggering requests that should be disabled (#30221)

Extracts authorization logic to a single method and add early
returns in message handlers to prevent sending requests when the model
configuration is invalid or terms haven't been accepted.

This was allowing for the TOS popup to show up even for logged out users
because they could bypass the disabled button with the keybinding.

Now the behavior should be the same either way, that the request isn't
made unless they can send it.

The text thread already has a banner to tell the user to configure a
model provider, so I don't think we need to pop up a separate modal,
since the button is disabled anyway.

Release Notes:

- N/A
```

## Parents

- [6565c091e4135508a67c386059c013857e49d7e6](https://git.cafe/gitcafe/zed/commit/6565c091e4135508a67c386059c013857e49d7e6?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/b4109a2376a9393693a7b95886091d48820e1628?format=markdown)
