aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues
Commit message (Collapse)AuthorAgeFilesLines
* Allow filtering issues by any assignee (#33343)Andreas Svanberg7 days2-18/+16
| | | | | | | | | | | | | | | | This is the opposite of the "No assignee" filter, it will match all issues that have at least one assignee. Before ![Before change](https://github.com/user-attachments/assets/4aea194b-9add-4a84-8d6b-61bfd8d9e58e) After ![After change with any filter](https://github.com/user-attachments/assets/99f1205d-ba9f-4a0a-a60b-cc1a0c0823fe) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Small refactor to reduce unnecessary database queries and remove duplicated ↵Lunny Xiao2025-03-042-0/+12
| | | | functions (#33779)
* Use pullrequestlist instead of []*pullrequest (#33765)Lunny Xiao2025-03-022-8/+8
| | | Just renames no code changed.
* allow filtering /repos/{owner}/{repo}/pulls by target base branch queryparam ↵Royce Remer2025-02-271-0/+5
| | | | | | (#33684) Co-authored-by: Royce Remer <rremer@salesforce.com> Co-authored-by: delvh <dev.lh@web.de>
* Use test context in tests and new loop system in benchmarks (#33648)TheFox0x72025-02-201-2/+1
| | | | | | | | Replace all contexts in tests with go1.24 t.Context() --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Move issue pin to an standalone table for querying performance (#33452)Lunny Xiao2025-02-173-185/+309
| | | | | | | | | | | | | | | | | | | Noticed a SQL in gitea.com has a bigger load. It seems both `is_pull` and `pin_order` are not indexed columns in the database. ```SQL SELECT `id`, `repo_id`, `index`, `poster_id`, `original_author`, `original_author_id`, `name`, `content`, `content_version`, `milestone_id`, `priority`, `is_closed`, `is_pull`, `num_comments`, `ref`, `pin_order`, `deadline_unix`, `created_unix`, `updated_unix`, `closed_unix`, `is_locked`, `time_estimate` FROM `issue` WHERE (repo_id =?) AND (is_pull = 0) AND (pin_order > 0) ORDER BY pin_order ``` I came across a comment https://github.com/go-gitea/gitea/pull/24406#issuecomment-1527747296 from @delvh , which presents a more reasonable approach. Based on this, this PR will migrate all issue and pull request pin data from the `issue` table to the `issue_pin` table. This change benefits larger Gitea instances by improving scalability and performance. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix project issues list and counting (#33594)Lunny Xiao2025-02-172-29/+35
| | | | Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Move commits signature and verify functions to service layers (#33605)Lunny Xiao2025-02-161-40/+0
| | | | No logic change, just move functions.
* Improve commits list performance to reduce unnecessary database queries (#33528)Lunny Xiao2025-02-141-1/+4
| | | | | | When listing commits, Gitea attempts to retrieve the actual user based on the commit email. Querying users one by one from the database is inefficient. This PR optimizes the process by batch querying users by email, reducing the number of database queries.
* Performance optimization for pull request files loading comments attachments ↵Lunny Xiao2025-02-141-2/+4
| | | | (#33585)
* Rework suggestion backend (#33538)Lunny Xiao2025-02-101-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix #33522 The suggestion backend logic now is - If the keyword is empty, returned the latest 5 issues/prs with index desc order - If the keyword is digital, find all issues/prs which `index` has a prefix with that, with index asc order - If the keyword is non-digital or if the queried records less than 5, searching issues/prs title with a `like`, with index desc order ## Empty keyword <img width="310" alt="image" src="https://github.com/user-attachments/assets/1912c634-0d98-4eeb-8542-d54240901f77" /> ## Digital <img width="479" alt="image" src="https://github.com/user-attachments/assets/0356a936-7110-4a24-b21e-7400201bf9b8" /> ## Digital and title contains the digital <img width="363" alt="image" src="https://github.com/user-attachments/assets/6e12f908-28fe-48de-8ccc-09cbeab024d4" /> ## non-Digital <img width="435" alt="image" src="https://github.com/user-attachments/assets/2722bb53-baa2-4d67-a224-522a65f73856" /> <img width="477" alt="image" src="https://github.com/user-attachments/assets/06708dd9-80d1-4a88-b32b-d29072dd1ba6" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix unnecessary comment when moving issue on the same project column (#33496)Lunny Xiao2025-02-051-4/+6
| | | Fix #33482
* chore: fix some trivial problems and TODOs (#33473)wxiaoguang2025-02-021-1/+1
| | | | | | | | | | | 1. Fix incorrect `MentionCount` (actually it seems to be deadcode, affects nothing) 2. Remove fallback sha1 support for time limit token 3. Use route middleware `reqRepoActionsWriter` for `ArtifactsDeleteView` 4. Use clearer message "Failed to authenticate user" instead of "Verify" when auth fails 5. `tests/integration/benchmarks_test.go` is not quite right, actually it is never used, so delete it. 6. Remove or update TODO comments
* Hide/disable unusable UI elements when a repository is archived (#33459)wxiaoguang2025-01-311-5/+7
| | | And by the way, remove some jQuery code
* Refactor user package (#33423)wxiaoguang2025-01-291-1/+7
| | | and avoid global variables
* Make tracked time representation display as hours (#33315)Vladimir Sysoev2025-01-191-6/+1
| | | | | | | | | | Estimated time represented in hours it might be convenient to have tracked time represented in the same way to be compared and managed. --------- Co-authored-by: Sysoev, Vladimir <i@vsysoev.ru> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix unpin hint on the pinned pull requests (#33207)Lunny Xiao2025-01-121-2/+2
|
* Some small refactors (#33144)Lunny Xiao2025-01-103-41/+22
|
* Automerge supports deleting branch automatically after merging (#32343)Lunny Xiao2025-01-101-0/+17
| | | | | | | | | | | | Resolve #32341 ~Depends on #27151~ - [x] It will display a checkbox of deleting the head branch on the pull request view page when starting an auto-merge task. - [x] Add permission check before deleting the branch - [x] Add delete branch comment for those closing pull requests because of head branch or base branch was deleted. - [x] Merge `RetargetChildrenOnMerge` and `AddDeletePRBranchComment` into `service.DeleteBranch`.
* Add missed transaction on setmerged (#33079)Lunny Xiao2025-01-083-89/+81
| | | | | | Follow #33045. There are two updates on `Set Merged`, which should be in one transaction. This also introduced some refactors for changeissuestatus to make it more clear.
* Filter reviews of one pull request in memory instead of database to reduce ↵Lunny Xiao2025-01-073-31/+51
| | | | | | | | | | | | | | slow response because of lacking database index (#33106) This PR fixes a performance problem when reviewing a pull request in a big instance which have many records in the `review` table. Traditionally, we should add more indexes in that table. But since dismissed reviews of 1 pull request will not be too many as expected in a common repository. Filtering reviews in the memory should be more quick . --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix issue comment number (#30556)Lunny Xiao2024-12-303-5/+46
|
* Merge updatecommentattachment functions (#33044)Lunny Xiao2024-12-303-49/+41
| | | Extract from #32178
* Move SetMerged to service layer (#33045)Lunny Xiao2024-12-302-62/+3
| | | | No code change. Extract from #32178
* Refactor tests (#33021)wxiaoguang2024-12-292-4/+4
| | | | | | | | | | | | | | | | 1. fix incorrect tests, for example: BeanExists doesn't do assert and shouldn't be used 2. remove unnecessary test functions 3. introduce DumpQueryResult to help to see the database rows during test (at least I need it) ``` ====== DumpQueryResult: SELECT * FROM action_runner_token ====== - # row[0] id: 1 token: xeiWBL5kuTYxGPynHCqQdoeYmJAeG3IzGXCYTrDX owner_id: 0 ... ```
* Support org labels when adding labels by label names (#32988)Zettat1232024-12-261-0/+11
| | | Fix #32891
* Refactor "string truncate" (#32984)wxiaoguang2024-12-262-3/+3
|
* Use `CloseIssue` and `ReopenIssue` instead of `ChangeStatus` (#32467)Lunny Xiao2024-12-253-5/+54
| | | | | | | | | | | | | | The behaviors of closing issues and reopening issues are very different. So splitting it into two different functions makes it easier to maintain. - [x] Split ChangeIssueStatus into CloseIssue and ReopenIssue both at the service layer and model layer - [x] Rename `isClosed` to `CloseOrReopen` to make it more readable. - [x] Add transactions for ReopenIssue and CloseIssue --------- Co-authored-by: Zettat123 <zettat123@gmail.com>
* Enable tenv and testifylint rules (#32852)TheFox0x72024-12-159-17/+17
| | | | Enables tenv and testifylint linters closes: https://github.com/go-gitea/gitea/issues/32842
* Update golangci-lint to v1.62.2, fix issues (#32845)silverwind2024-12-151-3/+3
| | | Update it and fix new issues related to `redefines-builtin-id`
* Fix bug of branch/tag selector in the issue sidebar (#32744)hiifong2024-12-131-2/+5
| | | | | | | Fix: #32731 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add label/author/assignee filters to the user/org home issue list (#32779)wxiaoguang2024-12-113-25/+27
| | | | | | | | | | Replace #26661, fix #25979 Not perfect, but usable and much better than before. Since it is quite complex, I am not quite sure whether there would be any regression, if any, I will fix in first time. I have tested the related pages many times: issue list, milestone issue list, project view, user issue list, org issue list.
* Use batch database operations instead of one by one to optimze api pulls ↵Lunny Xiao2024-12-115-39/+147
| | | | | | | | | | | | | | | | | | | | (#32680) Resolve #31492 The response time for the Pull Requests API has improved significantly, dropping from over `2000ms` to about `350ms` on my local machine. It's about `6` times faster. A key area for further optimization lies in batch-fetching data for `apiPullRequest.ChangedFiles, apiPullRequest.Additions, and apiPullRequest.Deletions`. Tests `TestAPIViewPulls` does exist and new tests added. - This PR also fixes some bugs in `GetDiff` functions. - This PR also fixes data inconsistent in test data. For a pull request, the head branch's reference should be equal to the reference in `pull/xxx/head`.
* Issue time estimate, meaningful time tracking (#23113)Illya Marchenko2024-12-052-0/+31
| | | | | | | | | | | | | Redesign the time tracker side bar, and add "time estimate" support (in "1d 2m" format) Closes #23112 --------- Co-authored-by: stuzer05 <stuzer05@gmail.com> Co-authored-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix markup render regression and fix some tests (#32640)wxiaoguang2024-11-261-1/+1
| | | | | | | Fix #32639, https://github.com/go-gitea/gitea/issues/32608#issuecomment-2497918210 By the way, fix some incorrect SQLs (use single quote but not double quote)
* Strict pagination check (#32548)Lunny Xiao2024-11-257-8/+8
|
* Refactor markup render system (#32612)wxiaoguang2024-11-241-7/+3
| | | | | | | | | | This PR removes (almost) all path tricks, and introduces "renderhelper" package. Now we can clearly see the rendering behaviors for comment/file/wiki, more details are in "renderhelper" tests. Fix #31411 , fix #18592, fix #25632 and maybe more problems. (ps: fix #32608 by the way)
* Refactor markup render system (#32589)wxiaoguang2024-11-221-8/+6
| | | | This PR mainly moves some code and introduces `RenderContext.WithXxx` functions
* Trim title before insert/update to database to match the size requirements ↵Lunny Xiao2024-11-142-0/+5
| | | | | of database (#32498) Fix #32489
* Fix milestone deadline and date related problems (#32339)Lunny Xiao2024-11-051-2/+1
| | | | | | | | | Use zero instead of 9999-12-31 for deadline Fix #32291 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* refactor: remove redundant err declarations (#32381)Oleksandr Redko2024-10-301-2/+1
|
* chore: fix some function names in comment (#32300)wangjingcun2024-10-222-2/+2
| | | fix some function names in comment
* Allow filtering PRs by poster in the ListPullRequests API (#32209)65432024-10-071-0/+5
| | | | | | as title --- *Sponsored by Kithara Software GmbH*
* Fix the logic of finding the latest pull review commit ID (#32139)Zettat1232024-10-014-7/+7
| | | Fix #31423
* Display head branch more comfortable on pull request view (#32000)Lunny Xiao2024-09-241-0/+4
| | | | | | | | | | This PR do some minor improvements for head branch display on pull request view UI. - [x] Remove the link if the head branch has been deleted with a tooltip, so that users will not result in a 404 page - [x] Display a label if this pull request is an agit based one. ![图片](https://github.com/user-attachments/assets/872f26b6-f1cf-4427-9e41-e3a5b176dfa4)
* Resolve duplicate local string key related to PR comments (#32073)Kemal Zebari2024-09-181-1/+1
| | | | | | | A regression in #31924 caused there to be two `issues.review.comment` keys in the English language locale file, leading to a problem when reading PR review histories that contain comments. This snapshot addresses this by making the newer key unique.
* Add option to filter board cards by labels and assignees (#31999)Lauris BH2024-09-122-8/+21
| | | | | | | | | | | | | | | Works in both organization and repository project boards Fixes #21846 Replaces #21963 Replaces #27117 ![image](https://github.com/user-attachments/assets/1837ace8-3de2-444f-a153-e166bd0da2c0) **Note** that implementation was made intentionally to work same as in issue list so that URL can be bookmarked for quick access with predefined filters in URL
* Distinguish official vs non-official reviews, add tool tips, and upgr… ↵william-allspice2024-09-061-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#31924) This Pull Request is a follow up to https://github.com/go-gitea/gitea/pull/31886: 1. Adds a UI indicator between official (green) and unofficial (grey) approved pull requests on the Pull Request page (as suggested by @kdumontnu ) 2. Adds tooltips adding clarity to the type and status of a review on the Pull Request page (as suggested by @kdumontnu) 3. Updates text adding more clarity to required approvals (as suggested by @kdumontnu) 4. Updates text on the branch settings page explaining what branch approval limitations (as suggested by @yp05327) Official approval: <img width="376" alt="Screenshot 2024-08-26 at 1 03 52 PM" src="https://github.com/user-attachments/assets/500f083d-bfc0-45c5-82b7-b98e20495696"> Unofficial approval: <img width="442" alt="Screenshot 2024-08-26 at 12 53 15 PM" src="https://github.com/user-attachments/assets/e8c565ff-5886-4ce1-8b79-a0fa26c282f7"> Rejected approval: <img width="452" alt="Screenshot 2024-08-26 at 12 53 06 PM" src="https://github.com/user-attachments/assets/aebc0e2f-7052-4dea-8098-7caa0db86617"> Stale approval: <img width="546" alt="Screenshot 2024-08-26 at 1 07 59 PM" src="https://github.com/user-attachments/assets/da599ff3-e35c-4fa3-8141-ed80b738dd77"> Requested review tooltip: <img width="434" alt="Screenshot 2024-08-26 at 12 53 22 PM" src="https://github.com/user-attachments/assets/460d163e-8724-43b6-8760-34b285da8fe2"> Updated text for approvals: <img width="991" alt="Screenshot 2024-08-26 at 12 54 00 PM" src="https://github.com/user-attachments/assets/ab3ff012-9742-4c1b-933d-21addcb89f2c"> Updated text for allowlisted/whitelisted approvals: <img width="990" alt="Screenshot 2024-08-26 at 1 01 40 PM" src="https://github.com/user-attachments/assets/1a5bae61-d9e0-4d96-b86f-92610b0940d1"> Protected branch settings text: <img width="1022" alt="Screenshot 2024-08-26 at 1 01 14 PM" src="https://github.com/user-attachments/assets/892ce208-e1c2-41f7-8fec-46d5a0e7e776"> Comments list: <img width="1048" alt="Screenshot 2024-08-28 at 9 25 31 AM" src="https://github.com/user-attachments/assets/9c5c00c5-06cf-43b3-b413-4f7f673609b2"> --------- Co-authored-by: Kyle D. <kdumontnu@gmail.com>
* Add issue comment when moving issues from one column to another of the ↵Lunny Xiao2024-08-092-28/+51
| | | | | | | | | | | | | | | | | project (#29311) Fix #27278 Replace #27816 This PR adds a meta-comment for an issue when dragging an issue from one column to another of a project. <img width="600" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/5fc1d954-430e-4db0-aaee-a00006fa91f5"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: yp05327 <576951401@qq.com>
* Fix null requested_reviewer from API (#31773)Edip Emre Bodur2024-08-052-1/+52
| | | | | | | | If the assign the pull request review to a team, it did not show the members of the team in the "requested_reviewers" field, so the field was null. As a solution, I added the team members to the array. fix #31764