aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
Commit message (Collapse)AuthorAgeFilesLines
* Improve submodule relative path handling (#35056)wxiaoguang30 hours6-7/+6
| | | | | | | Fix #35054 --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Also display "recently pushed branch" alert on PR view (#35001)Naxdy5 days3-51/+77
| | | | | | | | | | | This commit adds the "You recently pushed to branch X" alert also to PR overview, as opposed to only the repository's home page. GitHub also shows this alert on the PR list, as well as the home page. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Rerun job only when run is done (#34970)NorthRealm9 days1-4/+4
| | | For consistency, limit rerunning Job(s) to only when Run is in Done status.
* Enable gocritic `equalFold` and fix issues (#34952)silverwind9 days1-1/+1
| | | | | | | Continuation of https://github.com/go-gitea/gitea/pull/34678. --------- Signed-off-by: silverwind <me@silverwind.io>
* Refactor webhook and fix feishu/lark secret (#34961)wxiaoguang10 days1-5/+2
|
* Fix git graph page (#34948)wxiaoguang11 days1-2/+5
| | | fix #34946
* Fix PR toggle WIP (#34920)wxiaoguang2025-07-011-0/+4
| | | | | | | Fix #34919 --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
* Follow file symlinks in the UI to their target (#28835)delvh2025-07-014-32/+62
| | | | | | | | | | Symlinks are followed when you click on a link next to an entry, either until a file has been found or until we know that the link is dead. When the link cannot be accessed, we fall back to the current behavior of showing the document containing the target. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add support for 3D/CAD file formats preview (#34794)Kerwin Bryant2025-06-306-215/+209
| | | | | | | Fix #34775 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Use standalone function to update repository cols (#34811)Lunny Xiao2025-06-261-17/+10
| | | | | | | | Extract `UpdateRepository` Follow up #34762 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor "change file" API (#34855)wxiaoguang2025-06-251-0/+6
| | | | | | | | | Follow up the "editor" refactor, use the same approach to simplify code, and fix some docs & comments --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* fix(issue): Replace stopwatch toggle with explicit start/stop actions (#34818)Junsik Kong2025-06-252-20/+29
| | | | | | | | | | | | | | | | This PR fixes a state de-synchronization bug with the issue stopwatch, it resolves the issue by replacing the ambiguous `/toggle` endpoint with two explicit endpoints: `/start` and `/stop`. - The "Start timer" button now exclusively calls the `/start` endpoint. - The "Stop timer" button now exclusively calls the `/stop` endpoint. This ensures the user's intent is clearly communicated to the server, eliminating the state inconsistency and fixing the bug. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix team permissions (#34827)wxiaoguang2025-06-242-2/+4
| | | | * Fix #34793 * Fix #33456
* Add "Cancel workflow run" button to Actions list page (#34817)NorthRealm2025-06-221-1/+1
|
* Edit file workflow for creating a fork and proposing changes (#34240)Brecht Van Lommel2025-06-228-69/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When viewing a file that the user can't edit because they can't write to the branch, the new, upload, patch, edit and delete functionality is no longer disabled. If no user fork of the repository exists, there is now a page to create one. It will automatically create a fork with a single branch matching the one being viewed, and a unique repository name will be automatically picked. When a fork exists, but it's archived, a mirror or the user can't write code to it, there will instead be a message explaining the situation. If the usable fork exists, a message will appear at the top of the edit page explaining that the changes will be applied to a branch in the fork. The base repository branch will be pushed to a new branch to the fork, and then the edits will be applied on top. The suggestion to fork happens when accessing /_edit/, so that for example online documentation can have an "edit this page" link to the base repository that does the right thing. Also includes changes to properly report errors when trying to commit to a new branch that is protected, and when trying to commit to an existing branch when choosing the new branch option. Resolves #9017, #20882 --------- Co-authored-by: Brecht Van Lommel <brecht@blender.org> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor wiki (#34805)wxiaoguang2025-06-222-144/+44
| | | Remove unclear code
* Forks repository list page follow other repositories page (#34784)Lunny Xiao2025-06-211-2/+3
| | | | | | | | | | | | Replace #24130 Before: ![image](https://github.com/user-attachments/assets/98c39bce-bdbf-4fc1-b476-527c5139e01f) After: ![image](https://github.com/user-attachments/assets/65fef5b8-63b9-4283-b8ea-2ac2f27cb001)
* Refactor editor (#34780)wxiaoguang2025-06-2110-1134/+650
| | | A complete rewrite
* Add workflow_run api + webhook (#33964)ChristopherHX2025-06-202-17/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements - https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#list-jobs-for-a-workflow-run--code-samples - https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#get-a-job-for-a-workflow-run--code-samples - https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository - https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run - `/actions/runs` for global + user + org (Gitea only) - `/actions/jobs` for global + user + org + repository (Gitea only) - workflow_run webhook + action trigger - limitations - workflow id is assigned to a string, this may result into problems in strongly typed clients Fixes - workflow_job webhook url to no longer contain the `runs/<run>` part to align with api - workflow instance does now use it's name inside the file instead of filename if set Refactoring - Moved a lot of logic from workflows/workflow_job into a shared module used by both webhook and api TODO - [x] Verify Keda Compatibility - [x] Edit Webhook API bug is resolved Closes https://github.com/go-gitea/gitea/issues/23670 Closes https://github.com/go-gitea/gitea/issues/23796 Closes https://github.com/go-gitea/gitea/issues/24898 Replaces https://github.com/go-gitea/gitea/pull/28047 and is much more complete --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add ff_only parameter to POST /repos/{owner}/{repo}/merge-upstream (#34770)Dan Čermák2025-06-191-1/+1
| | | | | | | | | The merge-upstream route was so far performing any kind of merge, even those that would create merge commits and thus make your branch diverge from upstream, requiring manual intervention via the git cli to undo the damage. With the new optional parameter ff_only, we can instruct gitea to error out, if a non-fast-forward merge would be performed.
* Fix tag target (#34781)wxiaoguang2025-06-191-3/+3
| | | Fix #34779
* Fix readme path and markdown link paste (#34755)wxiaoguang2025-06-181-2/+2
|
* Run `gopls modernize` on codebase (#34751)silverwind2025-06-1813-52/+18
| | | | Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
* Refactor some file edit related code (#34744)wxiaoguang2025-06-181-4/+11
| | | | | | | Follow up #34350 --------- Co-authored-by: delvh <dev.lh@web.de>
* Fix ghost user in feeds when pushing in an actions, it should be ↵Lunny Xiao2025-06-171-1/+1
| | | | gitea-actions (#34703)
* Support title and body query parameters for new PRs (#34537)endo0911engineer2025-06-171-1/+7
| | | | | | | | | | | | | | | | | | | | Currently, Gitea supports title and body query parameters when creating new issues, allowing pre-filling those fields via URL parameters. However, similar support for pull requests (PRs) does not exist. This feature adds support for the title, body, and quick_pull query parameters in the new pull request creation page. These parameters work similarly to GitHub’s behavior, allowing users to pre-populate the PR title and body, and optionally expand the PR creation form automatically. By supporting these query parameters, it improves the usability and automation capabilities when creating pull requests via direct URLs, aligning Gitea more closely with GitHub’s user experience. --------- Co-authored-by: root <root@DESKTOP-UPANUTP> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Replace update repository function in some places (#34566)Lunny Xiao2025-06-171-1/+6
| | | | | | | | | | | | `UpdateAllCols` is dangerous, the columns should be updated when necessary. This PR replaces some `updateRepository` invokes to reduce possible problems and wrongly updated time. Some parts have been fixed in #34388, but some are hidden in the function `updateRepository`. Alternatively, using `UpdateRepositoryColsNoAutoTime` to update the changed columns. Some `UpdateRepoSize` invokes are duplicated, so they will be removed when extracting from `updateRepository`.
* Allow renaming/moving binary/LFS files in the UI (#34350)bytedream2025-06-163-43/+41
| | | | | | | | | | | | | | | | | | | Adds the ability to rename/move binary files like binary blobs or images and files that are too large in the web ui. This was purposed in #24722, along with the ability edit images via an upload of a new image, which I didn't implement here (could be done in a separate PR). Binary file content: ![binary](https://github.com/user-attachments/assets/61d9ff71-25d3-4832-9288-452cdefc7283) File too large: ![toolarge](https://github.com/user-attachments/assets/3b42dbd0-e76a-4c3c-92d2-52ebffedea64) GitHub does the same (I've copied the text from there): ![gh](https://github.com/user-attachments/assets/e1499813-fb71-4544-9d58-086046a5f13e)
* Prevent duplicate form submissions when creating forks (#34714)Kerwin Bryant2025-06-161-13/+13
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Improve the performance when detecting the file editable (#34653)Lunny Xiao2025-06-121-32/+42
| | | | | | | | | | | | Noticed the SQL will be executed 4 times when visit the file render view page. For a repository which have many pull requests, it maybe slow. ```SQL 2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 2.004167ms 2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 1.03975ms 2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 881.583µs 2025/06/08 15:24:44 models/issues/pull_list.go:69:GetUnmergedPullRequestsByHeadInfo() [I] [SQL] SELECT * FROM `pull_request` INNER JOIN `issue` ON issue.id = pull_request.issue_id WHERE (head_repo_id = ? AND head_branch = ? AND has_merged = ? AND issue.is_closed = ? AND flow = ?) [393 main false false 0] - 935.084µs ``` This PR did a refactor to query it once only.
* Improve instance wide ssh commit signing (#34341)ChristopherHX2025-06-111-2/+2
| | | | | | | | | | | | | | | | | * Signed SSH commits can look in the UI like on GitHub, just like gpg keys today in Gitea * SSH format can be added in gitea config * SSH Signing worked before with DEFAULT_TRUST_MODEL=committer `TRUSTED_SSH_KEYS` can be a list of additional ssh public key contents to trust for every user of this instance Closes #34329 Related #31392 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix footnote jump behavior on the issue page. (#34621)charles2025-06-094-6/+21
| | | | | | | | | | Close #34511 Close #34590 Add comment ID to the footnote item's id attribute to ensure uniqueness. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Keeping consistent between UI and API about combined commit status state and ↵Lunny Xiao2025-06-092-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix some bugs (#34562) Extract from #34531 ## Move Commit status state to a standalone package Move the state from `structs` to `commitstatus` package. It also introduce `CommitStatusStates` so that the combine function could be used from UI and API logic. ## Combined commit status Changed This PR will follow Github's combined commit status. Before this PR, every commit status could be a combined one. According to https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#get-the-combined-status-for-a-specific-reference > Additionally, a combined state is returned. The state is one of: > failure if any of the contexts report as error or failure > pending if there are no statuses or a context is pending > success if the latest status for all contexts is success This PR will follow that rule and remove the `NoBetterThan` logic. This also fixes the inconsistent between UI and API. In the API convert package, it has implemented this which is different from the UI. It also fixed the missing `URL` and `CommitURL` in the API. ## `CalcCommitStatus` return nil if there is no commit statuses The behavior of `CalcCommitStatus` is changed. If the parameter commit statuses is empty, it will return nil. The reference places should check the returned value themselves.
* Validate hex colors when creating/editing labels (#34623)Kemal Zebari2025-06-072-47/+83
| | | | | | | | Resolves #34618. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix possible pull request broken when leave the page immediately after ↵Lunny Xiao2025-06-041-1/+4
| | | | | | | | | | clicking the update button (#34509) If user leaves the page, the context will become cancelled, so that the update process maybe terminal in an unexpected status. This PR haven't resolve the problem totally. It uses a background context to not cancel the update process even if the user leaved the pull request view page. Fix #31779
* Refactor some tests (#34580)wxiaoguang2025-06-031-21/+3
| | | | 1. use `test.MockVariableValue` as much as possible 2. avoid `time.Sleep` as much as possible
* Do not mutate incoming options to SearchRepositoryByName (#34553)Philip Peterson2025-06-022-2/+2
| | | | | | | | | | | | | | Similar to #34544, this PR changes the `opts` argument in `SearchRepositoryByName()` to be passed by value instead of by pointer, as its mutations do not escape the function scope and are not used elsewhere. This simplifies reasoning about the function and avoids unnecessary pointer usage. This insight emerged during an initial attempt to refactor `RenderUserSearch()`, which currently intermixes multiple concerns. --------- Co-authored-by: Philip Peterson <philip-peterson@users.noreply.github.com>
* Add "View workflow file" to Actions list page (#34538)NorthRealm2025-05-282-1/+31
| | | | | | | | | | This PR adds "View workflow file" to Actions list page, and replaces the redundant link. Related #34530 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Split GetLatestCommitStatus as two functions (#34535)Lunny Xiao2025-05-264-6/+6
| | | | | | | | Extract from #34531. This will reduce unnecessary count operation in databases. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* feat(api): add date range filtering to commit retrieval endpoints (#34497)Bo-Yi Wu2025-05-191-1/+1
| | | | | | | | | | | | | | | - Add support for filtering commits by date range via new "since" and "until" parameters - Update API endpoints and command logic to handle the new parameters for fetching commits within given dates - Extend API documentation and Swagger specs to describe the new "since" and "until" query parameters - Refactor related function signatures and implementations to accept and pass "since" and "until" values --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Fix Workflow run Not Found page (#34459)NorthRealm2025-05-141-4/+4
| | | | | Related: https://github.com/go-gitea/gitea/pull/34337#issuecomment-2863593738 https://github.com/go-gitea/gitea/pull/34337#discussion_r2086332493
* Add endpoint deleting workflow run (#34337)NorthRealm2025-05-133-1/+30
| | | | | | | | | | | Add endpoint deleting workflow run Resolves #26219 /claim #26219 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix repo broken check (#34444)wxiaoguang2025-05-131-3/+8
| | | Fix #34424
* Fix bug webhook milestone is not right. (#34419)Lunny Xiao2025-05-111-0/+10
| | | | | | | Fix #34400 --------- Co-authored-by: silverwind <me@silverwind.io>
* Only git operations should update `last changed` of a repository (#34388)Lunny Xiao2025-05-113-9/+3
| | | Try to fix #32046
* When updating comment, if the content is the same, just return and not ↵Lunny Xiao2025-05-111-11/+18
| | | | | update the databse (#34422) Fix #34318
* Refactor commit message rendering and fix bugs (#34412)wxiaoguang2025-05-091-5/+1
| | | | | | Fix #34398, fix #33308 Remove all `repo.ComposeCommentMetas` from templates, only use `repo` to render commit message.
* Fix only text/* being viewable in web UI (#34374)bytedream2025-05-061-1/+1
| | | | Regression from #34356, files like SVGs should be editable too (https://github.com/go-gitea/gitea/pull/34356#discussion_r2072766240).
* Fix bug when visiting comparation page (#34334)Lunny Xiao2025-05-042-13/+2
| | | | The `ci.HeadGitRepo` was opened and closed in the function `ParseCompareInfo` but reused in the function `PrepareCompareDiff`.
* Fix LFS files being editable in web UI (#34356)bytedream2025-05-041-8/+7
| | | | | It's possible to edit "raw" lfs files in the web UI when accessing the path manually. ![image](https://github.com/user-attachments/assets/62610e9e-24db-45ec-ad04-28062073164c)