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

Dependencies only show one issue for each other repo #27722

Closed
colejohnson66 opened this issue Oct 21, 2023 · 6 comments · Fixed by #27736
Closed

Dependencies only show one issue for each other repo #27722

colejohnson66 opened this issue Oct 21, 2023 · 6 comments · Fixed by #27736
Labels

Comments

@colejohnson66
Copy link

colejohnson66 commented Oct 21, 2023

Description

The "blocks/dependencies" area of issues only shows the three oldest additions to the list, even if there are more. The issue log does show there being more than three "new dependencies" being added. It appears like the code naively adds a LIMIT 3 to the database call with no regard for the real count.

The entire list should be viewable, and it should be sorted differently than the order of insertion in the database.

Gitea Version

1.20.5

Can you reproduce the bug on the Gitea demo site?

Untested

Log Gist

No response

Screenshots

This screenshot shows only three issues as being blocked by the currently viewed one. The current issue actually blocks about a half-dozen. As above, these are the first three additions to the list, and appear in that order.

Screenshot showing the above description

Git Version

No response

Operating System

No response

How are you running Gitea?

N/A

Database

MySQL/MariaDB

@colejohnson66
Copy link
Author

I can't easily identify why this occurs. The template as well as the code to retrieve them do not place a limit on the list's length.

@lng2020
Copy link
Member

lng2020 commented Oct 22, 2023

this PR #17935 has several bugs and typos. It really should add some tests to ensure its behavior.

@colejohnson66 colejohnson66 changed the title Dependencies only show three issues Dependencies only show one issue for each other repo Oct 23, 2023
@colejohnson66
Copy link
Author

colejohnson66 commented Oct 23, 2023

Looking at your new PR and the linked PR, I can indeed confirm that the issue (no pun intended) is that only the first added issue for each other repository is shown. And they are shown in order of repository ID.

So, for my screenshot, #‍15 was from repo ID 2, #‍856 from ID 3, and #‍23 from ID 4. In addition, issue #‍23 for repository ID 4 was actually the first to be added to the list of dependencies, but shows up last.

@lng2020
Copy link
Member

lng2020 commented Oct 23, 2023

That make much more sense. Your screenshot is strictly followed the old code logic.

@KazzmanK
Copy link
Contributor

KazzmanK commented Oct 28, 2023

There is much to add to the Dependency list UI issues.
on try.gitea.io I'm unable to reproduce my problems
on our 1.20.5 it is shows Not found, or, when I type, it shows strange results in dropdown.

image

In sibling issue it indeed displays it, but I need to reference other issue there

image

So, to add reference to issue 26 in my first issue, I have to try referencing issue 25, it shows issue 26 in dropdown and it is done !
But after what when I try to repeat the trick in other issue with filter string 25 it starts showing issue 81 and it is not possible to pick issue 26 anymore.
Total mess!
Is there something fixed in upcoming releases ?

@KazzmanK
Copy link
Contributor

KazzmanK commented Oct 28, 2023

It is still rising questions on 1.21.0+rc2-22-g2d2a5657e
image

As well as on
1.22.0+dev-249-ge75b89ea6

It just shows some random results in dropdown , and misses required issues.

