-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable Test Delivery
and Replay
webhook buttons when webhook is inactive
#27211
Conversation
…inactive These buttons are now disabled when the webhook is not active. Signed-off-by: Yarden Shoham <git@yardenshoham.com>
ce4c74d
to
e5b0066
Compare
@techknowlogick, I tried to do everything in #26814 (comment) but I don't know how to do number 4. Perhaps we can do that in another PR. |
{{if .PageIsSettingsHooksEdit}} | ||
<h4 class="ui top attached header"> | ||
{{.locale.Tr "repo.settings.recent_deliveries"}} | ||
{{if .Permission.IsAdmin}} | ||
<div class="ui right"> | ||
<button class="ui teal tiny button" id="test-delivery" data-tooltip-content="{{.locale.Tr "repo.settings.webhook.test_delivery_desc"}}" data-link="{{.Link}}/test" data-redirect="{{.Link}}">{{.locale.Tr "repo.settings.webhook.test_delivery"}}</button> | ||
<!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why the tooltip doesn't show on a disabled button
so I wrapped it in a span
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is per browser design where disabled elements do not emit mouse events and such:
https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled#overview
atomiks/tippyjs#286
Often browsers grey out such controls and it won't receive any browsing events, like mouse clicks or focus-related ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought I see we don't actually set disabled
attribute, only disabled
class, so it should still work unless the CSS sets pointer-events: none
on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually yes, I see .ui.disabled.button
sets pointer-events: none
so that is likely why tippy does not work. I guess a wrapper is a ok-ish solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's even the official solution, apparently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do have a little bit more control because our CSS sets the pointer-events
, but I can't recommend enabling pointer-events
because that would make the button clickable and it would need additional JS to ensure it's unclickable.
Just a note: It could be useful to test an inactive webhook. If you have a very active used repo you may need to finetune/check if the webhook would work correctly without spamming the endpoint with real events. |
This PR doesn't change the current behavior, just highlights that gitea as of now doesn't allow test deliveries of inactive webhooks. |
…inactive (go-gitea#27211) These buttons are now disabled when the webhook is not active. The buttons were always enabled before this change. - Fixes go-gitea#26824 - Replaces go-gitea#26814 # Before ![image](https://github.com/go-gitea/gitea/assets/20454870/e783d0d8-b433-440e-b95f-50d7c42613d3) ![image](https://github.com/go-gitea/gitea/assets/20454870/b4886151-9f32-4e83-8001-dd3f20c23d70) # After ![image](https://github.com/go-gitea/gitea/assets/20454870/74b76a72-0818-4143-8548-5d42c4119a05) ![image](https://github.com/go-gitea/gitea/assets/20454870/d5ae4e5c-c1ac-4751-a072-e6f7511b1e07) Signed-off-by: Yarden Shoham <git@yardenshoham.com>
…inactive (#27211) (#27253) Backport #27211 by @yardenshoham These buttons are now disabled when the webhook is not active. The buttons were always enabled before this change. - Fixes #26824 - Replaces #26814 # Before ![image](https://github.com/go-gitea/gitea/assets/20454870/e783d0d8-b433-440e-b95f-50d7c42613d3) ![image](https://github.com/go-gitea/gitea/assets/20454870/b4886151-9f32-4e83-8001-dd3f20c23d70) # After ![image](https://github.com/go-gitea/gitea/assets/20454870/74b76a72-0818-4143-8548-5d42c4119a05) ![image](https://github.com/go-gitea/gitea/assets/20454870/d5ae4e5c-c1ac-4751-a072-e6f7511b1e07) Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Yarden Shoham <git@yardenshoham.com>
* giteaofficial/main: [skip ci] Updated translations via Crowdin Another round of `db.DefaultContext` refactor (go-gitea#27103) Fix more "locale" usages (go-gitea#27259) Always use `ctx.Locale.Tr` inside templates (go-gitea#27231) Disable `Test Delivery` and `Replay` webhook buttons when webhook is inactive (go-gitea#27211) # Conflicts: # templates/base/footer_content.tmpl # templates/repo/issue/view_content/context_menu.tmpl
These buttons are now disabled when the webhook is not active.
The buttons were always enabled before this change.
Test Delivery
for inactive webhook behaves confusing #26824Before
After