aboutsummaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Allow everyone to read or write a wiki by a repo unit setting (#30495)wxiaoguang2024-04-174-8/+10
| | | | | Replace #6312 Help #5833 Wiki solution for #639
* Fix branch_protection api shows users/teams who has no readAccess (#30291)Edward Zhang2024-04-171-21/+35
| | | | | | | | | | | | Add some logic in `convert.ToBranchProtection` to return only the names associated with readAccess instead of returning all names. This will ensure consistency in behavior between the frontend and backend. Fixes: #27694 --------- Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wenzhuo.zhang <wenzhuo.zhang@geely.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor web routes (#30519)wxiaoguang2024-04-172-17/+12
| | | | | | | Re-organize the routes in web.go and use ctx constants instead of `context.UnitTypes()` --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Update API to return 'source_id' for users (#29718)Tobias Balle-Petersen2024-04-161-0/+1
| | | | | | | Using the API, a user's _source_id_ can be set in the _CreateUserOption_ model, but the field is not returned in the _User_ model. This PR updates the _User_ model to include the field _source_id_ (The ID of the Authentication Source).
* Fix code owners will not be mentioned when a pull request comes from a ↵Lunny Xiao2024-04-151-4/+4
| | | | | | forked repository (#30476) Fix #30277 Caused by #29783
* Rewrite and restyle reaction selector and enable no-sizzle eslint rule (#30453)silverwind2024-04-141-0/+1
| | | | | | | | | | | Enable `no-sizzle` lint rule, there was only one use in `initCompReactionSelector` and: - Remove all jQuery except the necessary fomantic dropdown init - Remove the recursion, instead bind event listeners to common parent container nodes --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* fix: Fix to delete cookie when AppSubURL is non-empty (#30375)Jonathan Tran2024-04-141-1/+2
| | | | | | | | Cookies may exist on "/subpath" and "/subpath/" for some legacy reasons (eg: changed CookiePath behavior in code). The legacy cookie should be removed correctly. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Add `interface{}` to `any` replacement to `make fmt`, exclude `*.pb.go` (#30461)silverwind2024-04-131-1/+1
| | | | | | | Since https://github.com/go-gitea/gitea/pull/25686, a few `interface{}` have sneaked into the codebase. Add this replacement to `make fmt` to prevent this from happening again. Ideally a linter would do this, but I haven't found any suitable.
* Avoid losing token when updating mirror settings (#30429)Jason Song2024-04-131-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix #30416. Before (it shows as "Unset" while there's a token): <img width="980" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a"> After: <img width="977" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5"> The username shows as "oauth2" because of https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99 I have checked that all usage of `MirrorRemoteAddress` has been updated. <img width="1806" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d"> However, it needs to be checked again when backporting. --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor cache and disable go-chi cache (#30417)wxiaoguang2024-04-137-48/+34
| | | use built-in cache package to wrap external go-chi cache package
* Fix mirror error when mirror repo is empty (#30432)yp053272024-04-131-17/+23
| | | | | Fix #30424 Co-authored-by: Giteabot <teabot@gitea.io>
* Fix commit status cache which missed target_url (#30426)Lunny Xiao2024-04-121-11/+41
| | | | | | | Fix #30421 --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Change the default maxPerPage for gitbucket (#30392)Kazushi (Jam) Marukawa2024-04-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | This patch improves the migration from gitbucket to gitea. The gitbucket uses it's own internal perPage value (= 25) for paging and ignore per_page arguments in the requested URL. This cause gitea to migrate only 25 issues and 25 PRs from gitbucket repository. This may not happens on old gitbucket. But recent gitbucket 4.40 or 4.38.4 has this problem. This patch change to use this internally hardcoded perPage of gitbucket as gitea's maxPerPage numer when migrating from gitbucket. There are several perPage values in gitbucket like 25 for Isseus/PRs and 10 for Releases. Some of those API doesn't support paging yet. It sounds difficult to implement, but using the minimum number among them worked out very well. So, I use 10 in this patch. Brief descriptions of problems and this patch are also available in https://github.com/go-gitea/gitea/issues/30316. In addition, I'm not sure what kind of test cases are possible to write here. It's a test for migration, so it requires testing gitbucket server and gitea server, I guess. Please let me know if it is possible to write such test cases here. Thanks!
* Add commit status summary table to reduce query from commit status table ↵Lunny Xiao2024-04-122-19/+49
| | | | | | | | | | | | (#30223) This PR adds a new table named commit status summary to reduce queries from the commit status table. After this change, commit status summary table will be used for the final result, commit status table will be for details. --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Check the token's owner and repository when registering a runner (#30406)Zettat1232024-04-112-0/+2
| | | Fix #30378
* Avoid user does not exist error when detecting schedule actions when the ↵yp053272024-04-111-6/+3
| | | | | | | | | | | | | | | | commit author is an external user (#30357) ![image](https://github.com/go-gitea/gitea/assets/18380374/ddf6ee84-2242-49b9-b066-bd8429ba4d76) When repo is a mirror, and commit author is an external user, then `GetUserByEmail` will return error. reproduce/test: - mirror Gitea to your instance - disable action and enable it again, this will trigger `DetectAndHandleSchedules` ps: also follow #24706, it only fixed normal runs, not scheduled runs.
* Performance optimization for git push (#30104)Lunny Xiao2024-04-091-9/+17
| | | | | Agit returned result should be from `ProcReceive` hook but not `PostReceive` hook. Then for all non-agit pull requests, it will not check the pull requests for every pushing `refs/pull/%d/head`.
* Fix missed doer (#30231)Lunny Xiao2024-04-085-34/+34
| | | | | Fix #29879 Co-authored-by: Giteabot <teabot@gitea.io>
* Add optional doctor storage init (#30330)Michael Kriese2024-04-081-0/+11
| | | Add optional storage init to doctor
* Avoid showing `Failed to change the default wiki branch` if repo has no wiki ↵yp053272024-04-081-0/+4
| | | | when saving repo settings (#30329)
* Fix oauth2 builtin application logic (#30304)wxiaoguang2024-04-083-11/+79
| | | | | | Fix #29074 (allow to disable all builtin apps) and don't make the doctor command remove the builtin apps. By the way, rename refobject and joincond to camel case.
* Clean up log messages (#30313)wxiaoguang2024-04-076-14/+14
| | | | | | `log.Xxx("%v")` is not ideal, this PR adds necessary context messages. Remove some unnecessary logs. Co-authored-by: Giteabot <teabot@gitea.io>
* Fix code block style for code preview (#30298)wxiaoguang2024-04-061-3/+3
| | | | | Fix #30292 To avoid unnecessary style overriding, use "div" instead of "code"
* Commit-Dropdown: Show Author of commit if available (#30272)sebastian-sauer2024-04-051-4/+4
| | | | | | | | | | | | | | | As in commits page we show the author of the commit in the commits dropdown and not the committer. Commits Page: ![Screenshot from 2024-04-03 22-34-41](https://github.com/go-gitea/gitea/assets/1135157/1c7c5c19-6d0a-4176-8a87-7bca6a0c6dc8) and the same contents in our dropdown: ![image](https://github.com/go-gitea/gitea/assets/1135157/aa094af2-c369-47ac-9c27-ca208d1d03f0) fixes #29588
* Render embedded code preview by permlink in markdown (#30234)wxiaoguang2024-04-025-1/+204
| | | | | The permlink in markdown will be rendered as a code preview block, like GitHub Co-authored-by: silverwind <me@silverwind.io>
* Remove scheduled action tasks if the repo is archived (#30224)Zettat1232024-04-012-2/+7
| | | Fix #30220
* Refactor DeleteInactiveUsers, fix bug and add tests (#30206)wxiaoguang2024-04-012-25/+45
| | | | | | | | | 1. check `IsActive` before calling `IsLastAdminUser`. 2. Fix some comments and error messages. 3. Don't `return err` if "removing file" fails in `DeleteUser`. 4. Remove incorrect `DeleteInactiveEmailAddresses`. Active users could also have inactive emails, and inactive emails do not support "olderThan" 5. Add tests
* Add API for `Variables` (#29520)sillyguodong2024-03-281-0/+100
| | | | | | | close #27801 --------- Co-authored-by: silverwind <me@silverwind.io>
* Prevent re-review and dismiss review actions on closed and merged PRs (#30065)Kemal Zebari2024-03-282-0/+81
| | | | | | | | | | | | | | | | | | | Resolves #29965. --- Manually tested this by: - Following the [installation](https://docs.gitea.com/next/installation/install-with-docker#basics) guide (but built a local Docker image instead) - Creating 2 users, one who is the `Owner` of a newly-created repository and the other a `Collaborator` - Had the `Collaborator` create a PR that the `Owner` reviews - `Collaborator` resolves conversation and `Owner` merges PR And with this change we see that we can no longer see re-request review button for the `Owner`: <img width="1351" alt="Screenshot 2024-03-25 at 12 39 18 AM" src="https://github.com/go-gitea/gitea/assets/60799661/bcd9c579-3cf7-474f-a51e-b436fe1a39a4">
* Put an edit file button on pull request files to allow a quick operation ↵Lunny Xiao2024-03-271-0/+19
| | | | | | | | | | | | | | | | | | | | (#29697) Resolve #23848 This PR put an edit file button on pull request files to allow a quick edit for a file. After the edit finished, it will return back to the viewed file position on pull request files tab. It also use a branch view file link instead of commit link when it's a non-commit pull request files view. <img width="1532" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/3637ca4c-89d5-4621-847b-79702a44f617"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Fix possible data race on tests (#30093)Lunny Xiao2024-03-261-1/+0
|
* Fix duplicate migrated milestones (#30102)yp053272024-03-261-2/+1
| | | Fix #17567
* Fix gitea doctor will remove repo-avatar files when execute command ↵yp053272024-03-261-1/+1
| | | | | `storage-archives` (#30094) Fix #30037
* Fix panic for `fixBrokenRepoUnits16961` (#30068)yp053272024-03-261-0/+6
| | | ![image](https://github.com/go-gitea/gitea/assets/18380374/508b3ceb-f53d-4d3b-a781-97c1542af1cb)
* Fix Add/Remove WIP on pull request title failure (#29999)Lunny Xiao2024-03-252-21/+20
| | | Fix #29997
* Migrate margin and padding helpers to tailwind (#30043)silverwind2024-03-243-4/+4
| | | | | | | | | | | | | This will conclude the refactor of 1:1 class replacements to tailwind, except `gt-hidden`. Commands ran: ```bash perl -p -i -e 's#gt-(p|m)([lrtbxy])?-0#tw-$1$2-0#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-1#tw-$1$2-0.5#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-2#tw-$1$2-1#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-3#tw-$1$2-2#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-4#tw-$1$2-4#g' {web_src/js,templates,routers,services}/**/* perl -p -i -e 's#gt-(p|m)([lrtbxy])?-5#tw-$1$2-8#g' {web_src/js,templates,routers,services}/**/* ```
* Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} (#29995)Lunny Xiao2024-03-225-16/+10
|
* Fix some pending problems (#29985)wxiaoguang2024-03-222-8/+7
| | | | | | | | | | | | | | | | | These changes are quite independent and trivial, so I don't want to open too many PRs. * https://github.com/go-gitea/gitea/pull/29882#discussion_r1529607091 * the `f.Close` should be called properly * the error message could be more meaningful (https://github.com/go-gitea/gitea/pull/29882#pullrequestreview-1942557935) * https://github.com/go-gitea/gitea/pull/29859#pullrequestreview-1942324716 * the new translation strings don't take arguments * https://github.com/go-gitea/gitea/pull/28710#discussion_r1443778807 * stale for long time * #28140 * a form was forgotten to be changed to work with backend code
* Fix bugs in rerunning jobs (#29955)Zettat1232024-03-222-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix #28761 Fix #27884 Fix #28093 ## Changes ### Rerun all jobs When rerun all jobs, status of the jobs with `needs` will be set to `blocked` instead of `waiting`. Therefore, these jobs will not run until the required jobs are completed. ### Rerun a single job When a single job is rerun, its dependents should also be rerun, just like GitHub does (https://github.com/go-gitea/gitea/issues/28761#issuecomment-2008620820). In this case, only the specified job will be set to `waiting`, its dependents will be set to `blocked` to wait the job. ### Show warning if every job has `needs` If every job in a workflow has `needs`, all jobs will be blocked and no job can be run. So I add a warning message. <img src="https://github.com/go-gitea/gitea/assets/15528715/88f43511-2360-465d-be96-ee92b57ff67b" width="480px" />
* Refactor external URL detection (#29973)wxiaoguang2024-03-221-0/+27
| | | | Follow #29960, `IsExternalURL` is not needed anymore. Add some tests for `RedirectToCurrentSite`
* Performance improvements for pull request list page (#29900)Lunny Xiao2024-03-212-4/+5
| | | | | | | | | | | This PR will avoid load pullrequest.Issue twice in pull request list page. It will reduce x times database queries for those WIP pull requests. Partially fix #29585 --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor URL detection (#29960)wxiaoguang2024-03-211-3/+3
| | | "Redirect" functions should only redirect if the target is for current Gitea site.
* Fix the bug that user may logout if he switch pages too fast (#29962)Lunny Xiao2024-03-211-17/+9
| | | | | | | | | | | | This PR fixed a bug when the user switching pages too fast, he will logout automatically. The reason is that when the error is context cancelled, the previous code think user hasn't login then the session will be deleted. Now it will return the errors but not think it's not login. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Cancel previous runs of the same PR automatically (#29961)Jason Song2024-03-213-11/+11
| | | | | | | | | | | Follow #25716. Also cancel previous runs for `pull_request_sync`. It's not a bug since it original PR said "if the event is push". The main change is https://github.com/go-gitea/gitea/pull/29961/files#diff-08adda3f8ae0360937f46abb1f4418603bd3518522baa356be11c6c7ac4abcc3. And also rename `CancelRunningJobs` to `CancelPreviousJobs` to make it more clear.
* Fix loadOneBranch panic (#29938)wxiaoguang2024-03-201-4/+6
| | | | | | Try to fix #29936 Far from ideal, but still better than panic.
* Restore deleted branches when syncing (#29898)Jason Song2024-03-201-2/+2
| | | | | | | | | | | Regression of #29493. If a branch has been deleted, repushing it won't restore it. Lunny may have noticed that, but I didn't delve into the comment then overlooked it: https://github.com/go-gitea/gitea/pull/29493#discussion_r1509046867 The additional comments added are to explain the issue I found during testing, which are unrelated to the fixes.
* Fix invalid link of the commit status when ref is tag (#29752)yp053272024-03-191-3/+13
| | | | | | | | | | Fix #29731 Caused by #24634 Also remove fixme. ps: we can not fix the existed runs, as wrong refs are all recorded in DB, and we can not know whether they are branch or tag: ![image](https://github.com/go-gitea/gitea/assets/18380374/cb7cf266-f73f-419a-be1a-4689fdd1952a)
* Notify reviewers added via CODEOWNERS (#29842)Jimmy Praet2024-03-194-24/+75
|
* Fix missing error check of bufio.Scanner (#29882)coldWater2024-03-192-0/+8
| | | maybe more
* Upgrade Go 1.22 and upgrade dependency (#29869)wxiaoguang2024-03-171-1/+0
|