lunny pushed a commit that referenced this issue Jan 12, 2024
Fix #27722 
Fix #27357
Fix #25837 
1. Fix the typo `BlockingByDependenciesNotPermitted`, which causes the
`not permitted message` not to show. The correct one is `Blocking` or
`BlockedBy`
2. Rewrite the perm check. The perm check uses a very tricky way to
avoid duplicate checks for a slice of issues, which is confusing. In
fact, it's also the reason causing the bug. It uses `lastRepoID` and
`lastPerm` to avoid duplicate checks, but forgets to assign the
`lastPerm` at the end of the code block. So I rewrote this to avoid this
trick.
![I U1AT{GNFY3
1HZ`6L{(2L](https://github.com/go-gitea/gitea/assets/70063547/79acd02a-a567-4316-ae0d-11c6461becf1)
3. It also reuses the `blocks` slice, which is even more confusing. So I
rewrote this too.

![UARFPXRGGZQFB7J$2`R}5_R](https://github.com/go-gitea/gitea/assets/70063547/f21cff0f-d9ac-4ce4-ae4d-adffc98ecd99)
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Jan 12, 2024
Fix go-gitea#27722 
Fix go-gitea#27357
Fix go-gitea#25837 
1. Fix the typo `BlockingByDependenciesNotPermitted`, which causes the
`not permitted message` not to show. The correct one is `Blocking` or
`BlockedBy`
2. Rewrite the perm check. The perm check uses a very tricky way to
avoid duplicate checks for a slice of issues, which is confusing. In
fact, it's also the reason causing the bug. It uses `lastRepoID` and
`lastPerm` to avoid duplicate checks, but forgets to assign the
`lastPerm` at the end of the code block. So I rewrote this to avoid this
trick.
![I U1AT{GNFY3
1HZ`6L{(2L](https://github.com/go-gitea/gitea/assets/70063547/79acd02a-a567-4316-ae0d-11c6461becf1)
3. It also reuses the `blocks` slice, which is even more confusing. So I
rewrote this too.

![UARFPXRGGZQFB7J$2`R}5_R](https://github.com/go-gitea/gitea/assets/70063547/f21cff0f-d9ac-4ce4-ae4d-adffc98ecd99)
lafriks pushed a commit that referenced this issue Jan 12, 2024
Backport #27736 by @lng2020

Fix #27722 
Fix #27357
Fix #25837 
Fix #28732 
1. Fix the typo `BlockingByDependenciesNotPermitted`, which causes the
`not permitted message` not to show. The correct one is `Blocking` or
`BlockedBy`
2. Rewrite the perm check. The perm check uses a very tricky way to
avoid duplicate checks for a slice of issues, which is confusing. In
fact, it's also the reason causing the bug. It uses `lastRepoID` and
`lastPerm` to avoid duplicate checks, but forgets to assign the
`lastPerm` at the end of the code block. So I rewrote this to avoid this
trick.
![I U1AT{GNFY3
1HZ`6L{(2L](https://github.com/go-gitea/gitea/assets/70063547/79acd02a-a567-4316-ae0d-11c6461becf1)
3. It also reuses the `blocks` slice, which is even more confusing. So I
rewrote this too.

![UARFPXRGGZQFB7J$2`R}5_R](https://github.com/go-gitea/gitea/assets/70063547/f21cff0f-d9ac-4ce4-ae4d-adffc98ecd99)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
fuxiaohei pushed a commit to fuxiaohei/gitea that referenced this issue Jan 17, 2024
Fix go-gitea#27722 
Fix go-gitea#27357
Fix go-gitea#25837 
1. Fix the typo `BlockingByDependenciesNotPermitted`, which causes the
`not permitted message` not to show. The correct one is `Blocking` or
`BlockedBy`
2. Rewrite the perm check. The perm check uses a very tricky way to
avoid duplicate checks for a slice of issues, which is confusing. In
fact, it's also the reason causing the bug. It uses `lastRepoID` and
`lastPerm` to avoid duplicate checks, but forgets to assign the
`lastPerm` at the end of the code block. So I rewrote this to avoid this
trick.
![I U1AT{GNFY3
1HZ`6L{(2L](https://github.com/go-gitea/gitea/assets/70063547/79acd02a-a567-4316-ae0d-11c6461becf1)
3. It also reuses the `blocks` slice, which is even more confusing. So I
rewrote this too.

![UARFPXRGGZQFB7J$2`R}5_R](https://github.com/go-gitea/gitea/assets/70063547/f21cff0f-d9ac-4ce4-ae4d-adffc98ecd99)
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Fix go-gitea#27722 
Fix go-gitea#27357
Fix go-gitea#25837 
1. Fix the typo `BlockingByDependenciesNotPermitted`, which causes the
`not permitted message` not to show. The correct one is `Blocking` or
`BlockedBy`
2. Rewrite the perm check. The perm check uses a very tricky way to
avoid duplicate checks for a slice of issues, which is confusing. In
fact, it's also the reason causing the bug. It uses `lastRepoID` and
`lastPerm` to avoid duplicate checks, but forgets to assign the
`lastPerm` at the end of the code block. So I rewrote this to avoid this
trick.
![I U1AT{GNFY3
1HZ`6L{(2L](https://github.com/go-gitea/gitea/assets/70063547/79acd02a-a567-4316-ae0d-11c6461becf1)
3. It also reuses the `blocks` slice, which is even more confusing. So I
rewrote this too.

![UARFPXRGGZQFB7J$2`R}5_R](https://github.com/go-gitea/gitea/assets/70063547/f21cff0f-d9ac-4ce4-ae4d-adffc98ecd99)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 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