aboutsummaryrefslogtreecommitdiffstats
path: root/services/context
Commit message (Collapse)AuthorAgeFilesLines
* Move git references checking to gitrepo packages to reduce expose of ↵Lunny Xiao13 days2-5/+5
| | | | repository path (#33891)
* Refactor cache-control (#33861)wxiaoguang2025-03-132-2/+2
| | | And fix #21391
* Improve log format (#33814)wxiaoguang2025-03-082-2/+2
|
* Improve "generate new access token" form (#33730)Guillaume2025-02-271-4/+7
| | | | | | | | | | | | | | | | | | | | | Fix: https://github.com/go-gitea/gitea/issues/33519 As discussed in [PR #33614](https://github.com/go-gitea/gitea/pull/33614), the ScopedAccessTokenSelector Vue component is not particularly useful. This PR removes the component and reverts to using HTML templates. It also introduces some (hopefully) useful refactoring. The Vue component was causing the UX bug reported in the linked issue. Required form fields are now properly working, as expected (see screenshot). ![Screenshot from 2025-02-25 22-00-28](https://github.com/user-attachments/assets/41167854-0718-48b0-a3ee-75ca3a7b8b20) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix git empty check and HEAD request (#33690)wxiaoguang2025-02-241-0/+5
|
* Refactor error system (#33626)wxiaoguang2025-02-172-6/+12
|
* Refactor error system (#33610)wxiaoguang2025-02-168-79/+73
|
* Avoid duplicate SetContextValue call (#33564)wxiaoguang2025-02-122-3/+2
| | | And fix FIXME and TODO
* Fix context usage (#33554)wxiaoguang2025-02-112-5/+6
| | | | | | | | | Some old code use direct type-casting to get context, it causes problems. This PR fixes all legacy problems and use correct `ctx.Value` to get low-level contexts. Fix #33518
* Feature: Support workflow event dispatch via API (#33545)wxiaoguang2025-02-113-1/+11
| | | | | | | | | Fix: https://github.com/go-gitea/gitea/issues/31765 (Re-open #32059) --------- Co-authored-by: Bence Santha <git@santha.eu> Co-authored-by: Bence Sántha <7604637+bencurio@users.noreply.github.com> Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
* Refactor web route handler (#33488)wxiaoguang2025-02-051-178/+154
|
* Worktime tracking for the organization level (#19808)K Kovacs2025-02-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dear Gitea team, first of all, thanks for the great work you're doing with this project. I'm planning to introduce Gitea at a client site, and noticed that while there is time recording, there are no project-manager-friendly reports to actually make use of that data, as were also mentioned by others in #4870 #8684 and #13531. Since I had a little time last weekend, I had put together something that I hope to be a useful contribution to this great project (while of course useful for me too). This PR adds a new "Worktime" tab to the Organisation level. There is a date range selector (by default set to the current month), and there are three possible views: - by repository, - by milestone, and - by team member. Happy to receive any feedback! There are several possible future improvements of course (predefined date ranges, charts, a member time sheet, matrix of repos/members, etc) but I hope that even in this relatively simple state this would be useful to lots of people. <img width="1161" alt="Screen Shot 2022-05-25 at 22 12 58" src="https://user-images.githubusercontent.com/118010/170366976-af00c7af-c4f3-4117-86d7-00356d6797a5.png"> Keep up the good work! Kristof --------- Co-authored-by: user <user@kk-git1> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix "redirect link" handling (#33440)wxiaoguang2025-01-312-13/+26
| | | | | | | `a%2fb` should not redirect to `a/b` --------- Co-authored-by: delvh <dev.lh@web.de>
* Refactor repository transfer (#33211)Lunny Xiao2025-01-301-1/+1
| | | | | | | | | | | | | - Both have `RejectTransfer` and `CancelTransfer` because the permission checks are not the same. `CancelTransfer` can be done by the doer or those who have admin permission to access this repository. `RejectTransfer` can be done by the receiver user if it's an individual or those who can create repositories if it's an organization. - Some tests are wrong, this PR corrects them. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor context flash msg and global variables (#33375)wxiaoguang2025-01-251-11/+3
| | | | | | 1. add `GetSiteCookieFlashMessage` to help to parse flash message 2. clarify `handleRepoHomeFeed` logic 3. remove unnecessary global variables, use `sync.OnceValue` instead 4. add some tests for `IsUsableUsername` and `IsUsableRepoName`
* Do not access GitRepo when a repo is being created (#33380)wxiaoguang2025-01-241-0/+3
|
* Remove duplicate "ResponseWriter.Status" method (#33346)wxiaoguang2025-01-223-15/+4
|
* Refactor response writer & access logger (#33323)wxiaoguang2025-01-203-64/+151
| | | And add comments & tests
* Fix incorrect ref usages (#33301)wxiaoguang2025-01-161-0/+12
| | | | | Fix #33297 By the way, improve some locales
* Prepare for support performance trace (#33286)wxiaoguang2025-01-151-13/+11
| | | For #32973
* Fix incorrect TagName/BranchName usages (#33279)wxiaoguang2025-01-151-4/+0
| | | Add add a new test
* Simplify context ref name (#33267)wxiaoguang2025-01-151-29/+10
|
* Refactor ref type (#33242)Lunny Xiao2025-01-142-55/+27
| | | | | | | | | | | | Major changes: 1. do not sync ".keep" file during tests 2. fix incorrect route handler and empty repo handling (backported as #33253 with tests) 3. do not use `RepoRef`: most of the calls are abuses. 4. Use `git.RefType` instead of a new type definition `RepoRefType` on `context`. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support public code/issue access for private repositories (#33127)wxiaoguang2025-01-141-65/+9
| | | Close #8649, close #639 (will add "anonymous access" in following PRs)
* Fix incorrect ref "blob" (#33240)wxiaoguang2025-01-131-10/+0
| | | | | 1. "blob" is not a "ref", it shouldn't (and not unable to) be handled by `RepoRefByType` 2. the `/blob/{sha}` handle should use the path param "sha" directly
* Refactor RefName (#33234)wxiaoguang2025-01-131-10/+1
| | | And fix some FIXMEs
* Refactor context RefName and RepoAssignment (#33226)wxiaoguang2025-01-131-84/+71
| | | | | | | The `ctx.Repo.RefName` was used to be a "short name", it causes a lot of ambiguity. This PR does some refactoring and use `RefFullName` to replace the legacy `RefName`, and simplify RepoAssignment
* Refactor context repository (#33202)wxiaoguang2025-01-122-58/+27
|
* Fix raw file API ref handling (#33172)wxiaoguang2025-01-102-23/+18
| | | Fix #33164 and add more tests
* Make git clone URL could use current signed-in user (#33091)wxiaoguang2025-01-071-3/+3
| | | | | | | | | | | | | | close #33086 * Add a special value for "SSH_USER" setting: `(DOER_USERNAME)` * Improve parseRepositoryURL and add tests (now it doesn't have hard dependency on some setting values) Many changes are just adding "ctx" and "doer" argument to functions. By the way, improve app.example.ini, remove all `%(key)s` syntax, it only makes messy and no user really cares about it. Document: https://gitea.com/gitea/docs/pulls/138
* Fix empty git repo handling logic (#33101)wxiaoguang2025-01-041-3/+0
| | | Fix #33092
* [Feature] Private README.md for organization (#32872)Chai-Shi2024-12-313-5/+10
| | | | | | | | Implemented #29503 --------- Co-authored-by: Ben Chang <ben_chang@htc.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor pagination (#33037)wxiaoguang2024-12-301-22/+2
| | | | | I am sure the simple approach should work, let's try it in 1.24 Follow #29834 and #29841
* Clarify path param naming (#32969)wxiaoguang2024-12-247-105/+132
| | | | | | | | | In history (from some legacy frameworks), both `:name` and `name` are supported as path path name, `:name` is an alias to `name`. To make code consistent, now we should only use `name` but not `:name`. Also added panic check in related functions to make sure the name won't be abused in case some downstreams still use them.
* Refactor request context (#32956)wxiaoguang2024-12-248-173/+107
| | | | | | | | | | | Introduce RequestContext: is a short-lived context that is used to store request-specific data. RequestContext could be used to clean form tmp files, close context git repo, and do some tracing in the future. Then a lot of legacy code could be removed or improved. For example: most `ctx.Repo.GitRepo.Close()` could be removed because the git repo could be closed when the request is done.
* Add sub issue list support (#32940)wxiaoguang2024-12-241-1/+1
| | | Just like GitHub, show issue icon/title when the issue number is in a list
* Refactor template & test related code (#32938)wxiaoguang2024-12-223-12/+11
| | | Move some legacy code from "base" package to proper packages.
* Move RepoTransfer from models to models/repo sub package (#32506)Lunny Xiao2024-12-181-2/+1
| | | | | | | | | | | | | `RepoTransfer` now is at models, but if we want to move it into `repo` model, it will depend on `Team`. So this PR also makes repo model depend on org model to make it possible. Just refactor, no code change. - [x] Move `DeleteOrganization` from `models/organization` to service layer - [x] Move `AccessibleTeamReposEnv` to `models/repo` - [x] Move `RepoTransfer` from `models` to `models/repo` - [x] Merge `getUserTeamIDs` and `GetUserTeamIDs`, Merge `GetUserTeams` and `getUserTeams`. - [x] Remove `Team`'s `Repos []*repo_model.Repository` to avoid dependency recycle.
* Make API "compare" accept commit IDs (#32801)wxiaoguang2024-12-121-23/+7
|
* Add label/author/assignee filters to the user/org home issue list (#32779)wxiaoguang2024-12-111-0/+13
| | | | | | | | | | 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.
* GitHub like repo home page (#32213)yp053272024-12-061-8/+1
| | | | | | | Move some components (description, license, release, language stats) to sidebar --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor markup render system (#32589)wxiaoguang2024-11-221-3/+1
| | | | This PR mainly moves some code and introduces `RenderContext.WithXxx` functions
* Remove unnecessary code (#32560)Lunny Xiao2024-11-191-7/+0
| | | | PushMirrors only be used in the repository setting page. So it should not be loaded on every repository page.
* Refactor render system (#32492)wxiaoguang2024-11-141-2/+1
| | | | | | | | | | | | | | | | | | | There were too many patches to the Render system, it's really difficult to make further improvements. This PR clears the legacy problems and fix TODOs. 1. Rename `RenderContext.Type` to `RenderContext.MarkupType` to clarify its usage. 2. Use `ContentMode` to replace `meta["mode"]` and `IsWiki`, to clarify the rendering behaviors. 3. Use "wiki" mode instead of "mode=gfm + wiki=true" 4. Merge `renderByType` and `renderByFile` 5. Add more comments ---- The problem of "mode=document": in many cases it is not set, so many non-comment places use comment's hard line break incorrectly
* Fix LFS route mock, realm, middleware names (#32488)wxiaoguang2024-11-132-0/+8
| | | | | | | | | | 1. move "internal-lfs" route mock to "common-lfs" 2. fine tune tests 3. fix "realm" strings, according to RFC: https://datatracker.ietf.org/doc/html/rfc2617: * realm = "realm" "=" realm-value * realm-value = quoted-string 4. clarify some names of the middlewares, rename `ignXxx` to `optXxx` to match `reqXxx`, and rename ambiguous `requireSignIn` to `reqGitSignIn`
* Calculate `PublicOnly` for org membership only once (#32234)65432024-11-111-4/+3
| | | | | | | | | | Refactoring of #32211 this move the PublicOnly() filter calcuation next to the DB querys and let it be decided by the Doer --- *Sponsored by Kithara Software GmbH*
* Include file extension checks in attachment API (#32151)Kemal Zebari2024-11-061-6/+17
| | | | | | From testing, I found that issue posters and users with repository write access are able to edit attachment names in a way that circumvents the instance-level file extension restrictions using the edit attachment APIs. This snapshot adds checks for these endpoints.
* Refactor RepoRefByType (#32413)wxiaoguang2024-11-052-84/+75
| | | | | 1. clarify the "filepath" could(should) contain "{ref}" 2. remove unclear RepoRefLegacy and RepoRefAny, use RepoRefUnknown to guess 3. by the way, avoid using AppURL
* Refactor template ctx and render utils (#32422)wxiaoguang2024-11-051-1/+4
| | | Clean up the templates
* Refactor DateUtils and merge TimeSince (#32409)wxiaoguang2024-11-041-1/+0
| | | Follow #32383 and #32402