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

Pull request created by deleted user can not be opened #29159

Closed
perlfisch opened this issue Feb 13, 2024 · 9 comments · Fixed by #29161
Closed

Pull request created by deleted user can not be opened #29159

perlfisch opened this issue Feb 13, 2024 · 9 comments · Fixed by #29161
Labels
Milestone

Comments

@perlfisch
Copy link

Description

One of our users created a pull request and his account was deleted later on. Attempting to open this pull request results in the standard error page with return code 500. Other pull requests created by the same account are fine.

Attempting to open the pull requests results in Gitea logging the following line:

2024/02/13 11:32:58 ...rs/web/repo/issue.go:1405:ViewIssue() [E] LoadAttributes: user does not exist [uid: 47, name: , keyid: 0]

Behavior is independent of the permissions of the account used to open the page. No other errors are logged.

Gitea Version

v1.21.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Debian 12

How are you running Gitea?

Packages provided by gitea on Github

Database

PostgreSQL

@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 13, 2024

Was that user assigned to the PR or has left a review comment? For both I see some problems with deleted users. Or was the user just the poster of the PR?

@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 13, 2024

Could you test if #29161 fixes your problem? Otherwise we need more info.

@perlfisch
Copy link
Author

Thanks for looking into this!

Was that user assigned to the PR or has left a review comment? For both I see some problems with deleted users. Or was the user just the poster of the PR?

The user created the PR and it is possible that he was assignee or left review comments. I am unable to tell whether this is the case, as I can not open the PR.

Could you test if #29161 fixes your problem? Otherwise we need more info.

I am unable to deploy unofficial releases into the production infrastructure this is occurring on. How would you recommend obtaining additional information about the cause of the issue?

@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 14, 2024

If you have access to the database, check if one of these queries has a result. If yes, then #29161 will fix your issue.

select * from comment join issue on (issue.id = comment.issue_id) where assignee_id = 47 and issue.index = ?
select * from review join issue on (issue.id = review.issue_id) where reviewer_id = 47 and issue.index = ?

Replace the ? with the PR id you see in the url.

@perlfisch
Copy link
Author

Yep, that seems to be the issue then.

select * from comment join issue on (issue.id = comment.issue_id) where assignee_id = 47 and issue.index = ?

returns two rows and

select * from review join issue on (issue.id = review.issue_id) where reviewer_id = 47 and issue.index = ?

Returns one row for the PR in question

Thanks again for the quick responses!

@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 14, 2024

Then you can just change the reviewer_id to -1 (or any other existing user id) to restore that PR.

@perlfisch
Copy link
Author

Yep, that worked, thanks a lot again for your help! Feel free to close this issue now or once the PR is merged.

KN4CK3R added a commit that referenced this issue Feb 14, 2024
KN4CK3R added a commit to KN4CK3R/gitea that referenced this issue Feb 14, 2024
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 15, 2024
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
@wxiaoguang wxiaoguang added this to the 1.21.6 milestone Feb 21, 2024
@wxiaoguang
Copy link
Contributor

wait for backport

@wxiaoguang wxiaoguang reopened this Feb 21, 2024
@KN4CK3R
Copy link
Member

KN4CK3R commented Feb 21, 2024

Backport was already done in #29169.

@KN4CK3R KN4CK3R closed this as completed Feb 21, 2024
6543 pushed a commit to 6543-forks/gitea that referenced this issue Feb 26, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
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.

3 participants