Skip to content
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

Implement Debouncing for Approve Button Clicks in Gitea Pull Requests #25096

Closed
LKI opened this issue Jun 6, 2023 · 3 comments · Fixed by #25219
Closed

Implement Debouncing for Approve Button Clicks in Gitea Pull Requests #25096

LKI opened this issue Jun 6, 2023 · 3 comments · Fixed by #25219
Assignees
Labels
topic/ui-interaction Change the process how users use Gitea instead of the visual appearance

Comments

@LKI
Copy link

LKI commented Jun 6, 2023

Description

I have discovered that Gitea lacks debouncing functionality for the approve button, which can result in repeated approvals if users click quickly before the website responds. Additionally, this can lead to multiple webhook calls being triggered.

To solve this issue, I suggest implementing a debounce mechanism in Gitea. Debouncing would effectively merge and handle multiple rapid approve actions performed by a user during a single interaction.

Here is a screenshot illustrating the problem:

image

I kindly request the Gitea development team to consider adding this feature to enhance the user experience and prevent unintended repeated approvals.

Thank you for your attention to this matter, and I appreciate your efforts in continually improving Gitea.

Gitea Version

1.19.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Self-hosted in docker container

Database

None

@LKI LKI added the type/bug label Jun 6, 2023
@lunny lunny added topic/ui-interaction Change the process how users use Gitea instead of the visual appearance and removed type/bug labels Jun 6, 2023
@HesterG
Copy link
Contributor

HesterG commented Jun 8, 2023

I think to improve this, we might first change the form submit to post by fetch in js, and then do debounce or add flag like isFetching, and if the flag is true, do not post repeatedly.

@wxiaoguang
Copy link
Contributor

Many related issues like #20402

AJAX is the answer to the problem.

@HesterG HesterG self-assigned this Jun 9, 2023
lunny pushed a commit that referenced this issue Jun 14, 2023
Co-author: @wxiaoguang 

Close #25096 

The way to fix it in this PR is to change form submit to fetch using
formData, and add flags to avoid post repeatedly.
Should be able to apply to more forms that have the same issue after
this PR.

In the demo below, 'approve' is clicked several times, and then
'comment' is clicked several time after 'request changes' clicked.

After:


https://github.com/go-gitea/gitea/assets/17645053/beabeb1d-fe66-4b76-b048-4f022b4e83a0


Update: screenshots from /devtest

>
![image](https://user-images.githubusercontent.com/2114189/245680011-ee4231e0-a53d-4c2a-a9c2-71ccd98005cc.png)
> 
>
![image](https://user-images.githubusercontent.com/2114189/245680057-9215d348-63d8-406d-8828-17e171163aaa.png)
> 
>
![image](https://user-images.githubusercontent.com/2114189/245680148-89d7b3d1-d7b6-442f-b69e-eadaee112482.png)

---------

Co-authored-by: wxiaoguang <[email protected]>
@LKI
Copy link
Author

LKI commented Jun 14, 2023

Thanks! @lunny

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui-interaction Change the process how users use Gitea instead of the visual appearance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants