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

prevent comment on uploading #32263

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

sangcheol12
Copy link

@sangcheol12 sangcheol12 commented Oct 15, 2024

fix #32262

fix for new comment

스크린샷 2024-10-15 오후 1 21 08

fix for edit comment

스크린샷 2024-10-15 오후 6 03 22

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 15, 2024
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 15, 2024
@yp05327
Copy link
Contributor

yp05327 commented Oct 15, 2024

I found that the comment button here (in files changes tab) will not be checked (it will always be enabled), as what it does in conversation tab.
image
Do you have interest fixing it together? 😄

Of cause, if you want, you can do it in another PR.

Edited:
Edit comment also has this issue. But IIRC, editing comment can be empty.
image

@yp05327 yp05327 added the topic/ui Change the appearance of the Gitea UI label Oct 15, 2024
@yp05327 yp05327 added this to the 1.23.0 milestone Oct 15, 2024
@sangcheol12
Copy link
Author

@yp05327
I'll address the issue with the edit comment in this PR as well. As for the issue in the files changes tab, I'll follow up with a separate PR to fix that. Thanks for pointing it out!

await uploadFile(dropzoneEl, file); // the "file" will get its "uuid" during the upload
dropzoneEl.dropzone.off('thumbnail', handleInsertPlaceholder);
Copy link
Contributor

@wxiaoguang wxiaoguang Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still doesn't seem right.

  1. await might fail and throw an exception, then the handler is left there.
  2. If there are more than 1 files are being uploaded (in progress), then it will trigger more than one handleInsertPlaceholder calls, duplicate calls will insert duplicate placeholders ? For example, 2 files being uploaed, then 3 placeholders would be inserted?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I corrected the first point, but I don't know how to solve the second problem. If you think of a way, can you suggest a solution?

Copy link
Contributor

@wxiaoguang wxiaoguang Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one more bad case: if a uploading fails, then there will be no onContentChanged callback, then the buttons stay "disabled".


I think the UI states should be managed by some well-defined events&handlers, but not by an ad-hoc "thumbnail" event with onContentChanged callback.

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 15, 2024
@lunny lunny added type/bug backport/v1.22 This PR should be backported to Gitea 1.22 labels Oct 20, 2024
@wxiaoguang wxiaoguang removed type/bug backport/v1.22 This PR should be backported to Gitea 1.22 labels Oct 21, 2024
@sangcheol12
Copy link
Author

I rewrote my code. Please review again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/frontend size/M Denotes a PR that changes 30-99 lines, ignoring generated files. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comment button should be disabled on uploading images..
5 participants