-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Allow searching issues by ID #31479
Allow searching issues by ID #31479
Conversation
2e7aa6c
to
7bfe539
Compare
Erm… It looks like you mixed up concepts if I see that correctly: |
Actually I have a different idea for fixing the problem. If an number is inputed, I think we should just query it directly from database and fill the result into the list. Then everything works well and it doesn't need to depend on the indexer, and we could make the match issue at the top as the first one (it really helps for end users to quickly select it) |
Oh, yes, currently they are in sync on my system 😄 I will fix that and also change it so that it will go the fast route via the index and db indexer. @wxiaoguang @delvh |
7bfe539
to
ba448d2
Compare
I need to wrap my head around the tests first but I think that it will be rather easy to do. |
ba448d2
to
604c69e
Compare
75361d4
to
51149a0
Compare
I am at a loss here. While it compiles, lints and works just fine, the tests fail with some error message that I cannot figure out. https://github.com/go-gitea/gitea/actions/runs/9668323949/job/26672235178?pr=31479#step:8:185 I noticed that the web route for the issue search will query for the repository ids that are accessible by the user, so I added the repository ids to the test cases as well, reasoning that passing in an empty array would be the cause, but it wasn't. |
Hmm, maybe we could try a simpler approach (avoid touching too many
2 and 3 could be merged into one new function. Then we only need to add a new function, it's easier to test and no need to handle various indexer cases. Then we only need to test the newly added function by some mocked data, no need to touch existing search indexer cases. |
If you don't mind, I could work on this PR and make some edits |
This would break current behaviour, as the search is across all repositories that the user has access to, so searching for an issue by keyword will bring up issues from both repository a and b. And so must the search for the index number. As for the failing test: like I said i must first get my head around the way that the test suite works incl. also the library being used... |
Sorry but maybe I haven't fully understand the problem. Could the "dependency dropdown" add other repository's issue as a dependency? IIRC it only support adding current repository's issues? |
@wxiaoguang Found it, it is the sql query that included a query for index, which is actually a keyword in sqlite. My oh my, without any stracktraces available, this was hard to find 😁 Shouldn't xorm take care of that? I have used the universal(?) escape using double quotes, e.g. |
Not with the version I am currently working on. It will give me results from multiple repositories I am the owner of. Not so shure, whether this applies to non admin/owner users... But looking at the code at https://github.com/coldrye-collaboration/gitea/blob/fix/gh4479-issue-dependency-select-broken/routers/web/repo/issue.go#L2600, it seems as if it fetches all repositories that are accessible to the user. |
51149a0
to
be7db18
Compare
If you are worried about the cyclomatic complexity, be assured, that the new code is not a hotspot 😀 I think that keeping the SearchOptions.Index an optional and populating that optional in the root indexer should be kept, allowing you the possibility to use the indexers in case that a prefix based search on the index number is required. For now, the optimal route will be taken via the db indexer. |
91f3344
to
09a846f
Compare
64750fd
to
488e0db
Compare
- Use backticks instead of double quotes Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
488e0db
to
9c464e2
Compare
I have squashed the changes into a single commit. |
* giteaofficial/main: [skip ci] Updated translations via Crowdin Allow searching issues by ID (go-gitea#31479) allow synchronizing user status from OAuth2 login providers (go-gitea#31572) Enable `no-jquery/no-class-state` (go-gitea#31639) Added default sorting milestones by name (go-gitea#27084)
* origin/main: (59 commits) fix OIDC introspection authentication (go-gitea#31632) Enable direnv (go-gitea#31672) [skip ci] Updated translations via Crowdin [skip ci] Updated translations via Crowdin fix redis dep (go-gitea#31662) add skip secondary authorization option for public oauth2 clients (go-gitea#31454) Fix a branch divergence cache bug (go-gitea#31659) [skip ci] Updated translations via Crowdin Remove unneccessary uses of `word-break: break-all` (go-gitea#31637) [skip ci] Updated translations via Crowdin Allow searching issues by ID (go-gitea#31479) allow synchronizing user status from OAuth2 login providers (go-gitea#31572) Enable `no-jquery/no-class-state` (go-gitea#31639) Added default sorting milestones by name (go-gitea#27084) Code editor theme enhancements (go-gitea#31629) Add option to change mail from user display name (go-gitea#31528) Upgrade xorm to v1.3.9 and improve some migrations Sync (go-gitea#29899) Issue Templates: add option to have dropdown printed list (go-gitea#31577) Fix update flake (go-gitea#31626) [skip ci] Updated translations via Crowdin ...
When you are entering a number in the issue search, you likely want the issue with the given ID (code internal concept: issue index).
As such, when a number is detected, the issue with the corresponding ID will now be added to the results.
Fixes #4479