Closing a PR fails (404 web page) if external issue tracker enabled, or no issue tracker enabled #1036

Closed
opened 2025-11-02 03:46:08 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @smckown on GitHub (Sep 1, 2017).

  • Gitea version (or commit ref): 1.2.0-rc1 (binary install)
  • Git version: 2.11.0
  • Operating system: Ubuntu Linux 16.04 amd64
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
2017/09/01 11:47:16 [...ules/context/repo.go:527 func1()] [E] CheckUnit: You are not allowed to visit this repository unit: 2

Description

  • Start with a repository that is configured for no issue tracker, or an external issue tracker
  • Create a PR
  • Press the Close button on the PR page
  • Result: 404 web page, and log message shown above
  • PR is not removed

The problem does not appear if the builtin issue tracker is enabled. In fact, to close the PR I can:

  • Change to the builtin issue tracker
  • Go close the PR
  • Return to original issue settings (either no issue tracker, or external issue tracker)

Thanks!

Originally created by @smckown on GitHub (Sep 1, 2017). - Gitea version (or commit ref): 1.2.0-rc1 (binary install) - Git version: 2.11.0 - Operating system: Ubuntu Linux 16.04 amd64 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ``` 2017/09/01 11:47:16 [...ules/context/repo.go:527 func1()] [E] CheckUnit: You are not allowed to visit this repository unit: 2 ``` ## Description * Start with a repository that is configured for no issue tracker, or an external issue tracker * Create a PR * Press the Close button on the PR page * Result: 404 web page, and log message shown above * PR is not removed The problem does not appear if the builtin issue tracker is enabled. In fact, to close the PR I can: * Change to the builtin issue tracker * Go close the PR * Return to original issue settings (either no issue tracker, or external issue tracker) Thanks!
GiteaMirror added the type/bug label 2025-11-02 03:46:08 -06:00
Author
Owner

@lunny commented on GitHub (Sep 2, 2017):

A PR is also an issue. So if we closed the issues, then maybe all the PR related features should be hidden also.

@lunny commented on GitHub (Sep 2, 2017): A PR is also an issue. So if we closed the issues, then maybe all the PR related features should be hidden also.
Author
Owner

@lafriks commented on GitHub (Sep 2, 2017):

I don't think so. PR should still work even if issues is disabled

@lafriks commented on GitHub (Sep 2, 2017): I don't think so. PR should still work even if issues is disabled
Author
Owner

@lunny commented on GitHub (Sep 3, 2017):

So we still have Issues tab and only list all the Pull Requests?

@lunny commented on GitHub (Sep 3, 2017): So we still have Issues tab and only list all the Pull Requests?
Author
Owner

@lafriks commented on GitHub (Sep 3, 2017):

No do not have issues tab, just PR tab but we have to function them properly

@lafriks commented on GitHub (Sep 3, 2017): No do not have issues tab, just PR tab but we have to function them properly
Author
Owner

@smckown commented on GitHub (Sep 4, 2017):

I suspect the following behavior is related to the same root cause.

With external issues enabled, and trying to create (or edit) a PR comment to add an issue reference of the form #NNNN, the Preview pane shows the comment as one might expect. Yet on Save, gitea logs the message below and does not save the PR comment.

2017/09/04 07:20:31 [...ules/context/repo.go:527 func1()] [E] CheckUnit: You are not allowed to visit this repository unit: 2

If I enable builtin issues, add/edit a PR comment to include #NNNN, Save the comment, then re-enable external issues, then the PR comment displays correctly.

This behavior does not appear to apply to references of the form:

<org>/<repo>/#N

The above extended reference format seems to allow me to refer to one PR from another PR comment even when external issues are enabled.

@smckown commented on GitHub (Sep 4, 2017): I suspect the following behavior is related to the same root cause. With external issues enabled, and trying to create (or edit) a PR comment to add an issue reference of the form #NNNN, the Preview pane shows the comment as one might expect. Yet on Save, gitea logs the message below and does not save the PR comment. ``` 2017/09/04 07:20:31 [...ules/context/repo.go:527 func1()] [E] CheckUnit: You are not allowed to visit this repository unit: 2 ``` If I enable builtin issues, add/edit a PR comment to include #NNNN, Save the comment, then re-enable external issues, then the PR comment displays correctly. This behavior does not appear to apply to references of the form: ``` <org>/<repo>/#N ``` The above extended reference format seems to allow me to refer to one PR from another PR comment even when external issues are enabled.
Author
Owner

@iamnumbersix commented on GitHub (Sep 6, 2017):

Also a 404 on 1.2.0+rc2 if there is no issue tracker. Even without a PR. Might be related.
I can only access Repositories with issue trackers (internal) enabled.

2017/09/06 20:50:41 [...routers/repo/view.go:274 Home()] [E] Home: Cannot find any unit on this repository which you are allowed to access

@iamnumbersix commented on GitHub (Sep 6, 2017): Also a 404 on 1.2.0+rc2 if there is no issue tracker. Even without a PR. Might be related. I can only access Repositories with issue trackers (internal) enabled. `2017/09/06 20:50:41 [...routers/repo/view.go:274 Home()] [E] Home: Cannot find any unit on this repository which you are allowed to access`
Author
Owner

@lunny commented on GitHub (Sep 7, 2017):

@iamnumbersix your problem should be different from this one.

@lunny commented on GitHub (Sep 7, 2017): @iamnumbersix your problem should be different from this one.
Author
Owner

@webjoel commented on GitHub (Oct 6, 2017):

Comment, start time tracker and add time tracker, error page 404 is returned too.

In my opinion, using external or internal issue tracker should not be related to the functionality of the pull request, the comment part is undisputed, in the case of the time tracker I may want to record activities in the pull request with no relation to an issue, just record of the work itself. However if this is not accepted, at least the time tracker options in the pull request should be hidden as well as enabled external tracker issue.

@webjoel commented on GitHub (Oct 6, 2017): Comment, start time tracker and add time tracker, error page 404 is returned too. In my opinion, using external or internal issue tracker should not be related to the functionality of the pull request, the comment part is undisputed, in the case of the time tracker I may want to record activities in the pull request with no relation to an issue, just record of the work itself. However if this is not accepted, at least the time tracker options in the pull request should be hidden as well as enabled external tracker issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1036