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

Issue comment edit-diff is wrong #17393

Closed
noerw opened this issue Oct 21, 2021 · 10 comments · Fixed by #17404
Closed

Issue comment edit-diff is wrong #17393

noerw opened this issue Oct 21, 2021 · 10 comments · Fixed by #17404
Assignees
Labels
Milestone

Comments

@noerw
Copy link
Member

noerw commented Oct 21, 2021

Gitea Version

58cd55d

Git Version

? idk, saw it on gitea.com

Operating System

linux

How are you running Gitea?

gitea.com

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Description

Edits of more complex comments get quite strange diffs. I got diffs that didn't touch the single line that was edited, but show two other lines as changed (I'll try to come up with a more minimal reproducer later)
An edit like the following worked fine though.

foo
-baz
+bar
bar

It seems this feature needs more testing with longer comments / more complex edits.

Screenshots

I don't know what the actual edit was, but certainly not this:
image

@noerw noerw added the type/bug label Oct 21, 2021
@noerw noerw added this to the 1.16.0 milestone Oct 21, 2021
@noerw
Copy link
Member Author

noerw commented Oct 21, 2021

ping @wxiaoguang

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 22, 2021

You just triggered an unrelated bug which prevent the JS executing 😂

I fixed that bug and I think we should apply the patch first to continue. #17398

Otherwise I can not see the content history menu.

@wxiaoguang
Copy link
Contributor

Just a guess, have you edited the issue more than 20 times? If yes, it is a feature (required by some reviewers) that we only keep 20 history revisions at most, the shortest interval history revision are deleted if the count is greater than 20.

@wxiaoguang wxiaoguang changed the title Issuecomment edit-diff is wrong Issue comment edit-diff is wrong Oct 22, 2021
@noerw
Copy link
Member Author

noerw commented Oct 22, 2021

No, this is a single edit, see the link above. (ah right, you can't see the edit menu on try.gitea.io as a different user right..? edit: I added you as collaborator on that repo for you to see the edit history :)

I discovered another issue with the edit history listing: I edited a comment of another user (I have write access to issue unit in that repo), and it shows up that the original poster made the edit..

@wxiaoguang
Copy link
Contributor

Still can not see the history menu. By design, this menu will be shown for all users with read access (including guest users). I think maybe the JS error prevent the menu from showing. So maybe we should apply the context popup fix first.

@wxiaoguang wxiaoguang assigned wxiaoguang and noerw and unassigned noerw Oct 22, 2021
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 22, 2021

About another problem: "I discovered another issue with the edit history listing: I edited a comment of another user (I have write access to issue unit in that repo), and it shows up that the original poster made the edit.."

I found the problem. I use doer.ID when editing comment content, but use issue.PosterID when editing the main issue wrongly. It will be get fixed soon.

@wxiaoguang wxiaoguang linked a pull request Oct 22, 2021 that will close this issue
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 22, 2021

@noerw I just tried https://try.gitea.io/noerw/hochwasser/issues/4 , can not find the dialog matching the strange screenshot. Can you provide more information?

Or is it browser related?

ps: some known problems have been fixed in the related PR, including the dialog UI (height problem), the wrong editor problem for the main issue.

@noerw
Copy link
Member Author

noerw commented Oct 22, 2021

Nice!
The screenshot is the "view changes" modal opened after clicking a revision from the dropdown. The displayed content is the first edit to https://gitea.com/gitea/tea/issues/436. I can't tell what the actual diff was.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 22, 2021

I managed to reproduce some similar diffs .... maybe the problem is caused by the diff module (maybe my usage is incorrect), triggered by some special texts. I need more time to test.

@wxiaoguang
Copy link
Contributor

I find a small reproducible example:

X: Y

- [ ] aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

- [ ] B

- [ ] ccccccccccccccccccccccccccccccccccccccc

test

then remove the last test, then the diff becomes strange ....

@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants