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

Use async await to fix empty quote reply at first time (#23168) #23258

Closed
wants to merge 1 commit into from

Conversation

HesterG
Copy link
Contributor

@HesterG HesterG commented Mar 3, 2023

Backport #23168

The reason why quote reply is empty is when quote reply is clicked, it triggers the click function on .comment-form-reply button, and when the first time this function is triggered, easyMDE for the reply has not yet initialized, so that click handler of .quote-reply button in repo-legacy.js got an undefined as easyMDE, and the following lines which put quoted reply into the easyMDE is not executed. The workaround in this PR is to pass the replied content to '.comment-form-reply' button if easyMDE is not yet initialized (quote reply first clicked) and put the replied content into it the after easyMDE is created.
Now quote reply on first click:

default.mov

Update:
The above change is not appropriate as stated in the comment Use await instead

Close #22075.
Close #23247.

The reason why quote reply is empty is when quote reply is clicked, it
triggers the click function on `.comment-form-reply` button, and when
the first time this function is triggered, easyMDE for the reply has not
yet initialized, so that click handler of `.quote-reply` button in
`repo-legacy.js` got an `undefined` as easyMDE, and the following lines
which put quoted reply into the easyMDE is not executed.
The workaround in this PR is to pass the replied content to
'.comment-form-reply' button if easyMDE is not yet initialized (quote
reply first clicked) and put the replied content into it the after
easyMDE is created.
Now quote reply on first click:

https://user-images.githubusercontent.com/17645053/221452823-fc699d50-1649-4af1-952e-f04fc8d2978e.mov

<br />

Update:
The above change is not appropriate as stated in the
[comment](go-gitea#23168 (comment))
Use await instead

Close go-gitea#22075.
Close go-gitea#23247.
@HesterG
Copy link
Contributor Author

HesterG commented Mar 3, 2023

This PR is not suitable to be backported to v1.18 as the hideElem function is not introduced until v1.19 by #22950

截屏2023-03-03 10 20 42

@HesterG HesterG closed this Mar 3, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 3, 2023
@HesterG HesterG deleted the backport-PR-23168 branch March 6, 2023 08:03
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants