Gitea: Error 500 creating PR with assignees

Created on 11 Jul 2018  路  4Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref): bbf9abde4937285c77154129ae9934b22b4ea7a6
  • Git version: 2.7.4
  • Operating system: Ubuntu 16.04.4 LTS
  • Database (use [x]):

    • [ ] PostgreSQL

    • [x] MySQL

    • [ ] MSSQL

    • [ ] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [x] Yes

    • [ ] No

    • [ ] Not relevant

  • Log gist:

Description

When I try to create pull request with one or more assignees I get 500 error. Error doesn't show up if nobody is assigned. I'm able to add assignees only for already existing pull requests.

Log error:

2018/07/10 15:41:42 [...routers/repo/pull.go:836 CompareAndPullRequestPost()] [E] NewPullRequest: newIssue: loadPullRequest: pull request does not exist [id: 0, issue_id: 24, head_repo_id: 0, base_repo_id: 0, head_branch: , base_branch: ]
kinbug

Most helpful comment

Yes for backported issues milestone should be changed

All 4 comments

There is form of spaghetti in code:

First, newIssue is called. It creates new issue and puts it into database.
newIssue function calls ChangeAssignee for each assigner in created issue.
ChangeAssignee calls loadPullRequest to load pull request information (for supsequent webhook calls), but pull request is not ready yet.

I see two possible solutions:

  1. NewPullRequest should create new issue without assignees, then add pull request to database, and then add every assignee with changeAssignee function.
  2. changeAssignee should not enqueue webhooks calls for pull requests in the middle of creation (if corresponding record is not in database yet), but after successful PR record insertion NewPullRequest can loop through assignees and enqueue webhook call for each of them.

Both look like dirty workarounds for me, but if some of them is acceptible, implement it (or I could implement it, although i'm not golang coder, but syntax looks clear for me)

This seems to affect 1.5.0, why not backport?

Ah, it was backported. Maybe this could be made clearer some way?

Yes for backported issues milestone should be changed

Was this page helpful?
0 / 5 - 0 ratings