1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-10 09:44:43 +00:00

4795 Commits

Author SHA1 Message Date
Lunny Xiao
67aeb1f896
Add missed transaction on setmerged (#33079)
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.
2025-01-08 03:16:56 +00:00
Rowan Bohde
a8e7caedfa
add submodule diff links (#33097)
This adds links to submodules in diffs, similar to the existing link
when viewing a repo at a specific commit. It does this by expanding diff
parsing to recognize changes to submodules, and find the specific refs
that are added, deleted or changed.

Related #25888

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-01-08 01:38:30 +00:00
wxiaoguang
34dfc25b83
Make git clone URL could use current signed-in user (#33091)
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
2025-01-07 13:17:44 +08:00
Lunny Xiao
98637fe76e
Filter reviews of one pull request in memory instead of database to reduce 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>
2025-01-07 10:50:09 +08:00
Chai-Shi
1a95d9d6a1
fix empty repo updated time (#33120)
fixes #33119 

routers/web/repo/view_home.go

![image](https://github.com/user-attachments/assets/b0d6c5f5-7abc-478a-8d41-4b44dbd460aa)

Calling `updateContextRepoEmptyAndStatus` will always ask the DB to
update the updated Unix attributes.
When revisiting the repo's home page, the timestamp will be updated
unexpectedly, so I added the needsUpdate variable to check whether, in
the end, the commitment to db update is necessary if columns have not
changed at all.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-01-07 01:54:06 +08:00
wxiaoguang
80e4f4c4eb
Refactor package (routes and error handling, npm peer dependency) (#33111) 2025-01-06 22:45:20 +08:00
wxiaoguang
40765b5d45
Fix repo empty guide (#33114) 2025-01-06 12:07:52 +08:00
ChristopherHX
4237736029
workflow_dispatch use workflow from trigger branch (#33098)
* htmx updates the input form on branch switch
* add workflow warning to dispatch modal
* use name if description of input is empty
* show error if workflow_dispatch not available on branch

Closes #33073
Closes #33099

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-01-05 21:47:18 +08:00
wxiaoguang
3d544a3ad3
Fix empty git repo handling logic (#33101)
Fix #33092
2025-01-04 18:47:24 +08:00
Kemal Zebari
188e0ee8e4
Use Project-URL metadata field to get a PyPI package's homepage URL (#33089)
Resolves #33085.
2025-01-03 21:09:47 +00:00
wxiaoguang
68972a9947
Clean up legacy form CSS styles (#33081) 2025-01-03 04:01:19 +00:00
wxiaoguang
45973a100b
Fix bleve fuzziness search (#33078)
Close #31565
2025-01-03 00:32:02 +08:00
wxiaoguang
2564c15cb0
Remove some unnecessary template helpers (#33069)
DisableGitHooks and DisableImportLocal are only used when editing a
user, so only set them in `editUserCommon`
2025-01-01 18:02:34 +08:00
Lunny Xiao
20c7fba601
Use project's redirect url instead of composing url (#33058)
Fix #32992

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-31 19:19:53 +08:00
wxiaoguang
e5c576e92b
Refactor maven package registry (#33049)
Close #33036
2024-12-31 05:30:52 +00:00
Chai-Shi
0387195abb
[Feature] Private README.md for organization (#32872)
Implemented #29503

---------

Co-authored-by: Ben Chang <ben_chang@htc.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-31 04:22:09 +00:00
Lunny Xiao
fe32ffe181
Merge updatecommentattachment functions (#33044)
Extract from #32178
2024-12-30 18:21:57 +00:00
Lunny Xiao
d45456b1b5
Move SetMerged to service layer (#33045)
No code change.
Extract from #32178
2024-12-30 07:04:03 +00:00
Lunny Xiao
f4ccbd38dc
Use gitrepo.GetTreePathLatestCommit to get file lastest commit instead from latest commit cache (#32987)
The latest commit cache is currently used only for listing tree files.
However, a cold start may take longer than directly invoking the Git
command. This PR addresses the issue of slow response times when
accessing raw files, improving performance in such scenarios.

```log
gitea.log:105521:2024/12/23 08:22:18 ...eb/routing/logger.go:68:func1() [W] router: slow      GET /xxxx/xxxxxx/raw/commit/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.editorconfig for 172.18.0.5:53252, elapsed 3526.8ms @ repo/download.go:117(repo.SingleDownload)
```
2024-12-30 03:30:01 +00:00
wxiaoguang
cd1b5488a3
Refactor pagination (#33037)
I am sure the simple approach should work, let's try it in 1.24

Follow #29834 and #29841
2024-12-30 01:57:38 +00:00
wxiaoguang
0ed160ffea
Refactor tests (#33021)
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
...
```
2024-12-29 01:05:56 +00:00
wxiaoguang
e435b1900a
Refactor arch route handlers (#32993) 2024-12-28 03:31:46 +00:00
Blender Defender
079a1ffe8f
De-emphasize signed commits (#31160)
The new code structure is easier to make more improvements or
refactor, for example: change the colors to de-emphasize more, or design
some new layouts.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-28 04:18:30 +08:00
Zettat123
2d1a171dc7
Support for email addresses containing uppercase characters when activating user account (#32998)
Fix #32807

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-27 19:16:23 +08:00
Zettat123
44b4fb21a4
Support org labels when adding labels by label names (#32988)
Fix #32891
2024-12-26 19:14:49 +00:00
yp05327
7bb7ba1b5b
Add show more organizations icon in user's profile (#32986)
Close #32952

# ⚠️ Doc update is required


![image](https://github.com/user-attachments/assets/296c5109-8fc1-43ea-b7dc-e79919cc1f9a)

![image](https://github.com/user-attachments/assets/d30980f6-22e4-4b97-9143-c750dc399da6)


------
⚠️This PR refuses to be cherry-picked by any forked projects without any
mentions.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-27 02:49:50 +08:00
wxiaoguang
9bfa9f450d
Refactor "string truncate" (#32984) 2024-12-26 11:56:03 +08:00
Lunny Xiao
5feb1a6bff
Use CloseIssue and ReopenIssue instead of ChangeStatus (#32467)
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>
2024-12-25 07:38:30 +00:00
wxiaoguang
973363fec3
Fix maven pom inheritance (#32943)
Fix  #30568
2024-12-25 04:28:37 +00:00
wxiaoguang
ca31d478ee
Refactor arch route handlers (#32972) 2024-12-25 04:03:14 +00:00
wxiaoguang
b7260400f8
Refactor tmpl and blob_excerpt (#32967)
1. do not use `{{/* */}}` to remove spaces, use `{{- -}}`
2. fix "blob_excerpt" endpoint, remove the legacy fragile code: have
tested commit diff and wiki diff
2024-12-25 00:51:13 +08:00
wxiaoguang
2a828e2798
Clarify path param naming (#32969)
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.
2024-12-24 13:47:45 +00:00
wxiaoguang
6d5aa9218e
Refactor request context (#32956)
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.
2024-12-24 11:43:57 +08:00
wxiaoguang
781c6df40f
Add sub issue list support (#32940)
Just like GitHub, show issue icon/title when the issue number is in a list
2024-12-24 01:54:19 +00:00
wxiaoguang
7553ae1a57
Use env GITEA_RUNNER_REGISTRATION_TOKEN as global runner token (#32946)
Fix #23703

When Gitea starts, it reads GITEA_RUNNER_REGISTRATION_TOKEN
or GITEA_RUNNER_REGISTRATION_TOKEN_FILE to add registration token.
2024-12-23 09:59:16 +00:00
bytedream
6279646ee4
Add auto-expanding running actions step (#30058)
Auto-expands the currently running action step.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-22 18:57:17 +00:00
wxiaoguang
a163c53a60
Refactor template & test related code (#32938)
Move some legacy code from "base" package to proper packages.
2024-12-22 15:33:19 +00:00
Lunny Xiao
751fe8b714
Move some errors to their own sub packages (#32880) 2024-12-20 18:05:29 +00:00
wxiaoguang
52b319bc00
Refactor pprof labels and process desc (#32909)
* Deprecate "gopid" in log, it is not useful and requires very hacky
approach
* Remove "git.Command.SetDescription" because it is not useful and only
makes the logs too flexible
2024-12-20 12:17:14 +08:00
silverwind
626b27bea5
Update go tool dependencies (#32916)
Update all go tool dependencies to latest version. WIP because I think
there are new gopls errors, would like to confirm them on CI first. Here
is from a local run:

```
modules/markup/markdown/goldmark.go:115:37-53: unnecessary type arguments
modules/markup/html.go:45:32-49: unnecessary type arguments
modules/markup/internal/renderinternal.go:20:33-49: unnecessary type arguments
modules/markup/common/linkify.go:27:32-49: unnecessary type arguments
modules/util/time_str.go:28:39-63: unnecessary type arguments
routers/web/repo/pull.go:704:19: impossible condition: non-nil == nil
modules/util/util_test.go:248:14-23: unused parameter: other
```

~~Backport because the `gxz` update might have security benefits.~~
2024-12-19 19:17:55 +01:00
silverwind
141d782c1a
Refactor repo-projects.ts (#32892)
- Remove jQuery
- Add types to all functions
- Tested all modified functionality

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-19 08:37:12 +00:00
Lunny Xiao
f9f62b4c4c
Move delete deploy keys into service layer (#32201) 2024-12-18 04:10:38 +00:00
Lunny Xiao
e4c4629465
Move RepoTransfer from models to models/repo sub package (#32506)
`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.
2024-12-18 11:44:16 +08:00
wxiaoguang
2d7e6e9482
Fix various trivial problems (#32861)
1. add/improve comments to help future readers could understand the
problem more easily.
2. add an error log to LDAP with username fallback
3. use `or` instead of `Iif` for "repo/branch_dropdown" (`Iif` was a
mistake, but it doesn't really affect the UI)
4. add `tw-font-mono` style to container digest to match dockerhub
5. fix a bug in RepoBranchTagSelector: the form is not updated when
there is no click to an item

---------

Co-authored-by: delvh <dev.lh@web.de>
2024-12-17 01:15:18 +00:00
Lunny Xiao
42090844ed
Fix bug on action list deleted branch (#32848)
Fix
https://github.com/go-gitea/gitea/issues/32761#issuecomment-2540946064

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-12-16 05:38:39 +08:00
TheFox0x7
33e8e82c4b
Enable tenv and testifylint rules (#32852)
Enables tenv and testifylint linters
closes: https://github.com/go-gitea/gitea/issues/32842
2024-12-15 10:41:29 +00:00
silverwind
1cfb718976
Update golangci-lint to v1.62.2, fix issues (#32845)
Update it and fix new issues related to `redefines-builtin-id`
2024-12-15 02:31:07 +00:00
Zettat123
7269130d28
Fix missing outputs for jobs with matrix (#32823)
Fix #32795

If a job uses a matrix, multiple `ActionRunJobs` may have the same
`JobID`. We need to merge the outputs of these jobs to make them
available to the jobs that need them.
2024-12-14 10:22:30 +08:00
wxiaoguang
a66c16dc1b
Allow to fork repository into the same owner (#32819)
This feature is experimental, not fully tested, and may be changed in
the future.

It is only designed for users who really need it: set
`[repository].ALLOW_FORK_INTO_SAME_OWNER=true` in your app.ini

Doc: https://gitea.com/gitea/docs/pulls/122


![image](https://github.com/user-attachments/assets/38d08c23-9cfc-49d8-9321-ff81edf65395)
2024-12-14 09:39:05 +08:00
Lunny Xiao
6370d2fb93
Detect whether action view branch was deleted (#32764)
Fix #32761 

![图片](https://github.com/user-attachments/assets/a5a7eef8-0fea-4242-b199-1b0b73d9bbdb)
2024-12-12 19:28:23 +00:00