Commit Graph

17005 Commits

Author SHA1 Message Date
Giteabot
0e20ccfe32
Use action user as the trigger user of schedules (#30581) (#30609)
Backport #30581 by @yp05327

Follow https://github.com/go-gitea/gitea/pull/30357

When user push to default branch, the schedule trigger user will be the
user.
When disable then enable action units in settings, the schedule trigger
user will be action user.
When repo is a mirror, the schedule trigger user will be action user. (
before it will return error, fixed by #30357)

As scheduled job is a cron, the trigger user should be action user from
Gitea, not a real user.

Co-authored-by: yp05327 <576951401@qq.com>
2024-04-20 10:46:17 +08:00
Giteabot
08822651a6
Fix commit file status parser (#30602) (#30606)
Backport #30602 by wxiaoguang

Try to fix  #30492

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-04-19 15:16:02 +00:00
Giteabot
79484e1cb7
Fix HEAD method for robots.txt (#30603) (#30604)
Backport #30603 by wxiaoguang

Fix #30601
2024-04-19 22:43:50 +08:00
wxiaoguang
667427b4b9
Fix project description rendering for org (#30587) (#30599)
Backport #30587

Manually tested with 1.21:



![image](https://github.com/go-gitea/gitea/assets/2114189/fbe9a2c9-0563-4d69-bcdb-8e5e41f288a1)
2024-04-19 13:28:18 +00:00
wxiaoguang
2566f6ce8a
Fix changelog (1.21) (#30583) 2024-04-19 10:20:09 +00:00
Giteabot
944f1ec54c
Avoid importing modules/web/middleware in modules/session (#30584) (#30588)
Backport #30584 by @wolfogre

Related to #30375.

It doesn't make sense to import `modules/web/middleware` and
`modules/setting` in `modules/web/session` since the last one is more
low-level.

And it looks like a workaround to call `DeleteLegacySiteCookie` in
`RegenerateSession`, so maybe we could reverse the importing by
registering hook functions.

Co-authored-by: Jason Song <i@wolfogre.com>
2024-04-19 09:18:11 +02:00
Giteabot
a05d098a37
Fixup app.example.ini for task section, which is now queue.task (#30555) (#30562)
Backport #30555 by xor-gate

Config section `[task]` has been deprecated in favor of `[queue.task]`

Co-authored-by: Jerry Jacobs <xor-gate@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-04-18 15:15:50 +02:00
Giteabot
332ee359ce
Disable enter key for accepting code completion in Monaco (#30548) (#30558)
Backport #30548 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/28114 and behaviour
matches vscode on desktop as well.

Co-authored-by: silverwind <me@silverwind.io>
2024-04-18 11:38:24 +02:00
yp05327
a82bf022bf
Fix empty field login_name in API response JSON when creating user (#30511) (#30532)
Backport #30511
Fix ci error in #30515
2024-04-17 11:06:12 +02:00
Lunny Xiao
acdcfcc6eb
Fix cache bug (#30510)
Cache cannot be disabled from v1.22. So it still maybe `nil` in v1.21,
we have to check whether cache is `nil`.
2024-04-16 10:59:15 +08:00
Lunny Xiao
727b1914b4
Update 1.21.11 changelog (#30403)
Add #30394 into changelog

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: yp05327 <576951401@qq.com>
2024-04-16 10:10:47 +08:00
Lunny Xiao
60181eb599
Fix code owners will not be mentioned when a pull request comes from a forked repository (#30476) (#30497)
Backport #30476 
Fix #30277
Caused by #29783
2024-04-16 08:27:01 +08:00
Lunny Xiao
a0ca311165
Fix commit status cache which missed target_url (#30426) (#30445)
Fix #30421
Backport #30426

Co-authored-by: Jason Song <i@wolfogre.com>
2024-04-15 07:43:20 +00:00
Lunny Xiao
430fe6c0c1
Avoid losing token when updating mirror settings (#30429) (#30466)
Fix #30416.
Backport #30429 

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

f9fdac9809/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: Jason Song <i@wolfogre.com>
2024-04-15 11:29:42 +08:00
Lunny Xiao
b6379d2f16
Change the default maxPerPage for gitbucket (#30392) (#30471)
Backport #30392 

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!

Co-authored-by: Kazushi (Jam) Marukawa <jam@pobox.com>
2024-04-14 12:42:50 +00:00
yp05327
928c0d4f46
Fix mirror error when mirror repo is empty (#30432) (#30467)
Backport #30432
Fix https://github.com/go-gitea/gitea/issues/30424

ps: convert `gitrepo.OpenRepository` to `git.OpenRepository`
remove `ctx` from `checkAndUpdateEmptyRepository`

Co-authored-by: Giteabot <teabot@gitea.io>
2024-04-14 14:18:06 +02:00
Giteabot
222d16e6ea
fix: Fix to delete cookie when AppSubURL is non-empty (#30375) (#30468)
Backport #30375 by @jtran

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: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Kyle D <kdumontnu@gmail.com>
2024-04-14 13:45:51 +02:00
Lunny Xiao
09df5c9c7d
Use db.ListOptions directly instead of Paginator interface to make iteasier to use and fix performance of /pulls and /issues (#29990) (#30447)
backport #29990

This PR uses `db.ListOptions` instead of `Paginor` to make the code
simpler.
And it also fixed the performance problem when viewing /pulls or
/issues. Before the counting in fact will also do the search.

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: silverwind <me@silverwind.io>
2024-04-13 17:44:57 +00:00
Lunny Xiao
fc4e08f804
Upgrade go-sqlite to v1.14.22 (#30462) 2024-04-13 08:33:50 -05:00
Giteabot
68bd1dd89d
Fix rename branch 500 when the target branch is deleted but exist in database (#30430) (#30437)
Backport #30430 by @lunny

Fix #30428

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-04-12 23:09:16 +08:00
Zettat123
55990ebf92
Check the token's owner and repository when registering a runner (#30406) (#30412)
Backport #30406

Fix #30378
2024-04-11 11:29:53 +00:00
Giteabot
245e8d10c2
Avoid user does not exist error when detecting schedule actions when the commit author is an external user (#30357) (#30408)
Backport #30357 by @yp05327


![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.

Co-authored-by: yp05327 <576951401@qq.com>
2024-04-11 15:39:27 +08:00
Giteabot
529604a044
Update actions variables documents (#30394) (#30404)
Backport #30394 by @lunny

Fix #30393

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-04-11 12:04:21 +08:00
Jason Song
6cfe67cfc3
No global variables (#30402)
Fix #30361, regression of #29782 which is a backport, not the original
#29468.

#29468 did a small refactor which introduced a new function
`GetVariablesOfRun`. However, it's designed for v1.22 which supports
global variables.

After backporting it to v1.21, it will still try to get global
variables, which causes it to retrieve all variables.
2024-04-11 03:25:05 +00:00
Lunny Xiao
9149221845
Add changelog for 1.21.11 (#30314)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-04-11 10:52:02 +08:00
Lunny Xiao
6e3aaa9975
Performance optimization for git push (#30104) (#30354)
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`.

Backport #30104
2024-04-10 14:12:19 +08:00
Lunny Xiao
3f6ddd9bee
Fix create commit status (#30225) (#30340)
Partially backport #30223

This PR uses the service layer `CreateCommitstatus` method instead of
the git model method.
2024-04-08 23:30:55 +00:00
Lunny Xiao
65d96725bb
Fix possible renderer security problem(#30136) (#30315)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-04-09 00:24:35 +02:00
Giteabot
4588c7b705
Close file in the Upload func (#30262) (#30269)
Co-authored-by: guangwu <guoguangwu@magic-shield.com>
2024-04-03 15:20:18 +00:00
Giteabot
47de6e3b54
Add -u git to docs when using docker exec with root installation (#29314) (#30264)
Backport #29314 by @scribblemaniac

This fixes a minor issue in the documentation for SSH Container
Passthrough for non-rootless installs. The non-rootless Dockerfile and
docker-compose do not set `USER`/`user` instructions so `docker exec`
will run as root by default. While running as root, gitea commands will
refuse to execute, breaking these approaches. For containers built with
the rootless instructions, `docker exec` will run as git by default so
this is not necessary in that case.

This issue was already discussed in #19065, but it does not appear this
part of the issue was ever added to the documentation.

Co-authored-by: scribblemaniac <scribblemaniac@users.noreply.github.com>
2024-04-03 13:44:11 +00:00
Giteabot
5123ed3191
Fixes #27605: inline math blocks can't be preceeded/followed by alphanumerical characters (#30175) (#30250)
Backport #30175 by @jmlt2002

- Inline math blocks couldn't be preceeded or succeeded by
alphanumerical characters due to changes introduced in PR #21171.
Removed the condition that caused this (precedingCharacter condition)
and added a new exit condition of the for-loop that checks if a specific
'$' was escaped using '\' so that the math expression can be rendered as
intended.
- Additionally this PR fixes another bug where math blocks of the type
'$xyz$abc$' where the dollar sign was not escaped by the user, generated
an error (shown in the screenshots below)
- Altered the tests to accomodate for the changes

Former behaviour (from try.gitea.io):

![image](https://github.com/go-gitea/gitea/assets/114936010/8f0cbb21-321d-451c-b871-c67a8e1e9235)

Fixed behaviour (from my local build):

![image](https://github.com/go-gitea/gitea/assets/114936010/5c22687c-6f11-4407-b5e7-c14b838bc20d)

(Edit) Source code for the README.md file:
```
$x$ -$x$ $x$-

a$xa$ $xa$a 1$xb$ $xb$1

$a a$b b$

a$b $a a$b b$

$a a\$b b$
```

Signed-off-by: João Tiago <joao.leal.tintas@tecnico.ulisboa.pt>
Co-authored-by: João Tiago <114936010+jmlt2002@users.noreply.github.com>
2024-04-03 06:06:39 +00:00
Giteabot
9f2a1a55e6
Add -u git to docs when using docker exec with root installation (#29314) (#30258)
Backport #29314 by @scribblemaniac

This fixes a minor issue in the documentation for SSH Container
Passthrough for non-rootless installs. The non-rootless Dockerfile and
docker-compose do not set `USER`/`user` instructions so `docker exec`
will run as root by default. While running as root, gitea commands will
refuse to execute, breaking these approaches. For containers built with
the rootless instructions, `docker exec` will run as git by default so
this is not necessary in that case.

This issue was already discussed in #19065, but it does not appear this
part of the issue was ever added to the documentation.

Co-authored-by: scribblemaniac <scribblemaniac@users.noreply.github.com>
2024-04-03 01:44:13 -04:00
Giteabot
935bfe6445
Fix missing 0 prefix of GPG key id (#30245) (#30247)
Backport #30245 by @KN4CK3R

Fixes #30235

If the key id "front" byte has a single digit, `%X` is missing the 0
prefix.
` 38D1A3EADDBEA9C` instead of
`038D1A3EADDBEA9C`
When using the `IssuerFingerprint` slice `%X` is enough but I changed it
to `%016X` too to be consistent.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-04-02 16:13:07 +00:00
Giteabot
2ac78c75d0
Include encoding in signature payload (#30174) (#30181)
Backport #30174 by @KN4CK3R

Fixes #30119

Include the encoding in the signature payload.

before

![grafik](https://github.com/go-gitea/gitea/assets/1666336/01ab94a3-8af5-4d6f-be73-a10b65a15421)

after

![grafik](https://github.com/go-gitea/gitea/assets/1666336/3a37d438-c70d-4d69-b178-d170e74aa683)

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-04-01 09:47:11 +08:00
YR Chen
b1dae9f2c8
Move from max( id ) to max( index ) for latest commit statuses (#30076) (#30155)
Backport https://github.com/go-gitea/gitea/pull/30076.

This PR replaces the use of `max( id )`, and instead using ``max(
`index` )`` for determining the latest commit status. Building business
logic over an `auto_increment` primary key like `id` is risky and
there’re already plenty of discussions on the Internet.

There‘s no guarantee for `auto_increment` values to be monotonic,
especially upon failures or with a cluster. In the specific case, we met
the problem of commit statuses being outdated when using TiDB as the
database. As [being
documented](https://docs.pingcap.com/tidb/stable/auto-increment),
`auto_increment` values assigned to an `insert` statement will only be
monotonic on a per server (node) basis.

Closes #30074.
2024-03-28 16:29:38 +00:00
yp05327
7bffb923ce
Load attachments for code comments (#30124) (#30126)
backport #30124
2024-03-27 16:06:23 +08:00
yp05327
0c10c3a282
Fix gitea doctor will remove repo-avatar files when execute command storage-archives (#30094) (#30120)
backport #30094
2024-03-27 10:09:17 +08:00
Lunny Xiao
09a5067c0c
Fix possible data race on tests (#30093) (#30108)
backport #30093
2024-03-26 16:49:48 +01:00
yp05327
a0f89ba8c7
Fix duplicate migrated milestones (#30102) (#30105)
backport #30102
2024-03-26 20:58:56 +08:00
yp05327
6d47b63be2
Fix panic for fixBrokenRepoUnits16961 (#30068) (#30100)
backport #30068
2024-03-26 18:20:03 +08:00
silverwind
8dccea02f2
Update katex to 0.16.10 (#30089)
https://github.com/KaTeX/KaTeX/releases/tag/v0.16.10

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-26 02:42:37 +01:00
silverwind
03f29db46d
Fix incorrect SVGs (#30087)
Just the SVG fixes from https://github.com/go-gitea/gitea/pull/30086 for
v1.21 branch.
2024-03-26 00:10:24 +00:00
Lunny Xiao
d6b0d0e9c0
Release of 1.21.10 (#30073)
The main reason for this release is to fix a bug #29997
2024-03-26 00:46:08 +01:00
Lunny Xiao
087aed7096
Fix Add/Remove WIP on pull request title failure (#29999) (#30066)
Fix #29997
Backport #29999
2024-03-25 10:26:05 +01:00
Giteabot
78795dd566
Fix misuse of TxContext (#30061) (#30062)
Backport #30061 by @wolfogre

Help #29999, or its tests cannot pass.

Also, add some comments to clarify the usage of `TxContext`.

I don't check all usages of `TxContext` because there are too many
(almost 140+). It's a better idea to replace them with `WithTx` instead
of checking them one by one. However, that may be another refactoring
PR.

Co-authored-by: Jason Song <i@wolfogre.com>
2024-03-25 07:22:09 +00:00
Giteabot
e321b8a849
Respect DEFAULT_ORG_MEMBER_VISIBLE setting when adding creator to org (#30013) (#30035)
Backport #30013 by @DrMaxNix

This PR adds `setting.Service.DefaultOrgMemberVisible` value to dataset
of user when the initial org creator is being added to the created org.

Fixes #30012.

Co-authored-by: DrMaxNix <mail@drmaxnix.de>
2024-03-24 06:38:31 +01:00
wxiaoguang
2172b38d50
Escape paths for find file correctly (#30026) (#30031)
Backport #30026
2024-03-23 17:21:57 +01:00
wxiaoguang
01f736f68c
Remove duplicate option in admin screen and now-unused translation keys (#28492) (#30024)
Backport #28492
Fix #30019

Co-authored-by: The Magician <142242365+TheMagician23@users.noreply.github.com>
2024-03-23 15:56:19 +01:00
Giteabot
688107651c
Small refactors in anchors.js (#29947) (#30003)
Backport #29947 by @silverwind

Some minor refactors, remove unnecessary `:is` selector and move the
`:target` check out of the function. Might as well backport for the rare
browser that does not support `:is`.

Co-authored-by: silverwind <me@silverwind.io>
2024-03-22 15:02:05 +01:00
wxiaoguang
24c66c5096
Fix manual merge form and 404 page templates (#30000)
Partially backport #29985, fix some template errors.

* fix the manual-merge form
* fix the 404 page
2024-03-22 19:42:41 +08:00