aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
Commit message (Collapse)AuthorAgeFilesLines
* Improve ObjectFormat interface (#28496)Lunny Xiao2023-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The 4 functions are duplicated, especially as interface methods. I think we just need to keep `MustID` the only one and remove other 3. ``` MustID(b []byte) ObjectID MustIDFromString(s string) ObjectID NewID(b []byte) (ObjectID, error) NewIDFromString(s string) (ObjectID, error) ``` Introduced the new interfrace method `ComputeHash` which will replace the interface `HasherInterface`. Now we don't need to keep two interfaces. Reintroduced `git.NewIDFromString` and `git.MustIDFromString`. The new function will detect the hash length to decide which objectformat of it. If it's 40, then it's SHA1. If it's 64, then it's SHA256. This will be right if the commitID is a full one. So the parameter should be always a full commit id. @AdamMajer Please review.
* Only check online runner when detecting matching runners in workflows (#28286)yp053272023-12-181-1/+3
| | | | | | | | | | | Mentioned: [#28277](https://github.com/go-gitea/gitea/issues/28277#issuecomment-1831325276) We should only check online runner when detecting matching runners in workflows, as if runner is not online, the workflow will not run. ![image](https://github.com/go-gitea/gitea/assets/18380374/11855e9d-7241-4b7a-b8d7-49dbb94ba1c5)
* Add option to disable ambiguous unicode characters detection (#28454)wxiaoguang2023-12-172-14/+13
| | | | | | | | * Close #24483 * Close #28123 * Close #23682 * Close #23149 (maybe more)
* Adjust object format interface (#28469)Lunny Xiao2023-12-175-16/+16
| | | | | | | - Remove `ObjectFormatID` - Remove function `ObjectFormatFromID`. - Use `Sha1ObjectFormat` directly but not a pointer because it's an empty struct. - Store `ObjectFormatName` in `repository` struct
* Abstract hash function usage (#28138)Adam Majer2023-12-138-12/+34
| | | | | | Refactor Hash interfaces and centralize hash function. This will allow easier introduction of different hash function later on. This forms the "no-op" part of the SHA256 enablement patch.
* Second part of refactor `db.Find` (#28194)Lunny Xiao2023-12-112-17/+10
| | | Continue of #27798 and move more functions to `db.Find` and `db.Count`.
* Fix commit status in repo list (#28412)yp053272023-12-111-1/+1
| | | | | | | | | | | | | | | Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/00edf23a-aee1-4177-a12c-bd03ae14e65e) ![image](https://github.com/go-gitea/gitea/assets/18380374/0663e443-682c-4a68-b14e-a0fa0e4c3716) `TestOrg/testactions` does have commit status, but won't display in `All` After: ![image](https://github.com/go-gitea/gitea/assets/18380374/7231db29-9c4e-484f-afa2-87db19be19b8) Same to #26179.
* Fix missing check (#28406)Lunny Xiao2023-12-102-4/+24
|
* Also sync DB branches on push if necessary (#28361)Lunny Xiao2023-12-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix #28056 This PR will check whether the repo has zero branch when pushing a branch. If that, it means this repository hasn't been synced. The reason caused that is after user upgrade from v1.20 -> v1.21, he just push branches without visit the repository user interface. Because all repositories routers will check whether a branches sync is necessary but push has not such check. For every repository, it has two states, synced or not synced. If there is zero branch for a repository, then it will be assumed as non-sync state. Otherwise, it's synced state. So if we think it's synced, we just need to update branch/insert new branch. Otherwise do a full sync. So that, for every push, there will be almost no extra load added. It's high performance than yours. For the implementation, we in fact will try to update the branch first, if updated success with affect records > 0, then all are done. Because that means the branch has been in the database. If no record is affected, that means the branch does not exist in database. So there are two possibilities. One is this is a new branch, then we just need to insert the record. Another is the branches haven't been synced, then we need to sync all the branches into database.
* Fix object does not exist error when checking citation file (#28314)yp053272023-12-061-13/+6
| | | | | | | Fix #28264 `DataAsync()` will be called twice. Caused by https://github.com/go-gitea/gitea/pull/27958. I'm sorry, I didn't completely remove all unnecessary codes.
* Fix the runs will not be displayed bug when the main branch have no ↵Lunny Xiao2023-12-061-0/+1
| | | | workflows but other branches have (#28359)
* Read `previous` info from git blame (#28306)KN4CK3R2023-12-011-30/+8
| | | | | | | Fixes #28280 Reads the `previous` info from the `git blame` output instead of calculating it afterwards.
* Add missing variable in tag list (#28305)JakobDev2023-11-301-0/+1
| | | | | | | | | | | This fixes a regression from #25859 If a tag has no Release, Gitea will show a Link to create a Release for the Tag if the User has the Permission to do this, but the variable to indicate that is no longer set. Used here: https://github.com/go-gitea/gitea/blob/1bfcdeef4cca0f5509476358e5931c13d37ed1ca/templates/repo/tag/list.tmpl#L39-L41
* Fix issue will be detected as pull request when checking `First-time ↵yp053272023-11-271-1/+1
| | | | | contributor` (#28237) Fix #28224
* Fix comment permissions (#28213)Lunny Xiao2023-11-254-9/+54
| | | | This PR will fix some missed checks for private repositories' data on web routes and API routes.
* Use db.Find instead of writing methods for every object (#28084)Lunny Xiao2023-11-246-32/+39
| | | | For those simple objects, it's unnecessary to write the find and count methods again and again.
* Revert "Fix EOL handling in web editor" (#28101)Nanguan Lin2023-11-221-1/+1
| | | | Reverts go-gitea/gitea#27141 close #28097
* Add edit option for README.md (#28071)JakobDev2023-11-201-0/+4
| | | | | | | Fix #28059 ![grafik](https://github.com/go-gitea/gitea/assets/15185051/07adc216-954e-486b-bfda-df3bc15f2089)
* Fix viewing wiki commit on empty repo (#28040)JakobDev2023-11-141-1/+0
| | | | | Fixes https://codeberg.org/forgejo/forgejo/issues/1758 For some weird reason we need to cast this nil.
* Fix citation error when the file size is larger than 1024 bytes (#27958)yp053272023-11-081-5/+2
| | | | | | Mentioned in: https://github.com/go-gitea/gitea/pull/27931#issuecomment-1798016960 Same to #25131, so use the same method to fix this problem.
* Fix http protocol auth (#27875)Lunny Xiao2023-11-022-0/+0
|
* Allow pull requests Manually Merged option to be used by non-admins (#27780)Brecht Van Lommel2023-10-301-3/+5
| | | | | | | | | | | | Currently this feature is only available to admins, but there is no clear reason why. If a user can actually merge pull requests, then this seems fine as well. This is useful in situations where direct pushes to the repository are commonly done by developers. --------- Co-authored-by: delvh <dev.lh@web.de>
* Upgrade to golangci-lint@v1.55.0 (#27756)silverwind2023-10-243-9/+6
| | | https://github.com/golangci/golangci-lint/releases/tag/v1.55.0
* Fix `link-action` redirect network error (#27734)Nanguan Lin2023-10-232-6/+8
| | | | | | | | <img width="823" alt="image" src="https://github.com/go-gitea/gitea/assets/70063547/99da3d5a-c28a-4fd0-8ae0-88461a9142e2"> --------- Co-authored-by: 6543 <6543@obermui.de>
* Show total TrackedTime on issue/pull/milestone lists (#26672)65432023-10-191-36/+42
| | | | | | | | | | | | | | TODOs: - [x] write test for `GetIssueTotalTrackedTime` - [x] frontport kitharas template changes and make them mobile-friendly --- ![image](https://github.com/go-gitea/gitea/assets/24977596/6713da97-201f-4217-8588-4c4cec157171) ![image](https://github.com/go-gitea/gitea/assets/24977596/3a45aba8-26b5-4e6a-b97d-68bfc2bf9024) --- *Sponsored by Kithara Software GmbH*
* Improve the list header in milestone page (#27302)yp053272023-10-182-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ui of list header in milestone page is not same as issue and pr list page. And they are using different template codes which can be merged into one. Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/29eb426c-2dd6-4cf2-96e0-82339fb631bb) ![image](https://github.com/go-gitea/gitea/assets/18380374/b36c4dff-469a-4395-8a02-a8c54e17ab21) ![image](https://github.com/go-gitea/gitea/assets/18380374/d882c74a-451b-431d-b58e-3635a15d9718) ![image](https://github.com/go-gitea/gitea/assets/18380374/292cd38d-1b50-47f1-b32c-9b5de90ce5fb) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/4529234e-67dc-4e17-9440-e638be4fbc41) ![image](https://github.com/go-gitea/gitea/assets/18380374/c15b4d86-0762-497b-b28d-72d09443d629) --------- Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com>
* Final round of `db.DefaultContext` refactor (#27587)JakobDev2023-10-148-18/+18
| | | Last part of #27065
* Replace ajax with fetch, improve image diff (#27267)silverwind2023-10-111-10/+17
| | | | | | | | | | | 1. Dropzone attachment removal, pretty simple replacement 2. Image diff: The previous code fetched every image twice, once via `img[src]` and once via `$.ajax`. Now it's only fetched once and a second time only when necessary. The image diff code was partially rewritten. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Penultimate round of `db.DefaultContext` refactor (#27414)JakobDev2023-10-1112-36/+36
| | | | | | | Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Remove redundant `len` check around loop (#27464)Eng Zer Jun2023-10-061-4/+2
| | | | | | | | | | | | | | | | | | | | This pull request is a minor code cleanup. From the Go specification (https://go.dev/ref/spec#For_range): > "1. For a nil slice, the number of iterations is 0." > "3. If the map is nil, the number of iterations is 0." `len` returns 0 if the slice or map is nil (https://pkg.go.dev/builtin#len). Therefore, checking `len(v) > 0` before a loop is unnecessary. --- At the time of writing this pull request, there wasn't a lint rule that catches these issues. The closest I could find is https://staticcheck.dev/docs/checks/#S103 Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* When comparing with an non-exist repository, return 404 but 500 (#27437)Lunny Xiao2023-10-041-1/+3
|
* Even more `db.DefaultContext` refactor (#27352)JakobDev2023-10-0312-23/+23
| | | | | | | | Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Differentiate between `push` and `pull` `mirror sync in progress` (#27390)delvh2023-10-021-2/+2
| | | | | | | | | | | Previously, if you had both a push and a pull mirror, the message did not clarify if you've accidentally synchronized the wrong one. Additionally fixed two typos that were encountered while debugging. ## Screenshots ![grafik](https://github.com/go-gitea/gitea/assets/51889757/164d5d20-728d-4365-9cb5-c37e95857cdf) ![grafik](https://github.com/go-gitea/gitea/assets/51889757/90bfffd2-abd4-4847-b8e2-db4231700a6d)
* Document the line-number counting behavior (#27386)wxiaoguang2023-10-021-2/+7
| | | Ref #27377
* Hide archived labels when filtering by labels on the issue list (#27115)puni98692023-10-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Followup https://github.com/go-gitea/gitea/pull/26820 ## Archived labels UI for issue filter and issue filter actions for issues/pull request pages. Changed: * Enhanced the Issue filter and Issue filter actions UI page to seamlessly incorporate a list of archived labels. * Pagination functionality is same as before. If archived label checkbox is checked then we are adding a query string`archived=true` in the url to save the state of page. * Issue filter actions menu is separated into different template. * Adding the archived flag in issue url labels. * Pull Request page is also work the same. Outsourced: * Defer the implementation of specialized handling for archived labels to upcoming pull requests. This step will be undertaken subsequent to the successful merge of this pull request. Screenshots ### Issue page <img width="1360" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/d7efb2ef-5b2b-449d-83f0-d430a32ec432"> ### Issue page with label filter on archived label checkbox when not checked --> No archived label is there in list <img width="1249" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/ceea68ef-91f2-4693-910f-2e25e236bfc9"> ### Issue page with label filter on archived label checkbox when checked --> Show archived label in the list. <img width="710" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/2414d26b-2079-4c3c-bd9e-f2f5411bcabf"> ### Issue page with label filter on issue action menu on archived label checkbox when checked --> Show archived label in the list. <img width="409" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/259cac87-3e21-4778-99a2-a6a0b8c81178"> ### Applied the archived=true in Issue labels when archived checkbox is checked. <img width="984" alt="image" src="https://github.com/go-gitea/gitea/assets/80308335/657ce3db-c0ae-402e-b12d-3b580d3c2ed0"> --- Part of https://github.com/go-gitea/gitea/issues/25237 --------- Signed-off-by: puni9869 <punitinani1@hotmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Fix repo count in org action settings (#27245)yp053272023-09-293-0/+18
| | | | | | | | | | | | | | | | | | | | | | Only in org action settings, repo count is missing Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/4a74c090-c55f-4f06-810a-c390337efa9d) ![image](https://github.com/go-gitea/gitea/assets/18380374/e234f7e7-178c-4186-bbc0-0f291192b011) ![image](https://github.com/go-gitea/gitea/assets/18380374/c1db70cd-973b-40d5-ba17-1f354aed9149) In other setting page: ![image](https://github.com/go-gitea/gitea/assets/18380374/43bfec6b-a1a4-48a9-8280-ab6f967b7ec4) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/9a697bd8-ce9f-40e2-8749-b46726d68d84) ![image](https://github.com/go-gitea/gitea/assets/18380374/3b6d1e59-64dd-4655-953b-064718e6aa7a) ![image](https://github.com/go-gitea/gitea/assets/18380374/5604c063-556c-4252-8778-4e5a5e23b7e1)
* rename TotalTimes() to TotalTimesForEachUser() (#27261)65432023-09-291-2/+2
| | | | | | | make function name more descriptive as it would otherwise imply it could be used for e.g. #26672 too ... --- *Sponsored by Kithara Software GmbH*
* More `db.DefaultContext` refactor (#27265)JakobDev2023-09-297-28/+28
| | | | | | | Part of #27065 This PR touches functions used in templates. As templates are not static typed, errors are harder to find, but I hope I catch it all. I think some tests from other persons do not hurt.
* Improve tree not found page (#26570)yp053272023-09-294-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | Before: ![before](https://github.com/go-gitea/gitea/assets/18380374/383822d5-7d77-4ec3-b49b-4ab1e8b167ce) After: ![after](https://github.com/go-gitea/gitea/assets/18380374/32afa0a3-fa05-4087-b96e-7d067f0ed756) In Github: https://github.com/yp05327/test/blob/main/test.drawio Updated: UI changed ![image](https://github.com/go-gitea/gitea/assets/18380374/41ed07ff-b815-4b4e-9779-5ab36b5f3980) ![image](https://github.com/go-gitea/gitea/assets/18380374/5d7b28d6-a2fc-4d4c-8d6d-d93f9c9a270b) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add support for forking single branch (#25821)Dmitry Sharshakov2023-09-291-3/+19
| | | | | | | | | | | | | | | | Fixes #25117 Add UI for choosing branch to fork Change default branch on single-branch forks ![image](https://github.com/go-gitea/gitea/assets/19504461/28505f69-a9a2-43a8-8b19-a0cdac3ddc5a) --------- Co-authored-by: Denys Konovalov <kontakt@denyskon.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improvements of releases list and tags list (#25859)Zettat1232023-09-282-50/+63
| | | | | | | | | | | | | | | | | | Follow #23465 and #25624 This PR introduces the following improvements: - We do not need to call `GetTags` to get tags because tags have been loaded by `RepoAssignment` https://github.com/go-gitea/gitea/blob/ef90fdbd1d7e1f62ed5bf18757e00e97817eb602/modules/context/repo.go#L663-L668 - Similarly, the number of tags and releases also have been loaded by `RepoAssignment`, so the related code has been removed from the handlers. The query condition of `GetReleaseCountByRepoID` in `RepoAssignment` has been changed to include draft releases. https://github.com/go-gitea/gitea/blob/ef90fdbd1d7e1f62ed5bf18757e00e97817eb602/modules/context/repo.go#L538-L551 - `releasesOrTags` function has been removed. The code for rendering releases list and tags list moved to `Releases` and `TagList` respectively.
* Improve issue history dialog and make poster can delete their own history ↵wxiaoguang2023-09-281-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#27323) Fix #27313 (see the comment) And some UI improvements: ### Before ![image](https://github.com/go-gitea/gitea/assets/2114189/420a314d-8f34-4e30-a557-f41cf4f0d2f2) ![image](https://github.com/go-gitea/gitea/assets/2114189/60ca0be4-b55e-4e65-be73-fd53e0d4fc36) ### After ![image](https://github.com/go-gitea/gitea/assets/2114189/d354f815-5a0c-4e63-8d59-d03ed344dbea) ![image](https://github.com/go-gitea/gitea/assets/2114189/6ef437a4-aa6f-4917-a260-00625ee71e79) ![image](https://github.com/go-gitea/gitea/assets/2114189/9d88a36c-616b-4dc9-8c6b-76adaad8acf6)
* make writing main test easier (#27270)Lunny Xiao2023-09-282-8/+2
| | | | | | | | | This PR removed `unittest.MainTest` the second parameter `TestOptions.GiteaRoot`. Now it detects the root directory by current working directory. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Another round of `db.DefaultContext` refactor (#27103)JakobDev2023-09-254-17/+17
| | | | | | | Part of #27065 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix EOL handling in web editor (#27141)silverwind2023-09-241-1/+1
| | | | | | | | | Fixes https://github.com/go-gitea/gitea/issues/27136. This does the following for Monaco's EOL setting: 1. Use editorconfig setting if present 2. Use the file's dominant line ending as detected by monaco, which uses LF for empty file
* Updates to the API for archived repos (#27149)JakobDev2023-09-211-1/+1
|
* Search branches (#27055)Lunny Xiao2023-09-171-1/+4
| | | | | | | | | Resolve #25233 <img width="1315" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/3ba59b58-471a-4e1b-985c-87edac2268c0"> <img width="1297" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/b6caa12f-323b-4f70-9c44-ef91cb71a26c">
* Support `.git-blame-ignore-revs` file (#26395)KN4CK3R2023-09-161-22/+69
| | | | | | | | | | | | | | | | | Closes #26329 This PR adds the ability to ignore revisions specified in the `.git-blame-ignore-revs` file in the root of the repository. ![grafik](https://github.com/go-gitea/gitea/assets/1666336/9e91be0c-6e9c-431c-bbe9-5f80154251c8) The banner is displayed in this case. I intentionally did not add a UI way to bypass the ignore file (same behaviour as Github) but you can add `?bypass-blame-ignore=true` to the url manually. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add `RemoteAddress` to mirrors (#26952)KN4CK3R2023-09-162-15/+20
| | | | | This PR adds a new field `RemoteAddress` to both mirror types which contains the sanitized remote address for easier (database) access to that information. Will be used in the audit PR if merged.
* Next round of `db.DefaultContext` refactor (#27089)JakobDev2023-09-1612-39/+39
| | | Part of #27065