Compare commits

..

492 Commits

Author SHA1 Message Date
d6b0d0e9c0 Release of 1.21.10 ()
The main reason for this release is to fix a bug 
2024-03-26 00:46:08 +01:00
087aed7096 Fix Add/Remove WIP on pull request title failure () ()
Fix 
Backport 
2024-03-25 10:26:05 +01:00
78795dd566 Fix misuse of TxContext () ()
Backport  by @wolfogre

Help , 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
e321b8a849 Respect DEFAULT_ORG_MEMBER_VISIBLE setting when adding creator to org () ()
Backport  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 .

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

Co-authored-by: The Magician <142242365+TheMagician23@users.noreply.github.com>
2024-03-23 15:56:19 +01:00
688107651c Small refactors in anchors.js () ()
Backport  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
24c66c5096 Fix manual merge form and 404 page templates ()
Partially backport , fix some template errors.

* fix the manual-merge form
* fix the 404 page
2024-03-22 19:42:41 +08:00
e1e88f9ad1 Add changelog for 1.21.9 ()
Co-authored-by: Jason Song <i@wolfogre.com>
2024-03-22 12:32:44 +08:00
f91b4dd959 Fix bugs in rerunning jobs () ()
Backport  by @Zettat123

Fix 
Fix 
Fix 

## 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" />

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-03-22 03:57:10 +00:00
6ef986d474 Performance improvements for pull request list page () ()
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 
Backport 
2024-03-22 09:58:04 +08:00
c03b1e2854 Fix the bug that user may logout if GetUserByID return unknow error ()
backport 

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>
2024-03-21 14:30:55 +00:00
3ff3c5ba78 Solving the issue of UI disruption when the review is deleted without refreshing () ()
backport 
2024-03-21 15:03:01 +01:00
58a0ba711d Fix and rewrite markup anchor processing () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2024-03-21 01:09:08 +02:00
b4a6c6fd7a Fix loadOneBranch panic () ()
Backport 

Try to fix 

Far from ideal, but still better than panic.
2024-03-20 22:31:32 +08:00
3fd15aeff2 Add cache for dashbaord commit status ()
backport 
2024-03-20 10:34:40 +00:00
0873088223 Show Actions post step when it's running () ()
Backport  by @wolfogre

The post step was always waiting, even if all steps were done. Then,
once the task was done, the post step became success immediately.

Before:

<img width="915" alt="xnip_240320_120228"
src="https://github.com/go-gitea/gitea/assets/9418365/00347430-f998-4c43-917a-bf6dd6d0e333">

After:

<img width="905" alt="xnip_240320_120443"
src="https://github.com/go-gitea/gitea/assets/9418365/a419b111-17c2-4029-a022-c761cc419091">

Co-authored-by: Jason Song <i@wolfogre.com>
2024-03-20 06:25:11 +00:00
ff27ca32ca Notify reviewers added via CODEOWNERS () ()
backport 

Co-authored-by: Jimmy Praet <jimmy.praet@telenet.be>
2024-03-20 06:02:24 +00:00
eb302deb18 Fix the wrong default value of ENABLE_OPENID_SIGNIN on docs () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-03-20 05:08:24 +00:00
aae96cc62b Fix invalid link of the commit status when ref is tag () ()
Backport 

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-03-20 04:36:32 +00:00
5f7b6b55a5 Only do counting when count_only=true for repo dashboard () ()
Ref: 
Backport 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-20 11:02:35 +08:00
408c92938b Fix PR creation via api between branches of same repo with head field namespaced () ()
Backport  by @norohind

Fix 

Current implementation of API does not allow creating pull requests
between branches of the same
repo when you specify *namespace* (owner of the repo) in `head` field in
http request body.

---------

Co-authored-by: norohind <60548839+norohind@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-03-20 09:38:30 +08:00
b9dd5dd471 Fix template error when comment review doesn't exist () ()
Backport 
2024-03-19 15:00:01 +08:00
440be51a45 Fix bug on template ()
Caused by 
Fix 
2024-03-18 15:24:07 +00:00
00ea9af8e1 Editor error message misleading due to re-used key. () ()
Backport  by @buckybytes

The error message:

`editor.file_changed_while_editing = The file contents have changed
since you started editing. <a target="_blank" rel="noopener noreferrer"
href="%s">Click here</a> to see them or <strong>Commit Changes
again</strong> to overwrite them.`

Is re-used in inappropriate contexts. The link in the key goes to a 404
when the key is used in a situation where the file contents have not
changed.

Added two new keys to differentiate commit id mismatch and push out of
date conditions.

Co-authored-by: buckybytes <158571971+buckybytes@users.noreply.github.com>
2024-03-18 14:45:43 +08:00
c044510ca8 Fix user id column case () ()
Backport  by @lng2020

Sometimes the column name is case-sensitive and it may cause 500.

Co-authored-by: Nanguan Lin <nanguanlin6@gmail.com>
2024-03-17 13:51:15 +00:00
85f31eb643 Fix codeowner detected diff base branch to mergebase () ()
Fix 
Backport  

This PR fixes 2 problems with CodeOwner in the pull request.
- Don't use the pull request base branch but merge-base as a diff base
to detect the code owner.
- CodeOwner detection in fork repositories will be disabled because
almost all the fork repositories will not change CODEOWNERS files but it
should not be used on fork repositories' pull requests.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-17 02:40:06 +01:00
8242c3c88c fix double border and border-radius on empty action steps () ()
Backport  by @silverwind

Before, double border-bottom and incorrect border-radius:

<img width="914" alt="Screenshot 2024-03-16 at 14 46 31"
src="https://github.com/go-gitea/gitea/assets/115237/6ea63c42-754c-420c-a0f5-c889a8507d9f">

After, both fixed:

<img width="917" alt="Screenshot 2024-03-16 at 14 45 59"
src="https://github.com/go-gitea/gitea/assets/115237/9d3f2dba-6b22-441d-8e99-5809d5f1f1c0">

Co-authored-by: silverwind <me@silverwind.io>
2024-03-16 18:16:45 +01:00
0cbbcf20e3 Make meilisearch do exact search for issues ( & ) ()
Backport https://github.com/go-gitea/gitea/pull/29740 (based on 
...)
2024-03-16 17:01:40 +01:00
47dc4598a3 Fix for attribute not pointing to the ID of the color picker () ()
Backport  by @yardenshoham

It didn't include the word picker.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-03-15 13:33:46 +00:00
817d5e4d30 Use Temporal.PlainDate for absolute dates () ()
Backport https://github.com/go-gitea/gitea/pull/29804.

Use the upcoming
[Temporal.PlainDate](https://tc39.es/proposal-temporal/docs/plaindate.html)
via polyfill. If there is any remaining bugs in `<absolute-date>` this
will iron them out. I opted for the lightweight polyfill because both
seem to achieve our goal of localizeable absolute dates.

- With
[`@js-temporal/polyfill`](https://www.npmjs.com/package/@js-temporal/polyfill)
chunk size goes from 81.4 KiB to 274 KiB
- With
[`temporal-polyfill`](https://www.npmjs.com/package/temporal-polyfill)
chunk size goes from 81.4 KiB to 142 KiB

Also see [this
table](https://github.com/fullcalendar/temporal-polyfill?tab=readme-ov-file#comparison-with-js-temporalpolyfill)
for more comparisons of these polyfills. Soon there will be
[treeshakable
API](https://github.com/fullcalendar/temporal-polyfill?tab=readme-ov-file#tree-shakable-api)
as well which will further reduce size.
2024-03-15 11:20:42 +01:00
31ab839a65 Update Chroma to v2.13.0 () ()
Backport  

This adds new lexers and includes some fixes. See
https://github.com/alecthomas/chroma/releases/tag/v2.13.0 for the full
changelog.

Co-authored-by: JakobDev <jakobdev@gmx.de>
2024-03-15 16:45:10 +08:00
df23ec0f8b Fix Safari spinner rendering () ()
Backport  by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/29041
Fixes: https://github.com/go-gitea/gitea/pull/29713

Any of the `width: *-content` properties seem to workaround this Webkit
bug, this one seemed most suitable.

Before:
<img width="184" alt="Screenshot 2024-03-14 at 22 29 58"
src="https://github.com/go-gitea/gitea/assets/115237/6effc5f0-bc64-4752-be74-9c43b3974407">

After:
<img width="177" alt="Screenshot 2024-03-14 at 22 30 30"
src="https://github.com/go-gitea/gitea/assets/115237/5de244d7-6b46-428e-957c-4b10f53e2441">

Co-authored-by: silverwind <me@silverwind.io>
2024-03-14 22:08:59 +00:00
e0a9a921af Support GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env () ()
Backport  by @wolfogre

I was trying to run unit tests for Gitea on act runner, by using `make
test`.

It failed with log:

```
2024/03/14 03:09:26 ...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run as root. Sorry. If you need to use privileged TCP ports please instead use setcap and the `cap_net_bind_service` permission
```

So it will be convenient to skip by setting environment, since it's OK
to use root user in job containers.

It's not a bug, but I want to backport it to v1.21 since it doesn't
break anything.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-14 10:02:37 +00:00
e03cf66e8b Fix missing translation on milestons () ()
Backport  by @lunny

Caused by 
Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-03-14 09:21:04 +01:00
61db562a5f Fix user router possbile panic () ()
regression from 
backport 
2024-03-14 12:44:14 +08:00
538efb9df7 Make runs-on support variable expression () ()
backport  

Close issue: https://gitea.com/gitea/act_runner/issues/445
Follow: https://gitea.com/gitea/act/pulls/91

Move `getSecretsOfTask` and `getVariablesOfTask` under models because of
circular dependency issues.
2024-03-14 10:19:01 +08:00
5e3581f073 Fix possible NPE in ToPullReviewList () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-13 21:42:17 +01:00
bb9860307f Update to labeler v5 () ()
Backport 

Updated to actions/labeler@v5

Updated labeler config accordingly, also improved the config and added
more labels.

Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-13 13:42:55 +00:00
bb2640c485 Fix incorrect package link method calls in templates () ()
Backport 
Fix 
Fix 
Follow  
2024-03-13 19:43:31 +08:00
462ae88fc2 Suppress error from monaco-editor () ()
Backport  by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/29414

I see no way for us to catch this error, so downgrade it until
https://github.com/microsoft/monaco-editor/issues/4325 is fixed, which
will likely take a few weeks to propagate up from vscode.

The entries in `updates.config.js` will make
[`updates`](https://github.com/silverwind/updates) not upgrade these
anymore and I think it's good documentation as well to have the reasons
why we don't upgrade these dependencies.

Co-authored-by: silverwind <me@silverwind.io>
2024-03-13 09:02:00 +01:00
1e4d5a5594 Add changelog for 1.21.8 ()
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
2024-03-13 03:10:02 +00:00
6124c78de0 Fix date rendering by adding <gitea-absolute-date> () ()
Backport  by @silverwind

Alternative to: https://github.com/go-gitea/gitea/pull/29698
Fixes: https://github.com/go-gitea/gitea/issues/29034

<img width="278" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/12ecd967-2723-410d-8a28-a1b0f41b7bba">

It also fixes a secondary issue that we were showing timestamp tooltips
over date, which makes no sense, so these are now gone as well:

<img width="284" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/a70432f3-97b6-41e6-b202-b53b76924a66">

Co-authored-by: silverwind <me@silverwind.io>
2024-03-13 01:04:58 +01:00
12b429c0d1 Improve CSV rendering () ()
Backport  by @silverwind

Before:

<img width="1332" alt="Screenshot 2024-03-06 at 21 42 17"
src="https://github.com/go-gitea/gitea/assets/115237/0ea07eee-31f8-4783-bd56-37bd8396f00d">

After:
<img width="1336" alt="Screenshot 2024-03-06 at 21 41 58"
src="https://github.com/go-gitea/gitea/assets/115237/eb7f9cc9-587f-4e3b-92bd-cc67ca639963">

Co-authored-by: silverwind <me@silverwind.io>
2024-03-12 21:45:45 +00:00
8c31456a87 Use Get but not Post to get actions artifacts () ()
backport 
2024-03-12 17:31:45 +01:00
4bfc43ef8d Fix inconsistent rendering of block mathematical expressions () ()
Backport  by @yp05327

Fix 

GitHub render `\```math\``` ` as a block now.
Add `display` class will render it as a block.

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/2a1c20c7-438e-4ab1-8c66-cf91c8343087)

![image](https://github.com/go-gitea/gitea/assets/18380374/b81b8a93-8bca-46a5-b7db-e0d2f53e1342)

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-11 10:10:07 +01:00
93e105a228 fix: rendering internal file links in org () ()
Backport  by @ankitrgadiya

The internal links to other files in the repository were not rendering
with the Src Prefix (/src/branch-name/file-path). This commit fixes that
by using the `SrcLink` as base if available.

Resolves 

Co-authored-by: Ankit R Gadiya <git@argp.in>
2024-03-10 18:29:17 +01:00
e8b6d28ab9 Fix bug hidden on CI and make ci failed if tests failure () ()
Backport  

The tests on migration tests failed but CI reports successfully


https://github.com/go-gitea/gitea/actions/runs/7364373807/job/20044685969#step:8:141

This PR will fix the bug on migrations and also the CI hidden behaviour.

The reason is on the Makefile

`GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini $(GO) test
$(GOTESTFLAGS) -tags='$(TEST_TAGS)' $(MIGRATE_TEST_PACKAGES)` will
return the error exit code.

But

`for pkg in $(shell $(GO) list
code.gitea.io/gitea/models/migrations/...); do \
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini $(GO) test
$(GOTESTFLAGS) -tags '$(TEST_TAGS)' $$pkg; \
	done`

will not work.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2024-03-09 09:44:02 +00:00
346b662305 Don't show AbortErrors on logout () ()
Backport https://github.com/go-gitea/gitea/pull/29639.

When logging out of Gitea, a error toast can be seen for a split second.
I don't know why or how it happens but I found it it's an `AbortError`
(related to
[AbortController#abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)),
so let's hide it.
2024-03-09 17:22:18 +08:00
25b0c99a41 Use more specific selector for name links () ()
Backport  by @silverwind

Followup https://github.com/go-gitea/gitea/pull/29305. As per discussion
in https://github.com/go-gitea/gitea/pull/29666#discussion_r1517506422,
make this selector only search in the current `.markup` document, as
there can be multiples displayed at the same time.

@DanielMatiasCarvalho maybe you can review.

Co-authored-by: silverwind <me@silverwind.io>
2024-03-09 08:40:05 +08:00
bfc7c8a598 Fix user-defined markup links targets () ()
Backport  by @DanielMatiasCarvalho

This seeks to fix the bug reported on issue . 

Cause: 
ID's with custom characters (- , _ , etc.), were not linking correctly
in the Markdown file when rendered in the browser because the ID in the
respective destinies would be different than the one in anchor, while
for IDs with only letters, the ID would be the same.

Fix:
It was suggested that to fix this bug, it should more or less like
GitHub does it. While in gitea the anchors would be put in HTML like
this:
```
<p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p>
<p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p>
<p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p>
<p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p>
<p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p>

```
In GitHub, the same anchor's href properties would be the same without
"user-content-" trailing behind.

So my code made sure to change those anchors, so it would not include
"user-content-" and then add respective Event Listeners so it would
scroll into the supposed places.

Fixes: 

Co-authored-by: DC <106393991+DanielMatiasCarvalho@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
2024-03-08 16:53:36 +00:00
1f89763744 Fix commit_status problem when testing () ()
Backport  by @charles7668

Close 

fix 

Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
2024-03-08 16:04:23 +00:00
a129c0c06c Fix 500 when deleting account with incorrect password or unsupported login type () ()
Fix 
Backport 

Co-authored-by: Jason Song <i@wolfogre.com>
2024-03-08 15:43:57 +01:00
bd7de0c4e4 Add empty repo check in DetectAndHandleSchedules () ()
Backport 
2024-03-08 09:50:04 +00:00
6651d2d87a Fix incorrect rendering csv file when file size is larger than UI.CSV.MaxFileSize () ()
Backport  by @yp05327

Fix 

Co-authored-by: yp05327 <576951401@qq.com>
2024-03-08 09:13:58 +00:00
76b6754c3a Fixing the issue when status check per rule matches multiple actions () ()
Backport  by @charles7668

Close 
rule
```
Test / Build*
Test / Build *
Test / Build 2*
Test / Build 1*
```

![image](https://github.com/go-gitea/gitea/assets/30816317/19bef0a9-fa97-43c5-887b-dece76064aa8)
rule2
```
Test / Build*
Test / Build 1*
```

![image](https://github.com/go-gitea/gitea/assets/30816317/19bef0a9-fa97-43c5-887b-dece76064aa8)

rule3
```
Test / Build*
Test / Build 1*
NotExist*
```

![image](https://github.com/go-gitea/gitea/assets/30816317/f6a5e832-2e1b-4049-915b-45bec5ef070c)

Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-03-08 13:24:32 +08:00
0b5a4e7db4 Use strict protocol check when redirect () ()
Backport  by wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-07 03:53:33 +00:00
b6a2b9594a Update Twitter Logo () ()
Backport https://github.com/go-gitea/gitea/pull/29621
<img width="430" alt="image"

src="https://github.com/go-gitea/gitea/assets/115237/9cf7b0a3-406b-4dd6-ab3d-d31a96b9335a">
2024-03-06 17:41:23 +01:00
6ee58a0ac2 Avoid issue info panic () ()
Backport  by wxiaoguang

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-06 13:33:29 +00:00
2f1eb619bc Avoid unexpected panic in graceful manager () ()
Backport 
2024-03-06 11:00:21 +00:00
9db426ad8c Fix wrong line number in code search result () ()
Backport  by @yp05327

Fix 

Before:
The result is a table and all line numbers are all in one row.

![image](https://github.com/go-gitea/gitea/assets/18380374/7a18b354-e257-4f57-a5ca-f6d37378edf6)

![image](https://github.com/go-gitea/gitea/assets/18380374/98416e11-89b5-4b4f-920b-91bcf041a87f)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/f189e436-9046-4431-926a-cd0deb58e8f1)

![image](https://github.com/go-gitea/gitea/assets/18380374/07d213ed-2401-4b7f-b951-5df7dc776af4)

~~Updated:~~
~~added `active` class to the target line.~~

![image](https://github.com/go-gitea/gitea/assets/18380374/0b274e48-048a-4c66-ba95-df515212ec08)

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-06 10:05:41 +01:00
a8277cfc8f bump protobuf module () ()
backport 
2024-03-06 13:16:35 +08:00
5667ef9aab Add missing database transaction for new issue () ()
When creating an issue, inserting issue, assign users and set project
should be in the same transaction.

Backport 
2024-03-05 16:37:55 +00:00
02df269d24 Make "/user/login" page redirect if the current user has signed in () ()
Backport 
2024-03-05 21:03:45 +08:00
4ef7e496b8 Add a trailing slash to dashboard links () ()
Backport 
2024-03-04 13:50:55 +08:00
b519e4750b Fix workflow trigger event IssueChangeXXX bug () ()
Backport  by @yp05327

Bugs from 
Follow 

partly fix 

Co-authored-by: yp05327 <576951401@qq.com>
2024-03-04 04:34:46 +08:00
b84303ef6e Fix 500 when pushing release to an empty repo () ()
Backport  by @lng2020

As title. 
The former code directly used `ctx.Repo.GitRepo`, causing 500.

22b4f0c09f/routers/api/v1/repo/release.go (L241)

Co-authored-by: Nanguan Lin <nanguanlin6@gmail.com>
2024-03-03 17:10:22 +00:00
2b059f493e Only use supported sort order for "explore/users" page () ()
Backport 

Thanks to inferenceus : some sort orders on the "explore/users" page
could list users by their lastlogintime/updatetime.

It leaks user's activity unintentionally. This PR makes that page only
use "supported" sort orders.

Removing the "sort orders" could also be a good solution, while IMO at
the moment keeping the "create time" and "name" orders is also fine, in
case some users would like to find a target user in the search result,
the "sort order" might help.
2024-03-03 02:28:45 +00:00
5ca2971ccb Fix incorrect cookie path for AppSubURL () ()
Backport 
Regression of 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-03 08:54:33 +08:00
63ec6facea gitea.service: Remove syslog.target () ()
Backport  by @C0rn3j

Remove syslog.target from service file, this target hasn't existed for
over a decade.


6aa8d43ade/NEWS (L72-L73)

Co-authored-by: Martin <spleefer90@gmail.com>
2024-03-03 00:57:10 +01:00
971eab18fa Fix incorrect redirection when creating a PR fails () ()
Backport  by wxiaoguang

This is only a quick fix to make it easier to backport.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-02 20:01:19 +00:00
86cd94cba6 Fix queue worker incorrectly stopped when there are still more items in the queue () ()
Backport 

Without `case <-t.C`, the workers would stop incorrectly, the test won't
pass. For the worse case, there might be only one running worker
processing the queue items for long time because other workers are
stopped. The root cause is related to the logic of doDispatchBatchToWorker.
It isn't a serious problem at the moment, so keep it as-is.
2024-03-02 19:40:06 +00:00
8723389028 Fix incorrect relative/absolute URL usages () ()
Backport  by wxiaoguang

Add two "HTMLURL" methods for PackageDescriptor. 
And rename "FullWebLink" to "VersionWebLink"

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-02 18:00:15 +00:00
401cc394d5 Fix incorrect subpath in links () ()
Backport  by wxiaoguang

* `$referenceUrl`: it is constructed by "Issue.Link", which already has
the "AppSubURL"
* `window.location.href`: AppSubURL could be empty string, so it needs
the trailing slash

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-02 12:26:54 +00:00
3a8877c058 Fix issue link does not support quotes () () ()
Backport  by @charles7668

Close 

![圖片](https://github.com/go-gitea/gitea/assets/30816317/b27e6e16-67e0-469c-8e04-30180c585890)

Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
2024-03-02 19:37:45 +08:00
a86d9337e9 Fix issue & comment history bugs () ()
Backport  by @wxiaoguang

* Follow : `HasIssueContentHistory` should use expr builder to
make sure zero value (0) be respected.
* Add "doer" check to make sure `canSoftDeleteContentHistory` only be
called by sign-in users.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-03-02 08:45:48 +08:00
8d08558783 Set pre-step status to skipped if job is skipped () ()
Backport  by @sillyguodong

close 
1. Set pre-step (Set up job) status to `skipped` if job is skipped.
2. Apart from pre-step, the other steps should also be set to `skipped`.
The status of other steps are reported from the runner side. This will
be completed by this PR: https://gitea.com/gitea/act_runner/pulls/500

before:

![image](https://github.com/go-gitea/gitea/assets/33891828/4bac2ba9-66de-4679-b7ed-fbae459c0c54)

after:

![image](https://github.com/go-gitea/gitea/assets/33891828/ead4871a-4e0f-4bb1-9fb4-37f4fdb78dfc)

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
2024-03-01 14:51:54 +01:00
730cd2dee4 Update FAQ about git hook problems () ()
Backport  by @wolfogre

Close
https://github.com/go-gitea/gitea/issues/29338#issuecomment-1970363817

Co-authored-by: Jason Song <i@wolfogre.com>
2024-02-29 22:36:00 +08:00
65b9ffe3c0 Improve contrast on blame timestamp, fix double border () ()
Backport  by @silverwind

Before, double border on top, bad contrast on dark:
<img width="155" alt="Screenshot 2024-02-29 at 02 06 17"
src="https://github.com/go-gitea/gitea/assets/115237/fc0f1e08-a5ce-47ed-9eb6-135eed5a1abb">
<img width="126" alt="Screenshot 2024-02-29 at 02 07 28"
src="https://github.com/go-gitea/gitea/assets/115237/38ae8483-8d9b-484c-8909-d4466131ea16">

After, no double border on top, good contrast:
<img width="154" alt="Screenshot 2024-02-29 at 02 20 20"
src="https://github.com/go-gitea/gitea/assets/115237/ad91282b-e9f5-4f41-8f5e-6ba28db3beac">
<img width="147" alt="Screenshot 2024-02-29 at 02 20 38"
src="https://github.com/go-gitea/gitea/assets/115237/7ee2ec92-e72a-4981-aec3-98fc8e579bae">

Co-authored-by: silverwind <me@silverwind.io>
2024-02-29 08:51:42 +00:00
c293e34df0 Fix wrong test usage of AppSubURL () ()
Backport  by @KN4CK3R

The tests use an invalid `setting.AppSubURL`. The wrong behaviour
disturbs other PRs like  and .

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-29 14:40:35 +08:00
9abba8c11a Fix/Improve processWindowErrorEvent () ()
Backport  by @silverwind

- `e.error` can be undefined in some cases which would raise an error
inside this error handler, fixed that.
- The displayed message mentions looking into the console, but in my
case of error from `ResizeObserver` there was nothing there, so add this
logging. I think this logging was once there but got lost during
refactoring.

Co-authored-by: silverwind <me@silverwind.io>
2024-02-29 01:22:53 +01:00
5477728282 Fix counter display number incorrectly displayed on the page () ()
Backport  by @charles7668

issue : 

The counter number script uses the 'checkbox' attribute to determine
whether an item is selected or not.

However, the input event only increments the counter value, and when
more items are displayed, it does not update all previously loaded
items.

As a result, the display becomes incorrect because it triggers the
update counter script, but checkboxes that are selected without the
'checked' attribute are not counted

Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
2024-02-28 23:13:49 +01:00
b43ce53a23 Fix workflow trigger event bugs () ()
Backport  by @Zettat123

1. Fix incorrect `HookEventType` for issue-related events in
`IssueChangeAssignee`
2. Add `case "types"` in the `switch` block in `matchPullRequestEvent`
to avoid warning logs

Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-02-28 21:24:51 +01:00
222f93822e Fix URL calculation in clone input box () ()
Backport  by @silverwind

Ported the function as-is and added comments so we don't forget about
this in the future.

Fixes: https://github.com/go-gitea/gitea/issues/29462

Co-authored-by: silverwind <me@silverwind.io>
2024-02-28 15:25:53 +00:00
eabcfd3f7d The job should always run when if is always() () ()
Backport  by @Zettat123

Fix 

According to GitHub's
[documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds),
a job should always run when its `if` is `always()`

> If you would like a job to run even if a job it is dependent on did
not succeed, use the `always()` conditional expression in
`jobs.<job_id>.if`.

Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-02-28 12:22:31 +01:00
2df38af752 Fix missed return () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-02-27 23:33:03 +08:00
dc48eb070b Fix template bug () ()
Fix 
Backport 
2024-02-27 11:11:38 +00:00
06dc26167a Update docs about DEFAULT_ACTIONS_URL () ()
Backport .

Follow .
2024-02-27 18:16:08 +08:00
9456deb512 Not trigger all jobs any more, when re-running the first job () ()
Backport  by @sillyguodong

Previously, it will be treated as "re-run all jobs" when `jobIndex ==
0`. So when you click re-run button on the first job, it triggers all
the jobs actually.

Caused by .

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
2024-02-27 16:18:49 +08:00
c758a8afba Ignore empty repo for CreateRepository in action notifier () ()
Backport  by @yp05327

Fix 

Co-authored-by: yp05327 <576951401@qq.com>
2024-02-26 09:59:12 +00:00
83327e043a Fix incorrect tree path value for patch editor () ()
Backport  by wxiaoguang

Regression of . When submitting the form,
EditRepoFileForm.TreePath is marked as "Required", so the value can't be
empty. The value is not used by backend, so use a meaningful dummy value
for it.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-26 09:26:23 +00:00
78cb09deda Change log for 1.21.7 ()
This is an emergency release to fix the bug .

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-26 15:39:21 +08:00
0f35cb5a2a Add missing space () ()
Backport  by @KN4CK3R

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-26 00:08:44 +08:00
0b3d6c399c enforce maxlength in frontend () ()
Backport  by @zokkis

Set maxlength attribute in frontend

to long file-name

![image](https://github.com/go-gitea/gitea/assets/72873130/15111614-55ab-4583-acb2-15c25997601d)

![image](https://github.com/go-gitea/gitea/assets/72873130/4105ddd8-4973-4da8-b3ab-4cfae1b45554)
(same for branch-name and commit-summary)

Co-authored-by: Tim-Niclas Oelschläger <72873130+zokkis@users.noreply.github.com>
2024-02-25 14:56:44 +00:00
f98a1b851c Users with read permission of pull requests can be assigned too () ()
Backport  by @lunny

This PR will also keep the consistent between list assigned users and
check assigned users.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-02-24 17:42:33 +01:00
e75594f7a6 Do not double close reader () ()
Backport  by @KN4CK3R

Fixes 

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-24 12:08:06 +00:00
a1c0b3a02e Display friendly error message () ()
Backport  

`ctx.Error` only displays the text but `ctx.ServerError` renders the
usual error page.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-24 11:01:18 +00:00
6624f257d3 Docker Tag Information in Docs () ()
Backport  

Add more details for the docker tag when using container registry.

Co-authored-by: wienans <40465543+wienans@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-24 10:41:10 +00:00
35db5a373b Fix validity of the FROM email address not being checked () ()
Backport  by @carlosfelgueiras

Fixes .
Introduces a check on the installation that tries to parse the FROM
address. If it fails, shows a new error message to the user.

Co-authored-by: Carlos Felgueiras <carlosfelgueiras@tecnico.ulisboa.pt>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-24 08:23:21 +00:00
5043ad54c7 Fix project counter in organization/individual profile () ()
Fix 
Backport  
Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/5f299983-4b38-4d68-ac0e-4be3c62c0558)

![image](https://github.com/go-gitea/gitea/assets/18380374/f0e12afd-483b-4882-80e9-0261beb3fe0c)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/47cccb7b-bb35-4a7d-9c5b-83133be0323a)

![image](https://github.com/go-gitea/gitea/assets/18380374/77825c0c-4bf2-4762-83a2-1a5a173cc22d)

Co-authored-by: yp05327 <576951401@qq.com>
2024-02-24 07:58:43 +00:00
727435743a Fix incorrect tests in 1.21 ()
The submitted tests in the patch for the XSS fix is not right.

To test, it should test "what should happen", but not "what doesn't
exist" or "what is processed/decoded".
2024-02-24 15:27:47 +08:00
829b807a91 Fix tarball/zipball download bug () ()
Backport  by @Zettat123

Fix 

~~Use the `/repos/{owner}/{repo}/archive/{archive}` API to download.~~

Apply  to archive download URLs.

Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-02-23 23:47:11 +01:00
874cdcc974 Adjust changelog for v1.21.6 to move prs to correct labels ()
When releasing, the releaser should read all the pull requests carefully
and do some adjustments because some of pull requests' labels are not
right when it's merged.

And the changelog tool needs to be adjusted. If one pull request has
both `bug` and `API`, it should mark it as `bug` but not `API`.
2024-02-23 15:46:56 +08:00
e20023af58 Add Changelog v1.21.6 () 2024-02-22 23:42:29 +01:00
4435d8a4b6 Fix XSS vulnerabilities ()
- The Wiki page did not sanitize author name
- the reviewer name on a "dismiss review" comment is also affected
- the migration page has some spots

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: jolheiser <john.olheiser@gmail.com>
2024-02-22 23:37:21 +01:00
6ca8cb590d Don't show third-party JS errors in production builds () ()
Backport  by @silverwind

So we don't get issues like
https://github.com/go-gitea/gitea/issues/29080 and
https://github.com/go-gitea/gitea/issues/29273 any more. Only active in
[production
builds](https://webpack.js.org/guides/production/#specify-the-mode), in
non-production the errors will still show.

Co-authored-by: silverwind <me@silverwind.io>
2024-02-22 22:49:07 +01:00
65e2811859 Remove SSH workaround () ()
Backport 

- Update github.com/gliderlabs/ssh to include
02f9d57300.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1230

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
2024-02-22 21:45:31 +01:00
b78f5fc60f Only log error when tag sync fails () ()
Backport  by @lunny

Fix 

This PR will bypass the pushUpdateTag to database failure when
syncAllTags. An error log will be recorded.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-22 20:52:54 +01:00
511298e452 Use general token signing secret () ()
Backport  (including )

Use a clearly defined "signing secret" for token signing.
2024-02-22 17:07:41 +00:00
7ea2ffaf16 Fix SSPI user creation () ()
Fixes 
Backport 

Setting the avatar is wrong and creating a random password is equal to
leave it empty.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-22 17:42:14 +01:00
fdb0d03083 Improve the issue_comment workflow trigger event () ()
Backport  by @Zettat123

Fix 
Replace 

This PR makes some improvements to the `issue_comment` workflow trigger
event.

1. Fix the bug that pull requests cannot trigger `issue_comment`
workflows
2. Previously the `issue_comment` event only supported the `created`
activity type. This PR adds support for the missing `edited` and
`deleted` activity types.
3. Some events (including `issue_comment`, `issues`, etc. ) only trigger
workflows that belong to the workflow file on the default branch. This
PR introduces the `IsDefaultBranchWorkflow` function to check for these
events.

Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-02-22 17:19:48 +01:00
ed5e0c8c27 Discard unread data of git cat-file () ()
Backport  by @KN4CK3R

Fixes 
Related 

Discard all read data to prevent misinterpreting existing data. Some
discard calls were missing in error cases.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: yp05327 <576951401@qq.com>
2024-02-22 04:23:38 +00:00
0870e0bc9b Implement some action notifier functions () ()
Backport 

Fix 

Add support for the following activity types of `pull_request`
- assigned
- unassigned
- review_requested
- review_request_removed
- milestoned
- demilestoned
2024-02-22 03:55:03 +00:00
c0b97d0485 Prevent double use of git cat-file session. () ()
Backport 
Fixes the reason why  is hard to replicate.
Related 

Create a repo with a file with minimum size 4097 bytes (I use 10000) and
execute the following code:
```go
gitRepo, err := gitrepo.OpenRepository(db.DefaultContext, <repo>)
assert.NoError(t, err)

commit, err := gitRepo.GetCommit(<sha>)
assert.NoError(t, err)

entry, err := commit.GetTreeEntryByPath(<file>)
assert.NoError(t, err)

b := entry.Blob()

// Create a reader
r, err := b.DataAsync()
assert.NoError(t, err)
defer r.Close()

// Create a second reader
r2, err := b.DataAsync()
assert.NoError(t, err) // Should be no error but is ErrNotExist
defer r2.Close()
```

The problem is the check in `CatFileBatch`:


79217ea63c/modules/git/repo_base_nogogit.go (L81-L87)
`Buffered() > 0` is used to check if there is a "operation" in progress
at the moment. This is a problem because we can't control the internal
buffer in the `bufio.Reader`. The code above demonstrates a sequence
which initiates an operation for which the code thinks there is no
active processing. The second call to `DataAsync()` therefore reuses the
existing instances instead of creating a new batch reader.
2024-02-22 03:20:20 +00:00
f80ea95eb5 Fix gitea-action user avatar broken on edited menu () ()
Backport 

Fix 
2024-02-22 02:53:38 +00:00
dcb9c38568 Fix error display when merging PRs () ()
Backport 
Partially fix , regression of Modernize merge button  

Fix some missing `Redirect` -> `JSONRedirect`.

Thanks @yp05327 for the help in
https://github.com/go-gitea/gitea/issues/29071#issuecomment-1931261075
2024-02-22 03:32:54 +01:00
c4a86b20a4 Fix missing link on outgoing new release notifications () ()
Backport 

Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
Co-authored-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-21 19:01:48 +00:00
f634982d23 Fix debian InRelease Acquire-By-Hash newline () ()
Backport 

Co-authored-by: Robin Schoonover <robin@cornhooves.org>
2024-02-21 19:40:16 +01:00
9379352db6 Always write proc-receive hook for all git versions () ()
Backport 
2024-02-21 12:08:34 +01:00
e940443b27 Do not show delete button when time tracker is disabled () ()
Backport  
Fix 

The delete button of time logs won't be shown when the time tracker is
disabled.
 

![image](https://github.com/go-gitea/gitea/assets/15528715/5cc4e0c9-d2f9-4b8f-a2f5-fe202b94c191)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-20 09:11:01 +00:00
2762921e73 Fix missed edit issues event for actions () ()
Fix 
Backport 
2024-02-20 11:13:05 +08:00
78f41e4fc4 Disallow merge when required checked are missing () ()
backport 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-19 20:48:17 +00:00
c01b266d86 Workaround to clean up old reviews on creating a new one () ()
close  
backport 

---
*Sponsored by Kithara Software GmbH*
2024-02-19 16:48:58 +00:00
e2eac7574f Fix bug when the linked account was disactived and list the linked accounts ()
The bug has been fixed on v1.22 but not backport to v1.21.
This original PR have many refactors so I don't think it's necessary to
backport all of them.

Fix 
2024-02-19 15:23:47 +00:00
Km
5b8b22bd75 Explained where create issue/PR template ()
For some user (as me), documentation lack of precision about where to
store issue/pr template.

I propose an enhancement about this point. With bold exergue and
precision about server itself.

I've found some user with same interrogation as :
https://forum.gitea.com/t/issue-template-directory/3328

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-02-19 15:57:25 +01:00
f79530c50e Do not use lower tag names to find releases/tags () ()
Backport .

Fix , see
https://github.com/go-gitea/gitea/issues/26090#issuecomment-1952013206

Since `TagName` stores the original tag name and `LowerTagName` stores
the lower tag name, it doesn't make sense to use lowercase tags as
`TagNames` in `FindReleasesOptions`.

5e72526da4/services/repository/push.go (L396-L397)

While the only other usage looks correct:

5e72526da4/routers/web/repo/repo.go (L416)
2024-02-19 10:09:36 +00:00
39735c43a8 Convert visibility to number () ()
Backport 

Don't throw error while creating user (Fixes )

---

The backport info from Giteabot
https://github.com/go-gitea/gitea/pull/29226#issuecomment-1951341322
needs to specify the version, because the default is v1.18
2024-02-18 18:51:00 +00:00
3604b7d8ad Load outdated comments when (un)resolving conversation on PR timeline () ()
Backport 

Relates to ,  and .

The "show outdated comments" flag should only apply to the file diff
view.
On the PR timeline, outdated comments are always shown. So they should
also be loaded when (un)resolving a conversation on the timeline page.
2024-02-18 06:58:26 +00:00
d41d367c35 Make submit event code work with both jQuery event and native event () ()
Backport  (no conflict)
2024-02-18 06:36:41 +00:00
7e0299b4fd Only delete scheduled workflows when needed () ()
Backport  

Fix 

`handleSchedules` should be called only if `DetectWorkflows` should
detect schedule workflows
2024-02-18 14:31:05 +08:00
933cc4da64 Fix push to create with capitalize repo name () ()
Fix 
Backport 

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-02-17 12:06:55 +00:00
fea6bd130e rm outdated docs from some languages () ()
backport  to make pull request lint happy
https://github.com/go-gitea/gitea/actions/runs/7939560756/job/21679856929?pr=29206
since 

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2024-02-17 12:44:33 +01:00
906a722fca Refactor git version functions and check compatibility () ()
Backport  with an extra change: tolerate the git 2.43.1 GIT_FLUSH
bug in Gitea 1.21.x, more details in the comment of repo_attribute.go

Manually tested with git 2.43.1 and an old git (2.39.2)
2024-02-17 02:47:18 +00:00
8cd83ff391 Rework spellchecking, add lint-spell ()
Backport clean cherry-picks of
9c39f8515f
and
c7a21cbb0c
onto 1.21.

- Use maintained fork https://github.com/golangci/misspell
- Rename `mispell-check` to `lint-spell`, add `lint-spell-fix`
- Run `lint-spell` in separate actions step
- Lint more files, fix discovered issues
- Remove inaccurate and outdated info in docs (we do not need GOPATH for
tools anymore)

Maybe later we can add more spellchecking tools, but I have not found
any good ones yet.
2024-02-16 02:42:26 +00:00
d823465d94 Use ghost user if user was not found () ()
Backport 
2024-02-14 12:51:51 -05:00
dd8bc1d61d Refactor issue template parsing and fix API endpoint () ()
Backport 

The old code `GetTemplatesFromDefaultBranch(...) ([]*api.IssueTemplate,
map[string]error)` doesn't really follow Golang's habits, then the
second returned value might be misused. For example, the API function
`GetIssueTemplates` incorrectly checked the second returned value and
always responds 500 error.

This PR refactors GetTemplatesFromDefaultBranch to
ParseTemplatesFromDefaultBranch and clarifies its behavior, and fixes
the API endpoint bug, and adds some tests.

And by the way, add proper prefix `X-` for the header generated in
`checkDeprecatedAuthMethods`, because non-standard HTTP headers should
have `X-` prefix, and it is also consistent with the new code in
`GetIssueTemplates`
2024-02-14 01:32:31 +00:00
0ac3186267 Dont load Review if Comment is CommentTypeReviewRequest () ()
Backport 

RequestReview get deleted on review.
So we don't have to try to load them on comments.
2024-02-13 23:29:33 +01:00
732d511e04 Refactor parseSignatureFromCommitLine () ()
Backport . Fix 

This backport is for 1.21 only and it is different from the change in
1.22: this backport still accept the legacy date format to avoid
breaking.
2024-02-09 10:26:43 +01:00
1aaeec6da7 Fix swift packages not resolving () () 2024-02-08 18:26:54 +00:00
315155fab0 Fix incorrect link to swift doc and swift package-registry login command () () 2024-02-08 18:05:10 +00:00
9a4d283e9a Avoid showing unnecessary JS errors when there are elements with different origin on the page () ()
Backport  by wxiaoguang

Try to fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-08 02:48:06 +00:00
fb7f28e9a7 Fix gitea-origin-url with default ports () ()
Backport  by @silverwind

When setting `url.host` on a URL object with no port specified (like is
the case of default port), the resulting URL's port will not change.
Workaround this quirk in the URL standard by explicitely setting port
for the http and https protocols.

Extracted the logic to a function for the purpose of testing. Initially
I wanted to have the function in utils.js, but it turns out esbuild can
not treeshake the unused functions which would result in the
webcomponents chunk having all 2kB utils.js inlined, so it seemed not
worth.

Fixes: https://github.com/go-gitea/gitea/issues/29084

Co-authored-by: silverwind <me@silverwind.io>
2024-02-08 02:41:49 +00:00
c9b2aaed0e Improve user experience for outdated comments () ()
Backport  by wxiaoguang

Try to improve 

1. Make `ctx.Data["ShowOutdatedComments"] = true` by default: it brings
consistent user experience, and sometimes the "outdated (source
changed)" comments are still valuable.
2. Show a friendly message if the comment won't show, then the end users
won't fell that "the comment disappears" (it is the special case when
`ShowOutdatedComments = false`)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-08 10:29:54 +08:00
19a08c7fe2 Fix orgmode link resolving () ()
Backport 
Also backport  (remove unnecessary titles)

Fix 

Add some new tests and fix some legacy unclear tests.
2024-02-07 17:24:28 +00:00
f0d34cd3b9 fix: Elasticsearch: Request Entity Too Large () ()
Backport  by @inferno-umar

Fix for gitea putting everything into one request without batching and
sending it to Elasticsearch for indexing as issued in 

This issue occured in large repositories while Gitea tries to 
index the code using ElasticSearch.

Co-authored-by: dark-angel <70754989+inferno-umar@users.noreply.github.com>
2024-02-07 17:21:28 +08:00
7ed79b748f Hide code links on release page if user cannot read code () ()
Backport  by @wolfogre

On the release list page, if the user doesn't have the permission to
read code, the code links will lead to 404 pages or api errors:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a74fbc63-6dd6-43c6-853c-28acdbfdcb4e">


After this PR:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a626373d-c2df-40a9-8fed-1b12ff6bc56f">

And this PR also removed some dead code. After , the tag list page
has an independent template, and all `IsTag` in the release list
template are always false.

Co-authored-by: Jason Song <i@wolfogre.com>
2024-02-06 21:36:56 +08:00
b9b2ae214d Fix typos in the documentation () ()
Backport 

Corrected two typos.
2024-02-05 21:15:49 +08:00
aadbbf4358 Do not render empty comments () ()
Backport  by wxiaoguang

Follow 

The `comments` might be empty, so the templates shouldn't (and couldn't)
use it to render. When there is no comment, the UI should also be
updated to empty, so returning an empty body is good enough.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-04 13:25:58 +00:00
Km
8e957e5f1d labels and licenses are directories ()
Be more explicit about custom path relative to licences and labels
content
2024-02-03 18:11:41 -05:00
8def405047 Avoid sending update/delete release notice when it is draft () ()
Backport  by @yp05327

Fix 

Co-authored-by: yp05327 <576951401@qq.com>
2024-02-02 09:37:37 +00:00
5ac41026f9 Wrap contained tags and branches again () ()
Backport  by @delvh

Fixes 

## After


![grafik](https://github.com/go-gitea/gitea/assets/51889757/2c72ee8f-439e-4328-85df-77772e0f4aef)

Co-authored-by: delvh <dev.lh@web.de>
2024-02-02 16:05:47 +08:00
333d02ddfd Fix incorrect button CSS usages () ()
Backport  by @wxiaoguang

Fix 2 problems:

1. Remove the legacy (non-existing) CSS: `class="btn btn-gray
btn-radius"`
2. Remove the button styles inside the `ui message`, according to:
https://fomantic-ui.com/collections/message.html , the button shouldn't
have any border/padding.

### Before


![image](https://github.com/go-gitea/gitea/assets/2114189/4c7e98e2-4e8a-493f-9b7e-446a365066a1)



![image](https://github.com/go-gitea/gitea/assets/2114189/05221251-7a79-4c96-8973-fb4588275672)

### After



![image](https://github.com/go-gitea/gitea/assets/2114189/8bc3edbc-42a6-40bd-85fd-de40e94841d4)


![image](https://github.com/go-gitea/gitea/assets/2114189/93f69143-d835-437c-b5eb-0f6dddde97a1)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-02 01:10:23 +01:00
5d1abdce3e Strip trailing newline in markdown code copy () ()
Behaviour now matches GH. Safeguard added in the for loop because
`textContent` may be null in which case it does not make sense to render
the copy button.

Co-authored-by: silverwind <me@silverwind.io>
2024-02-01 21:06:21 +00:00
2588d73ebf Add changelog for 1.21.5 ()
As title.
2024-02-01 11:02:41 +00:00
a0b9bd2feb Revert "Speed up loading the dashboard on mysql/mariadb ()" () ()
Backport  by @lunny

This reverts commit fa8c3beb26acfcc7e732038c947225857ebcbf31.  
Because it seems performance become worse.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-02-01 18:58:44 +08:00
c398c25b18 Fix an actions schedule bug () ()
Backport  by @Zettat123

In , schedule plans will be deleted when a repo's actions unit is
disabled. But when the unit is enabled, the schedule plans won't be
created again.

This PR fixes the bug. The schedule plans will be created again when the
actions unit is re-enabled

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-31 15:52:31 +00:00
2048363f9e Don't remove all mirror repository's releases when mirroring () ()
Backport  by @lunny

Fix 

# Purpose

This PR fix the releases will be deleted when mirror repository sync the
tags.

# The problem

In the previous implementation of . All releases record in
databases of one mirror repository will be deleted before sync.
Ref:
https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481

# The Pros

This PR introduced a new method which will load all releases from
databases and all tags on git data into memory. And detect which tags
needs to be inserted, which tags need to be updated or deleted. Only
tags releases(IsTag=true) which are not included in git data will be
deleted, only tags which sha1 changed will be updated. So it will not
delete any real releases include drafts.

# The Cons

The drawback is the memory usage will be higher than before if there are
many tags on this repository. This PR defined a special release struct
to reduce columns loaded from database to memory.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-31 04:23:26 +00:00
b8e6cffd31 Preserve BOM in web editor () ()
Backport  by @silverwind

The `ToUTF8*` functions were stripping BOM, while BOM is actually valid
in UTF8, so the stripping must be optional depending on use case. This
does:

- Add a options struct to all `ToUTF8*` functions, that by default will
strip BOM to preserve existing behaviour
- Remove `ToUTF8` function, it was dead code
- Rename `ToUTF8WithErr` to `ToUTF8`
- Preserve BOM in Monaco Editor
- Remove a unnecessary newline in the textarea value. Browsers did
ignore it, it seems but it's better not to rely on this behaviour.

Fixes: https://github.com/go-gitea/gitea/issues/28743
Related: https://github.com/go-gitea/gitea/issues/6716 which seems to
have once introduced a mechanism that strips and re-adds the BOM, but
from what I can tell, this mechanism was removed at some point after
that PR.

Co-authored-by: silverwind <me@silverwind.io>
2024-01-27 23:23:31 +01:00
1ddcaedb88 Strip / from relative links () ()
Backport  by @KN4CK3R

Fixes 

Restores the old behaviour:

https://github.com/go-gitea/gitea/pull/26745/files#diff-d78a9d361b1fddc12218e4dd42f42d39d6be1fda184041e06bb6fb30f0d94c59L96

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-01-27 15:14:36 +00:00
7291fecab3 Make loading animation less aggressive () ()
Backport  by @yardenshoham

The current animation loops in a very fast manner, causing a slight
feeling of uncomfortableness. This change slows it a bit for a smoother
experience.

# Before


![before](https://github.com/go-gitea/gitea/assets/20454870/215a722d-feb4-4643-819d-c37a620c5e48)

# After


![after](https://github.com/go-gitea/gitea/assets/20454870/7acb1fab-9157-4f4d-8cc7-45fea0234b47)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2024-01-27 20:38:14 +08:00
c33886b710 Update go dependencies and fix go-git () ()
Backport 
2024-01-26 15:08:43 +08:00
d6eb6c90f4 fix: update enable_prune even if mirror_interval is not provided () ()
Backport  by @Anthony-Jhoiro

Currently, the `updateMirror` function which update the mirror interval
and enable prune properties is only executed by the `Edit` function. But
it is only triggered if `opts.MirrorInterval` is not null, even if
`opts.EnablePrune` is not null.

With this patch, it is now possible to update the enable_prune property
with a patch request without modifying the mirror_interval.

## Example request with httpie

### Currently:
**Does nothing**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" -A bearer -a $gitea_token
```

**Updates both properties**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" "mirror_interval=10m" -A bearer -a $gitea_token
```

### With the patch
**Updates enable_prune only**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" -A bearer -a $gitea_token
```

Co-authored-by: Anthony Quéré <47711333+Anthony-Jhoiro@users.noreply.github.com>
2024-01-26 00:14:38 +01:00
55c53080d1 Implement MigrateRepository for the actions notifier () ()
Backport  by @Zettat123

Fixes 

This PR implements the `MigrateRepository` method for `actionsNotifier`
to detect the schedules from the workflow files in the migrated
repository.

Co-authored-by: Zettat123 <zettat123@gmail.com>
2024-01-25 12:27:11 +00:00
8766f65add Respect branch info for relative links () ()
Backport  by @KN4CK3R

Fix 

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-01-25 10:40:29 +01:00
e95006848e Upgrade xorm to v1.3.7 to fix a resource leak problem caused by Iterate () ()
backport 

Mainly fix an error https://gitea.com/xorm/xorm/issues/2393
2024-01-25 03:12:11 +00:00
9210ce4045 Don't reload timeline page when (un)resolving or replying conversation () ()
Backport 
Fixes 
2024-01-24 20:09:48 +01:00
cebf55f6b1 Only migrate the first 255 chars of a Github issue title () ()
Backport  by @JakobDev

Fixes 

Co-authored-by: JakobDev <jakobdev@gmx.de>
2024-01-24 19:56:54 +08:00
b508813fe4 Fix sort bug on repository issues list () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-23 08:00:52 +01:00
fd1edb9d9d Fix DeleteCollaboration transaction behaviour () ()
Backport  by @KN4CK3R

The method can't be called with an outer transaction because if the user
is not a collaborator the outer transaction will be rolled back even if
the inner transaction uses the no-error path.

`has == 0` leads to `return nil` which cancels the transaction. A
standalone call of this method does nothing but if used with an outer
transaction, that will be canceled.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-01-22 09:10:45 +01:00
633996db8e Fix schedule not trigger bug because matching full ref name with short ref name () ()
Backport  by @lunny

Fix 

Caused by 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-22 13:33:14 +08:00
7f0ce2dfc7 Fix uploaded artifacts should be overwritten () backport v1.21 ()
Backport https://github.com/go-gitea/gitea/pull/28726 by @fuxiaohei

Fix Uploaded artifacts should be overwritten
https://github.com/go-gitea/gitea/issues/28549

When upload different content to uploaded artifact, it checks that
content size is not match in db record with previous artifact size, then
the new artifact is refused.

Now if it finds uploading content size is not matching db record when
receiving chunks, it updates db records to follow the latest size value.
2024-01-22 09:49:21 +08:00
b7c944b9e4 Prevent anonymous container access if RequireSignInView is enabled () ()
Backport  by @KN4CK3R

Fixes 

If `RequireSignInView` is enabled, the ghost user has no access rights.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-01-22 01:44:38 +08:00
cf9a416d62 Fix migrate storage bug () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-21 16:32:06 +00:00
8c7bda8755 Fix incorrect PostgreSQL connection string for Unix sockets () ()
Backport  by @sdvcrx

Fix 

Co-authored-by: sdvcrx <memory.silentvoyage@gmail.com>
2024-01-21 16:06:34 +00:00
b7e32b2382 Avoid duplicate JS error messages on UI () ()
Backport  by wxiaoguang

Gitea treat JS errors seriously, so sometimes the JS errors caused by
3rdparty code (eg: browser extensions) would also be reported on Gitea
UI: TypeError: WeakMap key undefined (caused by extension DarkReader's
bug) 

To avoid fill the user's screen with a lot of error messages, this PR
merges the same error messages into one.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-01-21 15:40:26 +00:00
e3dfb512d6 Warn that DISABLE_QUERY_AUTH_TOKEN is false only if it's explicitly defined () ()
Backport  by @yardenshoham

So we don't warn on default behavior

- Fixes https://github.com/go-gitea/gitea/issues/28758
- Follows https://github.com/go-gitea/gitea/pull/28390

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2024-01-21 15:21:22 +00:00
0d50f27469 Fix archive creating LFS hooks and breaking pull requests () ()
Backport  by @brechtvl

When LFS hooks are present in gitea-repositories, operations like git
push for creating a pull request fail. These repositories are not meant
to include LFS files or git push them, that is handled separately. And
so they should not have LFS hooks.

Installing git-lfs on some systems (like Debian Linux) will
automatically set up /etc/gitconfig to create LFS hooks in repositories.
For most git commands in Gitea this is not a problem, either because
they run on a temporary clone or the git command does not create LFS
hooks.

But one case where this happens is git archive for creating repository
archives. To fix that, add a GIT_CONFIG_NOSYSTEM=1 to disable using the
system configuration for that command.

According to a comment, GIT_CONFIG_NOSYSTEM is not used for all git
commands because the system configuration can be intentionally set up
for Gitea to use.

Resolves , 

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2024-01-21 14:43:31 +00:00
62f2d717b7 Fix reverting a merge commit failing () ()
Backport https://github.com/go-gitea/gitea/pull/28794

Fixes 

---
Error occurring currently while trying to revert commit using read-tree
-m approach:
> 2022/12/26 16:04:43 ...rvices/pull/patch.go:240:AttemptThreeWayMerge()
[E] [63a9c61a] Unable to run read-tree -m! Error: exit status 128 -
fatal: this operation must be run in a work tree
> 	 - fatal: this operation must be run in a work tree

We need to clone a non-bare repository for `git read-tree -m` to work.


bb371aee6e
adds support to create a non-bare cloned temporary upload repository.

After cloning a non-bare temporary upload repository, we [set default
index](https://github.com/go-gitea/gitea/blob/main/services/repository/files/cherry_pick.go#L37)
(`git read-tree HEAD`).
This operation ends up resetting the git index file (see investigation
details below), due to which, we need to call `git update-index
--refresh` afterward.

Here's the diff of the index file before and after we execute
SetDefaultIndex: https://www.diffchecker.com/hyOP3eJy/

Notice the **ctime**, **mtime** are set to 0 after SetDefaultIndex.

You can reproduce the same behavior using these steps:
```bash
$ git clone https://try.gitea.io/me-heer/test.git -s -b main
$ cd test
$ git read-tree HEAD
$ git read-tree -m 1f085d7ed8 1f085d7ed8 9933caed00
error: Entry '1' not uptodate. Cannot merge.
```

After which, we can fix like this:
```bash
$ git update-index --refresh
$ git read-tree -m 1f085d7ed8 1f085d7ed8 9933caed00
```
2024-01-21 14:18:37 +00:00
89960c3dfb tests: missing refs/ in bare repositories () ()
Backport  by @AdamMajer

Git 2.43.0 will not detect a git repository as valid without refs/
subdirectory present. `git gc` cleans this up and puts it in
packed-refs. We must keep refs/ non-empty.

Co-authored-by: Adam Majer <amajer@suse.de>
2024-01-19 15:39:21 +08:00
8b5c9186a5 Remove duplicated checkinit on git module () ()
Backport  by @lunny

`checkInit` has been invoked in `InitSimple`. So it's unnecessary to
invoke it twice in `InitFull`.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-17 10:16:33 +00:00
8b4abb1719 Bump @github/relative-time-element to 4.3.1 () ()
Backport 

- Fixes https://github.com/go-gitea/gitea/issues/28747

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/65d8dc84-680f-4c16-9aa1-b5986102e4e7)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/7cb288e7-ebde-4e94-a10a-cac28d6bdcfd)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
2024-01-17 17:52:06 +08:00
f4923854f6 Add changelog for 1.21.4 () 2024-01-17 10:46:50 +08:00
d590607106 Render code block in activity tab () ()
Backport  by @JakobDev

This is a little bugfix. Inline code is usually rendered in issue
titles, but it is missing in the activity tab.

Before:
![Screenshot 2024-01-16 at 14-20-51
Test](https://github.com/go-gitea/gitea/assets/15185051/383370f3-0fb2-49de-81cc-014e5cf86727)
After:

![grafik](https://github.com/go-gitea/gitea/assets/15185051/83eaf973-ce9a-44ce-beea-2db49fc8bd73)

Co-authored-by: JakobDev <jakobdev@gmx.de>
2024-01-17 01:35:26 +01:00
4746291b08 Use refname:strip-2 instead of refname:short when syncing tags () ()
Backport  by @lunny

Fix  

Generally, `refname:short` should be equal to `refname:lstrip=2` except
`core.warnAmbiguousRefs is used to select the strict abbreviation mode.`

ref:
https://git-scm.com/docs/git-for-each-ref#Documentation/git-for-each-ref.txt-refname

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-16 07:33:33 +00:00
022552d5b6 Rework markup link rendering () ()
Backport 
Fixes 

This PR refactors the rendering of markup links. The old code uses
`strings.Replace` to change some urls while the new code uses more
context to decide which link should be generated.

The added tests should ensure the same output for the old and new
behaviour (besides the bug).

We may need to refactor the rendering a bit more to make it clear how
the different helper methods render the input string. There are lots of
options (resolve links / images / mentions / git hashes / emojis / ...)
but you don't really know what helper uses which options. For example,
we currently support images in the user description which should not be
allowed I think:

<details>
  <summary>Profile</summary>

https://try.gitea.io/KN4CK3R


![grafik](https://github.com/go-gitea/gitea/assets/1666336/109ae422-496d-4200-b52e-b3a528f553e5)

</details>
2024-01-16 02:13:29 +00:00
376fa0d8c4 Forbid removing the last admin user () ()
Backport  by @yp05327

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-16 01:51:46 +00:00
be541d9877 Fix links in issue card () ()
Backport  by @denyskon

Fixes_
https://github.com/go-gitea/gitea/issues/23318#issuecomment-1611086747

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2024-01-16 09:30:07 +08:00
ae99233db0 Fix GetCommitStatuses () ()
Backport 

Replaces 
2024-01-15 19:30:12 +01:00
cbf366643b Use correct has error check for internal responses () ()
Backport  by @wxiaoguang

`resp != nil` doesn't mean the request really succeeded. Add a comment
for requestJSONResp to clarify the behavior.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-01-15 13:13:35 +01:00
df694f6a7d Fix nil pointer panic when exec some gitea cli command () ()
Backport  by @yp05327

panic:

![image](https://github.com/go-gitea/gitea/assets/18380374/7fcde2ad-1d42-4b60-b120-3b60a8926e8e)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/49d9f0ca-e590-4a35-8ca2-1317d1b7c939)

Co-authored-by: yp05327 <576951401@qq.com>
2024-01-15 08:05:30 +00:00
84282c608c Fix when private user following user, private user will not be counted in his own view () ()
Backport  by @yp05327

Doer: asdasasdasasdasasdasasdasasdasasdasasdas (private user)
Followed: TestUser (public user)

Before:
(From doer's view)

![image](https://github.com/go-gitea/gitea/assets/18380374/9ba16b3b-068c-43c5-a3dd-e3343b5b32f2)
(From followed user's view, can see doer)

![image](https://github.com/go-gitea/gitea/assets/18380374/dfd1b564-d689-4393-b3d3-1e6bf52c94ba)

After:
(From doer's view)

![image](https://github.com/go-gitea/gitea/assets/18380374/1c85c1d1-c9f7-40c8-948c-145f7cae9a04)

Co-authored-by: yp05327 <576951401@qq.com>
2024-01-15 15:07:10 +08:00
d1db2b7251 Update github.com/cloudflare/circl () ()
Backport 

cloudflare/circl: https://github.com/advisories/GHSA-9763-4f94-gfch

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-15 13:19:18 +08:00
6493085aee Speed up loading the dashboard on mysql/mariadb () ()
Backport  by @lunny

Fixes 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-15 02:01:25 +00:00
fbf29f29b5 Modernize merge button () ()
Backport  by @earl-warren

- Make use of the `form-fetch-action` for the merge button, which will
automatically prevent the action from happening multiple times and show
a nice loading indicator as user feedback while the merge request is
being processed by the server.
- Adjust the merge PR code to JSON response as this is required for the
`form-fetch-action` functionality.
- Resolves https://codeberg.org/forgejo/forgejo/issues/774
- Likely resolves the cause of
https://codeberg.org/forgejo/forgejo/issues/1688#issuecomment-1313044

(cherry picked from commit 4ec64c19507caefff7ddaad722b1b5792b97cc5a)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2024-01-15 09:40:52 +08:00
6e29242ebb Fix schedule tasks bugs () ()
Fix 
Backport  

This PR fix the possible bugs about actions schedule.

- Move `UpdateRepositoryUnit` and `SetRepoDefaultBranch` from models to
service layer
- Remove schedules plan from database and cancel waiting & running
schedules tasks in this repository when actions unit has been disabled
or global disabled.
- Remove schedules plan from database and cancel waiting & running
schedules tasks in this repository when default branch changed.
2024-01-14 23:54:22 +01:00
56e722f825 Require token for GET subscription endpoint () ()
Backport  for 1.21
2024-01-13 02:01:15 +00:00
80e564087d Assign pull request to project during creation () ()
Backport  by @denyskon

When creating a pull request, allow directly assigning it to a project,
as it is already possible for issues.

After:


![grafik](https://github.com/go-gitea/gitea/assets/47871822/01dc2b3d-d56a-4053-b2fc-138725d7633a)

---------

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: delvh <dev.lh@web.de>
2024-01-12 21:53:16 +00:00
571822b6ec Fix issue dependencies () ()
Backport  by @lng2020

Fix  
Fix 
Fix  
Fix  
1. Fix the typo `BlockingByDependenciesNotPermitted`, which causes the
`not permitted message` not to show. The correct one is `Blocking` or
`BlockedBy`
2. Rewrite the perm check. The perm check uses a very tricky way to
avoid duplicate checks for a slice of issues, which is confusing. In
fact, it's also the reason causing the bug. It uses `lastRepoID` and
`lastPerm` to avoid duplicate checks, but forgets to assign the
`lastPerm` at the end of the code block. So I rewrote this to avoid this
trick.
![I U1AT{GNFY3
1HZ`6L{(2L](https://github.com/go-gitea/gitea/assets/70063547/79acd02a-a567-4316-ae0d-11c6461becf1)
3. It also reuses the `blocks` slice, which is even more confusing. So I
rewrote this too.

![UARFPXRGGZQFB7J$2`R}5_R](https://github.com/go-gitea/gitea/assets/70063547/f21cff0f-d9ac-4ce4-ae4d-adffc98ecd99)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2024-01-12 23:29:22 +02:00
2a0fbe23b8 Fix button size in "attached header right" () ()
Backport  by wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-01-12 15:04:19 +00:00
95901a99c0 Fix convert.ToTeams on empty input () ()
Backport  by @KN4CK3R

Fixes 

Don't return `nil` if the input was empty.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-01-12 07:12:18 +00:00
cb33623bb6 Require token for GET subscription endpoint () ()
Backport  by @jackHay22

Fixes  

## Changes
- Require and check API token for `GET
/repos/{owner}/{repo}/subscription` in order to populate `ctx.Doer`.

Co-authored-by: Jack Hay <jack@allspice.io>
2024-01-12 14:51:27 +08:00
9f0c709637 Show description as tooltip instead of title for labels () ()
Backport  by @delvh

Follow GitHubs behavior of showing the label description as a tooltip
instead of the browser native title.

## Before

![grafik](https://github.com/go-gitea/gitea/assets/51889757/70448327-467b-4bee-b799-40a442a5ce16)


## After

![grafik](https://github.com/go-gitea/gitea/assets/51889757/abe7d700-148b-4cef-a487-6b0f8f20b212)

Co-authored-by: delvh <dev.lh@web.de>
2024-01-12 10:45:07 +08:00
5e9fd0ab5e Hide code related setting options in repository when code unit is disabled () ()
Backport  by @lunny

Since , code can be hidden.
However, the related settings are still shown even though they don't
have any meaning then.


https://github.com/go-gitea/gitea/assets/81045/5fdee54d-ac81-418a-82f7-eadff048cedd

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2024-01-11 04:31:24 +00:00
f220f4231a Add -F to commit search to treat keywords as strings () ()
Backport  by @me-heer

Fixes 

The [default
behavior](https://git-scm.com/docs/git-log#Documentation/git-log.txt---basic-regexp)
of --grep in git log is to interpret the keyword as a regular
expression. This causes the search to fail in the cases where the search
keyword contains a `[`, since `[` is a special character used in grep.

If we want our keywords to be interpreted as 'strings', we should use
[-F
flag](https://git-scm.com/docs/git-log#Documentation/git-log.txt---basic-regexp).

Co-authored-by: Mihir Joshi <mihir67mj@gmail.com>
2024-01-10 21:29:01 +01:00
bce27d0a31 Concatenate error in checkIfPRContentChanged () ()
Backport  by @earl-warren

- If there's a error with the Git command in `checkIfPRContentChanged`
the stderr wasn't concatendated to the error, which results in still not
knowing why an error happend.
- Adds concatenation for stderr to the returned error.
- Ref: https://codeberg.org/forgejo/forgejo/issues/2077

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2024-01-09 14:06:12 +00:00
12f418a7e8 Add download attribute to release attachments () ()
Backport  by @JakobDev

Fixes 

Co-authored-by: JakobDev <jakobdev@gmx.de>
2024-01-09 21:18:13 +08:00
9865aa2394 Suggest to use Type=simple for systemd service () ()
Backport  (only the gitea.service sample)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-01-07 16:42:43 +01:00
def178ce32 Fix incorrect URL for "Reference in New Issue" () ()
Backport  by wxiaoguang

Gitea prefers to use relative URLs in code (to make multiple domain work
for some users)

So it needs to use `toAbsoluteUrl` to generate a full URL when click
"Reference in New Issues"

And add some comments in the test code

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-01-07 23:40:29 +08:00
2399b4d483 Avoid unnecessary 500 panic when a commit doesn't exist () ()
Backport  by wxiaoguang

In , it assumed that `Commit` always exists when
`PageIsDiff==true`.

But for a 404 page, the `Commit` doesn't exist, so the following code
would cause panic because nil value can't be passed as string parameter
to `IsMultilineCommitMessage(string)` (or the StringUtils.Cut in later
PRs)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-01-07 10:40:30 +00:00
ad2cb9863c Improve frontend guideline () () 2024-01-06 12:30:36 -05:00
7f833d8f71 Fix panic when parsing empty pgsql host () ()
Backport  by wxiaoguang

Regression of 
Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-01-06 20:05:49 +08:00
e67c819cf4 Fix wrapping of label list () ()
Backport  by @denyskon

Before:

![grafik](https://github.com/go-gitea/gitea/assets/47871822/2fbd7ef2-22ad-4515-9c66-81c29bfbb7a3)

After:

![grafik](https://github.com/go-gitea/gitea/assets/47871822/df86d1ae-03db-4543-834c-761859c367be)

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2024-01-04 10:21:35 +08:00
83457805bb Make template DateTime show proper tooltip () ()
Backport 
2024-01-03 18:41:03 +08:00
3c79315cf2 Fix: system webhooks API bug () ()
Backport  by @pulltheflower

- Fix the bug about admin/hooks API that `GET /admin/hooks` can only
fetch system_hooks, `POST /admin/hooks` can only create default_hooks.

Co-authored-by: vincent <38434877+pulltheflower@users.noreply.github.com>
2023-12-31 12:53:09 +00:00
3e1bd61000 Fix alpine package files are not rebuilt () ()
Backport  by @lng2020

I noticed the `BuildAllRepositoryFiles` function under the Alpine folder
is unused and I thought it was a bug.
But I'm not sure about this. Was it on purpose?

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-12-31 06:18:26 +00:00
18da3f8483 Upgrade xorm to new version which supported update join for all supported databases () ()
Backport  by @lunny

Fix https://github.com/go-gitea/gitea/pull/28547#issuecomment-1867740842

Since https://gitea.com/xorm/xorm/pulls/2383 merged, xorm now supports
UPDATE JOIN.
To keep consistent from different databases, xorm use
`engine.Join().Update`, but the actural generated SQL are different
between different databases.

For MySQL, it's `UPDATE talbe1 JOIN table2 ON join_conditions SET xxx
Where xxx`.

For MSSQL, it's `UPDATE table1 SET xxx FROM TABLE1, TABLE2 WHERE
join_conditions`.

For SQLITE per https://www.sqlite.org/lang_update.html, sqlite support
`UPDATE table1 SET xxx FROM table2 WHERE join conditions` from
3.33.0(2020-8-14).

POSTGRES is the same as SQLITE.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-31 13:57:36 +08:00
2165729d16 Avoid cycle-redirecting user/login page () ()
Backport 

Fix , and remove some unused code.
2023-12-30 20:50:08 +08:00
683b95f0da fix empty ref for cron workflow runs () ()
Backport  by @denyskon

Fix  
Please see
https://github.com/go-gitea/gitea/issues/27678#issuecomment-1871445853
for details.

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2023-12-29 09:08:16 +00:00
ff565a787f Remove unnecessary syncbranchToDB with tests () ()
Replace 

Backport  by lunny

 introduced `syncBranchToDB` in `CreateNewBranchFromCommit`. This
PR will revert the change because it's unnecessary. Every push will
already be checked by `syncBranchToDB`.
This PR also created a test to ensure it's right.
2023-12-29 08:47:02 +00:00
f7cca2a290 Improve document for ARTIFACT_RETENTION_DAYS () ()
Backport  by wxiaoguang

Follow 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-29 15:39:59 +08:00
373e78895e switch destination directory for apt signing keys () ()
Backport  by @denyskon

According to [Debian
docs](https://wiki.debian.org/DebianRepository/UseThirdParty):

> The certificate MUST NOT be placed in /etc/apt/trusted.gpg.d or loaded
by apt-key add.
> ...
> If future updates to the certificate will be managed by an apt/dpkg
package as recommended below, then it SHOULD be downloaded into
/usr/share/keyrings using the same filename that will be provided by the
package. If it will be managed locally , it SHOULD be downloaded into
/etc/apt/keyrings instead.
> ...
> A sources.list entry SHOULD have the signed-by option set.

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2023-12-29 05:44:47 +00:00
8ec232817c Improve 1.21 document for Database Preparation () ()
Backport 

Fix 
2023-12-29 13:05:12 +08:00
a5c7ac9980 Extend description for ARTIFACT_RETENTION_DAYS () ()
Backport  by @hakito

Make it clear that this value is just a default value and that every
artifact can have it's own value.

Co-authored-by: Gerd Katzenbeisser <hakito@users.noreply.github.com>
2023-12-28 18:21:46 +08:00
bf983735fd Use known issue IID to generate new PR index number when migrating from GitLab () ()
Backport  by wxiaoguang

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-27 09:59:29 +08:00
7a2786ca6c Refactor CORS handler () ()
Backport , the only conflict is the test file.

The CORS code has been unmaintained for long time, and the behavior is
not correct.

This PR tries to improve it. The key point is written as comment in
code. And add more tests.

Fix 
Fix 
Fix 
2023-12-25 21:01:24 +08:00
b2588338f0 Revert "improve possible performance bottleneck ()" () ()
Backport  by @lunny

This reverts commit b35d3fddfac389a7be401a63b4e1283dd74af681.

This is totally wrong. I think `Update join` hasn't been supported well
by xorm.

I just revert the PR and will try to send another one.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-25 08:01:11 +00:00
8a46a6417e Fix the scroll behavior for emoji/mention list () ()
Backport  by wxiaoguang

Fix  by https://github.com/github/combobox-nav/pull/79 (combobox-nav v2.3.1)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-25 07:02:09 +00:00
5b104a5533 Fix flex container width () ()
Backport  by wxiaoguang

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-24 22:44:03 +08:00
f2add36a29 Include heap pprof in diagnosis report to help debugging memory leaks () () 2023-12-24 09:18:43 +08:00
564068aa99 Fix wrong due date rendering in issue list page () ()
Backport  by @yardenshoham

It included the hours, minutes, and seconds. By removing these, the date
renders correctly.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2023-12-22 17:25:43 +00:00
6a559ad634 Fix status_check_contexts matching bug () ()
Backport  by @Zettat123

Fix 
Follow 

---
Copied from
https://github.com/go-gitea/gitea/issues/28570#issuecomment-1867327999

The feature introduced in  should be compatible with
`status_check_contexts`. However, if one or more of
`status_check_contexts` is not a legal glob expressions, `glob.Compile`
will fail and the contexts cannot match.


21229ed2c8/routers/web/repo/pull.go (L653-L663)

Co-authored-by: Zettat123 <zettat123@gmail.com>
2023-12-22 23:32:22 +08:00
4dd39eb54a Fix 405 method not allowed CORS / OIDC () ()
Backport  by @morphelinho

Follow 
Follow 

Fix problem with 405 method not allowed for CORS wrt OIDC

Co-authored-by: morphelinho <morphelinho@users.noreply.github.com>
2023-12-22 20:55:43 +08:00
acc8100d47 Fix 500 error of searching commits () ()
Backport  by wxiaoguang

Regression of  . Now the string is escaped HTML, so it doesn't
need `| Safe`.

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-22 02:29:28 +00:00
1a3803effd improve possible performance bottleneck () ()
Backport  by @lunny

Replace 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-21 23:37:08 +00:00
1183002b32 Use information from previous blame parts () ()
Backport  by @KN4CK3R

Fixes 

`git blame` output can contain blocks without commit information if it
was outputted before (the `0dafa97ea3f6d9662299579e5be1875cd28baaae 48
26 1` line):
```
fec25436488499df7231f63b857f66457c193d5c 24 25 1
author Bastien Montagne
author-mail <bastien@blender.org>
author-time 1660731031
author-tz +0200
committer Bastien Montagne
committer-mail <bastien@blender.org>
committer-time 1660731031
committer-tz +0200
summary LibOverride: Add Make/Reset/Clear entries to IDTemplate contextual menu.
previous 839ece6477203382b7a7483062961540180ff1cd source/blender/editors/interface/interface_ops.c
filename source/blender/editors/interface/interface_ops.c
        #include "BLT_translation.h"
0dafa97ea3f6d9662299579e5be1875cd28baaae 48 26 1

3d57bc4397fca53bc9702a27bbf50102827829b0 27 27 1
author Hans Goudey
author-mail <hans@blender.org>
author-time 1700131315
author-tz +0100
committer Hans Goudey
committer-mail <hooglyboogly@noreply.localhost>
committer-time 1700131315
committer-tz +0100
summary Cleanup: Move several blenkernel headers to C++
previous 451c054d9b7d3148a646caa5a72fb127a5b5c408 source/blender/editors/interface/interface_ops.cc
filename source/blender/editors/interface/interface_ops.cc
        #include "BKE_context.hh"
```
This PR reuses data from the previous blame part to fill these gaps.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-12-22 06:47:34 +08:00
1fc6bc1be2 Update mermaid for 1.21 ()
Try to fix 
2023-12-21 20:14:50 +08:00
2360c7ec6c Add changelog for 1.21.3 () 2023-12-21 07:47:15 +00:00
8ca32dc873 Fix merging artifact chunks error when minio storage basepath is set () ()
Backport  by @fuxiaohei

Related to  https://github.com/go-gitea/gitea/issues/28279

When merging artifact chunks, it lists chunks from storage. When storage
is minio, chunk's path contains `MINIO_BASE_PATH` that makes merging
break.

<del>So trim the `MINIO_BASE_PATH` when handle chunks.</del>

Update the chunk file's basename to retain necessary information. It
ensures that the directory in the chunk's path remains unaffected.

Co-authored-by: FuXiaoHei <fuxiaohei@vip.qq.com>
2023-12-21 15:38:39 +08:00
47f9b3f484 Update actions document about comparsion as Github Actions () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-20 16:00:30 -05:00
16263af971 Fix inperformant query on retrifing review from database. () ()
Backport  by @6543

can we please PLEAS PLEASE only use raw SQL statements if it is relay
needed!!!

source is https://github.com/go-gitea/gitea/pull/28544 (before
refactoring)

Co-authored-by: 6543 <m.huber@kithara.com>
2023-12-20 16:55:08 +01:00
f096635622 Fix the issue ref rendering for wiki () ()
Backport  by wxiaoguang

Fix , regression of 
* 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-20 22:51:25 +08:00
932e282e15 Fix duplicate ID when deleting repo () ()
Backport  by @framitdavid


There is an accessibility issue in the interface when attempting to
delete a repository. When I click on "Delete repository," a dialog box
appears, requiring confirmation to proceed with the repository deletion.
However, when I press the "Repo name" label, the wrong input field gains
focus. The focused field is located behind the dialog and is intended
for renaming the repository.

I am submitting these pull requests to ensure that the correct input
field is focused when the user clicks on the label. This change will
also facilitate the writing of tests using Playwright or Testing Library
to retrieve elements based on roles. This PR will also improve
acessibility of this area.

Co-authored-by: David Øvrelid <46874830+framitdavid@users.noreply.github.com>
2023-12-19 16:40:03 +08:00
d9aeb1f09d Only check online runner when detecting matching runners in workflows () ()
Backport  by @yp05327

Mentioned:
[](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)

Co-authored-by: yp05327 <576951401@qq.com>
2023-12-19 04:06:31 +00:00
411310d698 chore(api): support ignore password if login source type is LDAP for creating user API () ()
Backport  by @appleboy

- Modify the `Password` field in `CreateUserOption` struct to remove the
`Required` tag
- Update the `v1_json.tmpl` template to include the `email` field and
remove the `password` field

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2023-12-19 11:14:06 +08:00
6d002f8e1e Update golang.org/x/crypto ()
ref: https://groups.google.com/g/golang-announce/c/qA3XtxvMUyg,
CVE-2023-48795, https://go.dev/issue/64784
2023-12-19 07:04:21 +08:00
4462628a26 Improve the prompt for "ssh-keygen sign" () ()
Backport  by wxiaoguang

Close 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-18 15:25:52 +00:00
a3f403f438 Add option to disable ambiguous unicode characters detection () ()
Backport  (the only conflict is caused by some comments)

* Close 
* Close 
* Close 
* Close 
2023-12-18 12:20:37 +08:00
8ee1ed877b Initalize stroage for orphaned repository doctor () ()
Backport  by @earl-warren

- When a repository is orphaned and has objects stored in any of the
storages such as repository avatar or attachments the delete function
would error, because the storage module wasn't initalized.
- Add code to initialize the storage module.

Refs: https://codeberg.org/forgejo/forgejo/pulls/1954

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-12-16 22:06:37 +08:00
2c2e00899d Update docs for DISABLE_QUERY_AUTH_TOKEN () ()
Backport  by @kdumontnu

As described
[here](https://github.com/go-gitea/gitea/pull/28390#issuecomment-1857553331).

Co-authored-by: Kyle D <kdumontnu@gmail.com>
2023-12-16 00:04:05 -05:00
6cbb6f303a Refactor SSH clone URL generation code () ()
Backport  by wxiaoguang

Refactor the code and add tests, keep the old logic.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-15 14:54:40 +08:00
6af698fb81 Polyfill SubmitEvent for PaleMoon () ()
Backport  by wxiaoguang

Fix 

It only polyfills if there is no "SubmitEvent" class, so it has no side
effect for most users.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-15 03:04:37 +00:00
94a05a492d Fix Chinese translation of config cheat sheet[API] () ()
Backport  by @CaiCandong

Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
2023-12-15 07:54:32 +08:00
6de862abdf Fix documents for "custom/public/assets/" () ()
Backport  by wxiaoguang

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-14 17:00:39 +08:00
b47482d58e Retry SSH key verification with additional CRLF if it failed () ()
Backport  by @nekrondev

Windows-based shells will add a CRLF when piping the token into
ssh-keygen command resulting in
verification error. This resolves .

Co-authored-by: nekrondev <heiko@noordsee.de>
Co-authored-by: Heiko Besemann <heiko.besemann@qbeyond.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-14 12:50:26 +08:00
74ab798033 Add endpoint for not implemented Docker auth () ()
Backport  by @KN4CK3R

Recently Docker started to use the optional `POST /v2/token` endpoint
which should respond with a `404 Not Found` status code instead of the
current `405 Method Not Allowed`.

> Note: Not all token servers implement oauth2. If the request to the
endpoint returns 404 using the HTTP POST method, refer to Token
Documentation for using the HTTP GET method supported by all token
servers.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-12-13 22:06:24 +01:00
97a0bf151a Fix possible nil pointer access () ()
Backport  by @KN4CK3R

There could be a nil pointer exception if the file is not found because
that specific error is suppressed but not handled.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-12-12 23:35:32 +08:00
5e2bae7716 Don't show unnecessary citation JS error on UI () ()
Backport  by wxiaoguang

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-12 21:14:04 +08:00
96d3fcf179 1.21.2 changelog ()
To be rebuilt with latest golang version

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-12 14:23:54 +08:00
265f485295 Do some missing checks () ()
backport 
2023-12-12 06:20:18 +00:00
f144521aea Deprecate query string auth tokens () ()
Backport  by @jackHay22

## Changes
- Add deprecation warning to `Token` and `AccessToken` authentication
methods in swagger.
- Add deprecation warning header to API response. Example: 
  ```
  HTTP/1.1 200 OK
  ...
  Warning: token and access_token API authentication is deprecated
  ...
  ```
- Add setting `DISABLE_QUERY_AUTH_TOKEN` to reject query string auth
tokens entirely. Default is `false`

## Next steps
- `DISABLE_QUERY_AUTH_TOKEN` should be true in a subsequent release and
the methods should be removed in swagger
- `DISABLE_QUERY_AUTH_TOKEN` should be removed and the implementation of
the auth methods in question should be removed

## Open questions
- Should there be further changes to the swagger documentation?
Deprecation is not yet supported for security definitions (coming in
[OpenAPI Spec version
3.2.0](https://github.com/OAI/OpenAPI-Specification/issues/2506))
- Should the API router logger sanitize urls that use `token` or
`access_token`? (This is obviously an insufficient solution on its own)

Co-authored-by: Jack Hay <jack@allspice.io>
Co-authored-by: delvh <dev.lh@web.de>
2023-12-12 13:45:00 +08:00
6f4d5c0b8c Recover from panic in cron task () ()
Backport  by @earl-warren

- Currently there's code to recover gracefully from panics that happen
within the execution of cron tasks. However this recover code wasn't
being run, because `RunWithShutdownContext` also contains code to
recover from any panic and then gracefully shutdown Forgejo. Because
`RunWithShutdownContext` registers that code as last, that would get run
first which in this case is not behavior that we want.
- Move the recover code to inside the function, so that is run first
before `RunWithShutdownContext`'s recover code (which is now a noop).

Fixes: https://codeberg.org/forgejo/forgejo/issues/1910

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-12-12 03:28:56 +00:00
1ec622db24 Improve doctor cli behavior () ()
Backport  by wxiaoguang

1. Do not sort the "checks" slice again and again when "Register", it
just wastes CPU when the Gitea instance runs
2. If a check doesn't exist, tell the end user
3. Add some tests

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-12-11 16:28:27 +00:00
40d51188c0 Fix links in docs () ()
Backport  by @yp05327

Close 

## How to test it in local
convert Makefile L34 into:
```
cd .tmp/upstream-docs && git clean -f && git reset --hard && git fetch origin pull/28302/head:pr28302 && git switch pr28302
```

Co-authored-by: yp05327 <576951401@qq.com>
2023-12-11 22:53:59 +08:00
87db4a47c8 Also sync DB branches on push if necessary () ()
Fix 
Backport  

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.
2023-12-11 06:16:56 +00:00
cd2dd5a67d Fix missing check () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-11 09:10:48 +08:00
46beb7f33f enable system users search via the API () ()
Backport  by @earl-warren

Refs: https://codeberg.org/forgejo/forgejo/issues/1403

(cherry picked from commit dd4d17c159eaf8b642aa9e6105b0532e25972bb7)

---------

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-08 21:46:08 +00:00
3107093394 Fix Docker meta action for releases () () 2023-12-07 16:29:17 -08:00
272ae03341 Make gogit Repository.GetBranchNames consistent () ()
Backport  by @AdamMajer

nogogit GetBranchNames() lists branches sorted in reverse commit date
order. On the other hand the gogit implementation doesn't apply any
ordering resulting in unpredictable behaviour. In my case, the unit
tests requiring particular order fail

    repo_branch_test.go:24:
                Error Trace:
               ./gitea/modules/git/repo_branch_test.go:24
                Error:          elements differ

                                extra elements in list A:
                                ([]interface {}) (len=1) {
                                 (string) (len=6) "master"
                                }

                                extra elements in list B:
                                ([]interface {}) (len=1) {
                                 (string) (len=7) "branch1"
                                }

                                listA:
                                ([]string) (len=2) {
                                 (string) (len=6) "master",
                                 (string) (len=7) "branch2"
                                }

                                listB:
                                ([]string) (len=2) {
                                 (string) (len=7) "branch1",
                                 (string) (len=7) "branch2"
                                }
                Test:           TestRepository_GetBranches

To fix this, we sort branches based on their commit date in gogit
implementation.

Fixes: 

Co-authored-by: Adam Majer <amajer@suse.de>
2023-12-07 13:03:27 -05:00
b56a9f6ded Fix margin in server signed signature verification view () ()
Backport  by @lafriks

Before:

![image](https://github.com/go-gitea/gitea/assets/165205/e2e2256d-03c5-4ab8-8ed9-08ef68571a43)

After:

![image](https://github.com/go-gitea/gitea/assets/165205/804132ef-18f9-4ab8-949d-f6c71e7f4d24)

Co-authored-by: Lauris BH <lauris@nix.lv>
2023-12-07 10:37:12 +08:00
c5c44d0951 Fix object does not exist error when checking citation file () ()
Backport  by @yp05327

Fix 

`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.

Co-authored-by: yp05327 <576951401@qq.com>
2023-12-06 22:06:51 +00:00
8f2805f757 Fix incorrect default value of [attachment].MAX_SIZE () ()
Backport  by @capvor

In the documents, the `[attachment] MAX_SIZE` default value should be 4.

Reference the source code `modules/setting/attachment.go` line 29.

Co-authored-by: capvor <capvor@sina.com>
2023-12-06 19:32:23 +00:00
5eaf91e919 Use filepath instead of path to create SQLite3 database file () ()
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Fix 
2023-12-06 11:22:18 -06:00
b7e3adc66c Fix the runs will not be displayed bug when the main branch have no workflows but other branches have () ()
Backport  by @lunny

The left menu will only display the default branch's workflows but the
right side will display the runs triggered by all branches' workflows.
So we cannot hide right side if default branch has no workflows.

Fix  
Replace 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-12-06 02:28:00 -05:00
5b5f8aab19 handle repository.size column being NULL in migration v263 () ()
Co-authored-by: Nate Levesque <nate@thenaterhood.com>
2023-12-05 14:51:56 +00:00
fef34790bb Convert git commit summary to valid UTF8. () ()
Backport  by @darrinsmart

The summary string ends up in the database, and (at least) MySQL &
PostgreSQL require valid UTF8 strings.

Fixes 

Co-authored-by: darrinsmart <darrin@djs.to>
Co-authored-by: Darrin Smart <darrin@filmlight.ltd.uk>
2023-12-05 09:19:08 +00:00
8b590de186 Fix migration panic due to an empty review comment diff () ()
Backport  by @lng2020

Fix  
```
func (p *PullRequestComment) GetDiffHunk() string {
	if p == nil || p.DiffHunk == nil {
		return ""
	}
	return *p.DiffHunk
}
```
This function in the package `go-github` may return an empty diff. When
it's empty, the following code will panic because it access `ss[1]`

ec1feedbf5/services/migrations/gitea_uploader.go (L861-L867)

ec1feedbf5/modules/git/diff.go (L97-L101)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-12-05 16:58:15 +08:00
5105d2093c Add HEAD support for rpm repo files () ()
Backport  by @KN4CK3R

Fixes https://codeberg.org/forgejo/forgejo/issues/1810

zypper uses HEAD requests to check file existence.

https://github.com/openSUSE/libzypp/blob/HEAD/zypp/RepoManager.cc#L2549

https://github.com/openSUSE/libzypp/blob/HEAD/zypp-curl/ng/network/private/downloaderstates/basicdownloader_p.cc#L116

@ExplodingDragon fyi

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-12-05 16:24:57 +08:00
08445d5d86 Refactor template empty checks () ()
Backport  by @KN4CK3R

Fix 

As there is no info how to reproduce it, I can't test it.
Fix may be `section_split.tmpl @ 126/130`.

Other changes are "empty check" refactorings.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-12-05 06:07:15 +00:00
b71d4c3ec0 Fix RPM/Debian signature key creation () ()
Backport  by @KN4CK3R

Fixes 

The name parameter can't contain some characters
(https://github.com/keybase/go-crypto/blob/master/openpgp/keys.go#L680)
but is optional. Therefore just use an empty string.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-12-05 13:42:41 +08:00
bf537adf8a Keep profile tab when clicking on Language () ()
Backport  by @JakobDev

Fixes https://codeberg.org/Codeberg/Community/issues/1355

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-12-03 14:54:53 +00:00
8c8c24f8eb Fix missing issue search index update when changing status () ()
Backport  by @brechtvl

Changing an issue status, assignee, labels or milestone without also
adding a comment would not update the index, resulting in wrong search
results.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2023-12-03 11:43:17 +00:00
fee9c05ed3 Fix wrong link in protect_branch_name_pattern_desc () ()
Backport  by @yp05327

The current href will link to
`https://domain/owner/repo/settings/branches/github.com/gobwas/glob`

Co-authored-by: yp05327 <576951401@qq.com>
2023-12-01 20:06:08 +08:00
e15fe85335 Read previous info from git blame () ()
Backport  by @KN4CK3R

Fixes 

Reads the `previous` info from the `git blame` output instead of
calculating it afterwards.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-12-01 08:27:35 +01:00
4f5122a7fe Ignore "non-existing" errors when getDirectorySize calculates the size () ()
Backport 

The git command may operate the git directory (add/remove) files in any
time.

So when the code iterates the directory, some files may disappear during
the "walk". All "IsNotExist" errors should be ignored.
2023-11-30 16:39:16 +00:00
84e65afffd Use appSubUrl for OAuth2 callback URL tip () ()
Backport  by @earl-warren

- When crafting the OAuth2 callbackURL take into account `appSubUrl`,
which is quite safe given that its strictly formatted.
- No integration testing as this is all done in Javascript.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1795

(cherry picked from commit 27cb6b7956136f87aa78067d9adb5a4c4ce28a24)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-11-30 00:26:47 +00:00
d2908b2794 Meilisearch: require all query terms to be matched () ()
Co-authored-by: Brecht Van Lommel <brecht@blender.org>
2023-11-29 09:38:04 -06:00
24e03a125d Fix required error for token name () ()
Backport  by @earl-warren

- Say to the binding middleware which locale should be used for the
required error.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1683

(cherry picked from commit 5a2d7966127b5639332038e9925d858ab54fc360)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-11-29 23:00:32 +08:00
76e892317b Fix issue will be detected as pull request when checking First-time contributor () ()
Backport  by @yp05327

Fix 

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-29 02:49:33 +00:00
5001f63c07 Check for v prefix on tags for release clean name () ()
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-11-28 16:02:26 -06:00
6d22ca15ab Use full width for project boards () ()
Backport  by @denyskon

Inspired by  

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2023-11-27 18:20:53 +00:00
ea9f5a57e4 Increase "version" when update the setting value to a same value as before () ()
Backport 

Setting the same value should not trigger DuplicateKey error, and the
"version" should be increased

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-28 01:58:39 +08:00
96141e4e55 Revert move installation/upgrade-from-gogs.md in 1.21 ()
https://github.com/go-gitea/gitea/pull/28233#discussion_r1405539630
2023-11-27 15:28:48 +01:00
ca5f0c93c6 Fix links in docs () ()
Backport  by @yp05327

Follow 

Changes:
- `(doc/administration/config-cheat-sheet.md` is incorrect:

![image](https://github.com/go-gitea/gitea/assets/18380374/1c417dd7-61a0-49ba-8d50-871fd4c9bf20)
- remove `../../`

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-27 15:36:15 +08:00
196100a07a Change log for 1.21.1 ()
As title.

---------

Co-authored-by: delvh <dev.lh@web.de>
2023-11-26 18:33:07 +08:00
bc3d8bff73 Fix comment permissions () ()
backport 

This PR will fix some missed checks for private repositories' data on
web routes and API routes.
2023-11-25 23:43:23 +00:00
7f81110461 Fix actions when tagging () ()
Backport  by @lunny

close https://github.com/go-gitea/gitea/issues/28053

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-11-25 13:46:08 -05:00
5ed0eefc9a Docs: Replace deprecated IS_TLS_ENABLED mailer setting in email setup () ()
Backport  by @CodeShakingSheep

In the [docs for email
setup](https://docs.gitea.com/administration/email-setup)
`mailer.IS_TLS_ENABLED` is mentioned which was replaced by
`mailer.PROTOCOL` in release 1.18.0 according to
https://blog.gitea.com/release-of-1.18.0/ . This change wasn't reflected
in the docs for email setup. I just replaced the deprecated mailer
setting.

Co-authored-by: CodeShakingSheep <19874562+CodeShakingSheep@users.noreply.github.com>
2023-11-25 15:41:01 +08:00
4b89c0f996 Fix some incorrect links in docs () ()
Backport  by @yp05327


https://gitea.com/gitea/gitea-docusaurus/actions/runs/661/jobs/0#jobstep-9-39
I noticed that there are many warning logs in building docs.
It is causing 404 in docs.gitea.com now, so we need to fix it.
And there are also some other problems in v1.19 which can not be done in
this PR.

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-24 19:55:08 +00:00
7cae4dfc00 Fix delete-orphaned-repos () ()
Backport 

gitea doctor failed at checking and fixing 'delete-orphaned-repos',
because table name 'user' needs quoting to be correctly recognized by at
least PostgreSQL.

fixes 
2023-11-24 14:54:14 -05:00
28b8e0b43e Use full width for PR comparison () ()
Backport  by @lng2020

Follow-up  
close  
Before 

![ksnip_20231123-183906](https://github.com/go-gitea/gitea/assets/70063547/78428a22-b0a0-45f9-9458-7fd5ec73aa29)
After

![full](https://github.com/go-gitea/gitea/assets/70063547/047242cf-9d6c-4b3a-9f92-54102740c27e)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-11-23 16:14:20 +00:00
23838c2c2e Make CORS work for oauth2 handlers () ()
Backport 

Fix 

Although there was `m.Post("/login/oauth/access_token", CorsHandler()...`,
it never really worked, because it still lacks the "OPTIONS" handler.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-23 22:27:00 +08:00
f9763f1366 Fix missing buttons () ()
Backport  by @lng2020

fix  
regression  
That PR is supposed to only change the style but somehow delete a code
snippet. See the
diff(https://github.com/go-gitea/gitea/pull/25948/files#diff-7c36d66fe058f4ff9f2beaac73cf710dca45b350d0dd98daf806828a4745fe62L125-L129)
for details.

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-23 12:24:34 +01:00
a2314ca9c5 Revert "Fix EOL handling in web editor" () ()
Backport  by @lng2020

Reverts 
close 

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-11-22 18:06:13 +08:00
994ba35f11 Fix swagger title () ()
Backport  by @yp05327


![image](https://github.com/go-gitea/gitea/assets/18380374/380859b2-a643-42fd-b53e-78c93c05c826)
Don't know why there's a `.` behind. 🤔

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-22 09:06:38 +00:00
447422fe27 Fix the description about the default setting for action in quick start document () ()
Backport  by @yp05327

Since , Actions are enabled by default. so we should also edit the
document. 😃

ps: I think this should be backport to 1.21.0.

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-22 16:46:11 +08:00
9bfee5014b Add guide page to actions when there's no workflows () ()
Backport  by @yp05327

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/599d40c1-9b8d-4189-9286-c9c36fb780dd)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/848a73d1-aaec-478f-93a7-adcc7ee18907)

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-22 02:29:54 +00:00
7128929a0d Do not display search box when there's no packages yet () ()
Backport  by @yp05327

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/3012f544-7ff5-4ccb-ac80-ce24d50abe97)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/4084312a-9ac0-4103-8c93-ea178ae24493)

![image](https://github.com/go-gitea/gitea/assets/18380374/3c47d175-0735-476d-8979-da2bc0a4fc95)

![image](https://github.com/go-gitea/gitea/assets/18380374/033c6a81-d1f7-4426-8063-5793d0b47462)

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-22 10:07:13 +08:00
efcbaf8fa8 Fix no ActionTaskOutput table waring () ()
Backport  by @yp05327

Reproduce:
- Create a new Gitea instance
- Register a runner
- Create a repo and add a workflow
- Check the log, you will see warnings:

![image](https://github.com/go-gitea/gitea/assets/18380374/5f1278e0-114b-48bc-8113-8ba1404d9975)
It comes from:

![image](https://github.com/go-gitea/gitea/assets/18380374/c2807831-e137-4229-9536-87f6114c8a5b)

The reason is that we forgot registering `ActionTaskOutput` model.
So `action_table_output` table will be missing in your db.

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-21 22:23:57 +08:00
c997e90738 Fix empty action run title () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-11-21 04:28:14 +00:00
ffab076b72 Use "is-loading" to avoid duplicate form submit for code comment () ()
Backport  by @wxiaoguang

Compare by ignoring spaces:
https://github.com/go-gitea/gitea/pull/28143/files?diff=split&w=1

When the form is going to be submitted, add the "is-loading" class to
show an indicator and avoid user UI events.

When the request finishes (success / error), remove the "is-loading"
class to make user can interact the UI.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-21 12:02:58 +08:00
117d9a117f Fix typo in packages.cleanup.success () ()
Backport  by @wolfogre

Follow
https://github.com/go-gitea/gitea/pull/28129#discussion_r1398971596

Co-authored-by: Jason Song <i@wolfogre.com>
2023-11-20 13:43:40 +00:00
f8c5f202b7 Add missing packages.cleanup.success () ()
Backport  by @wolfogre

Co-authored-by: Jason Song <i@wolfogre.com>
2023-11-20 04:39:54 -05:00
7213506680 Update docs for docusaurus v3 ()
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-11-20 00:24:50 -05:00
1f82be6604 Fix Matrix and MSTeams nil dereference () ()
Backport  by @KN4CK3R

Fixes  
Fixes 

Added missing tests.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-11-17 13:50:45 +00:00
56bedf2bcc Change default size of attachments and repo files () ()
Backport  by @lng2020

https://github.com/go-gitea/gitea/pull/27946 forgets to change them in
code. Sorry about that.

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-11-17 13:30:42 +01:00
f7567f798d Fix incorrect pgsql conn builder behavior () ()
Backport  by @wxiaoguang

Fix  and fix the tests

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-17 10:45:04 +00:00
93ede4bc83 Fix permissions for Token DELETE endpoint to match GET and POST () ()
Backport  by @evantobin

Fixes 

In , the logic for the tokens endpoints were updated to allow
admins to create and view tokens in other accounts. However, the same
functionality was not added to the DELETE endpoint. This PR makes the
DELETE endpoint function the same as the other token endpoints and adds
unit tests

Co-authored-by: Evan Tobin <me@evantob.in>
2023-11-17 12:24:16 +08:00
9f63d27ec4 Fix system config cache expiration timing () ()
Backport 

To avoid unnecessary database access, the `cacheTime` should always be
set if the revision has been checked.

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-16 21:37:57 +08:00
073d8c50dd Restricted users only see repos in orgs which their team was assigned to () ()
Backport  by @6543


---
*Sponsored by Kithara Software GmbH*

Co-authored-by: 6543 <m.huber@kithara.com>
2023-11-14 16:44:46 +01:00
bc6477b36b Add v1.21.0 changelog () ()
Backport changelog for v1.21.0 as Giteabot doesn't seem to be in the
mood for it

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: silverwind <me@silverwind.io>
2023-11-14 15:02:59 +01:00
09efce9da2 enable system users for comment.LoadPoster () ()
Backport  by @earl-warren

System users (Ghost, ActionsUser, etc) have a negative id and may be the
author of a comment, either because it was created by a now deleted user
or via an action using a transient token.

The GetPossibleUserByID function has special cases related to system
users and will not fail if given a negative id.

Refs: https://codeberg.org/forgejo/forgejo/issues/1425 

(cherry picked from commit 6a2d2fa24390116d31ae2507c0a93d423f690b7b)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
2023-11-14 14:50:05 +01:00
124a9957d0 Fix viewing wiki commit on empty repo () ()
Backport  by @JakobDev

Fixes https://codeberg.org/forgejo/forgejo/issues/1758

For some weird reason we need to cast this nil.

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-11-14 14:49:12 +01:00
d72e20627d Add word break to the repo list in admin settings page () ()
Backport  by @yp05327

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/ed464937-e20d-4f5b-b997-e86c2d96469d)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/471e77b3-516e-4ae9-b901-0cf8745eb9aa)

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-14 14:31:43 +08:00
00cd5ba6f4 fixed duplicate attachments on dump on windows () ()
Backport  by @anudeepreddy

Hi,

This PR fixes . The use of `path.join`(which uses `/` as the file
separator) to construct paths and comparing them with paths constructed
using `filepath.join`(which uses platform specific file separator) is
the root cause of this issue.

The desired behavior is to ignore attachments when dumping data
directory. Due to the what's mentioned above, the function
`addRecursiveExclude` is not actually ignoring the attachments directory
and is being written to the archive. The attachment directory is again
added to the archive (with different file separator as mentioned in the
issue) causing a duplicate entry on windows.

The solution is to use `filepath.join` in `addResursiveExclude` to
construct `currentAbsPath`.

Co-authored-by: Anudeep Reddy <anudeepc85@gmail.com>
2023-11-14 09:56:21 +08:00
eef4148935 Dont leak private users via extensions () ()
Backport  by @6543

there was no check in place if a user could see a other user, if you
append e.g. `.rss`
2023-11-14 00:03:42 +01:00
d4122712f7 Change default size of issue/pr attachments and repo file () ()
Backport  by @lng2020

As title. Some attachments and file sizes can easily be larger than
these limits

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-11-13 15:27:39 +01:00
97f4239a94 Fix wrong xorm Delete usage(backport for 1.21) ()
manually backport for https://github.com/go-gitea/gitea/pull/27995
The conflict is `ctx` and `db.Defaultctx`.
2023-11-12 12:58:22 +00:00
58d71cdd6f Move some JS code from fomantic.js to standalone files () ()
Backport  by @wxiaoguang

To improve maintainability, this PR: 

1. Rename `web_src/js/modules/aria` to `web_src/js/modules/fomantic`
(the code there are all for aria of fomantic)
2. Move api/transition related code to
`web_src/js/modules/fomantic/api.js` and
`web_src/js/modules/fomantic/transition.js`

No logic is changed.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-12 11:29:56 +01:00
2691b345e6 Render email addresses as such if followed by punctuation () ()
Backport  by @yardenshoham

Added the following characters to the regular expression for the email:

- ,
- ;
- ?
- !

Also added a test case.

- Fixes  

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/c57eac26-f281-43ef-a51d-9c9a81b63efa)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/fc7d5c08-4350-4af0-a7f0-d1444d2d75af)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2023-11-11 13:26:18 +08:00
60b51d0648 Show error toast when file size exceeds the limits () ()
Backport  by @lng2020

As title.
Before that, there was no alert at all.
After:

![error_toast](https://github.com/go-gitea/gitea/assets/70063547/c54ffeed-76f8-4c3a-b5dc-b9b3e0f8fc76)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-11-10 11:52:04 +00:00
824d40edc6 Fix citation error when the file size is larger than 1024 bytes () ()
Backport  by @yp05327

Mentioned in:
https://github.com/go-gitea/gitea/pull/27931#issuecomment-1798016960

Same to , so use the same method to fix this problem.

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-08 22:45:57 +08:00
46ac04ce9d Add word-break to repo description in home page () ()
Backport  by @yp05327

In , @denyskon fixed UI on mobile view.
But for the repo description, on desktop view there's no word-break. 
So maybe we can just add `gt-word-break` to fix it on both mobile view
and desktop view.

Before:
desktop view:

![image](https://github.com/go-gitea/gitea/assets/18380374/a7659f5b-fbe9-400a-8cc2-cca44778556e)
mobile view:

![image](https://github.com/go-gitea/gitea/assets/18380374/611f1b81-58ac-4213-b165-5c73e24ca79e)

After:
desktop view:

![image](https://github.com/go-gitea/gitea/assets/18380374/f21bf3a7-f6aa-457d-9bfa-5c57659c68b1)
mobile view(almost same?)

![image](https://github.com/go-gitea/gitea/assets/18380374/ad2d1a4d-1172-402c-b5fc-5e910657847d)

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: silverwind <me@silverwind.io>
2023-11-08 01:29:33 +00:00
cc7b9eb085 Document REACTION_MAX_USER_NUM setting option () ()
Backport  by @6543

as title

---
*Sponsored by Kithara Software GmbH*

Co-authored-by: 6543 <m.huber@kithara.com>
2023-11-08 08:54:48 +08:00
7aafe5e0b4 Fix rendering assignee changed comments without assignee () ()
Backport  by @invliD

When an assignee changed event comment is rendered, most of it is
guarded behind the assignee ID not being 0. However, if it is 0, that
results in quite broken rendering for that comment and the next one.
This can happen, for example, when repository data imported from outside
of Gitea is incomplete.

This PR makes sure comments with an assignee ID of 0 are not rendered at
all.

---

Screenshot before:
<img width="272" alt="Bildschirm­foto 2023-11-05 um 20 12 18"
src="https://github.com/go-gitea/gitea/assets/42910/7d629d76-fee4-4fe5-9e3a-bf524050cead">
The comments in this screenshot are:
1. A regular text comment
2. A user being unassigned
3. A user being assigned
4. The title of the PR being changed

Comments 2 and 3 are rendered without any text, which indents the next
comment and does not leave enough vertical space.

Co-authored-by: Sebastian Brückner <code@nik.dev>
2023-11-07 22:02:36 +01:00
9e15955c68 Add word break to release title () ()
Backport  by @yp05327

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/74c925e0-15ae-4602-8b56-0b69f54a5e7a)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/027c34ef-0cbc-4156-a198-44bf5dd924e2)

Co-authored-by: yp05327 <576951401@qq.com>
2023-11-07 20:30:51 +08:00
6eadad8222 Update environment-to-ini flag parsing () ()
Backport  by @fashberg

This Fixes  

This commit updates `environment-to-ini` to be compatible with update
urfave/cli/v2

Doc: <https://cli.urfave.org/v2/examples/combining-short-options/>

Co-authored-by: Folke <folke@ashberg.de>
2023-11-06 21:10:10 +00:00
a8e505a44b Unify two factor check () ()
Backport  by @KN4CK3R

Fixes 

We have support for two factor logins with the normal web login and with
basic auth. For basic auth the two factor check was implemented at three
different places and you need to know that this check is necessary. This
PR moves the check into the basic auth itself.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-11-06 18:07:22 +00:00
e47b31c691 Remove known issue section in Gitea Actions Doc () ()
Backport  by @lng2020

The bug has been fixed for several months in the
`docker/build-push-action`
The fix commit is
[d8823bfaed](d8823bfaed)
as the Gitea Actions Doc mentioned too.

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-11-06 17:03:06 +01:00
49f82ac4e3 Fix JS NPE when viewing specific range of PR commits () ()
Backport  by @delvh

This should be the easiest fix.
While other solutions might be possible that exterminate the root cause,
they will not be as trivial.

Co-authored-by: delvh <dev.lh@web.de>
2023-11-06 09:22:44 +00:00
81d233d987 Install poetry dependencies with --no-root () ()
Backport  by @silverwind

Poetry 1.7.0 or higher will print a warning otherwise, see discussions:

https://github.com/python-poetry/poetry/pull/8369
https://github.com/python-poetry/poetry/issues/1132

> --no-root Do not install the root package (the current project).

Co-authored-by: silverwind <me@silverwind.io>
2023-11-06 02:14:46 +00:00
2f56ab7999 Show correct commit sha when viewing single commit diff () ()
Backport  by @sebastian-sauer

Show the correct sha when viewing a single commit.


![image](https://github.com/go-gitea/gitea/assets/1135157/5f39a84e-11ed-4700-b40b-eb9da6e91bec)

Co-authored-by: sebastian-sauer <sauer.sebastian@gmail.com>
2023-11-06 09:09:35 +08:00
61d3d9205b Fix 500 when deleting a dismissed review () ()
Backport  by @lng2020

Fix  
Add a test to ensure its behavior

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-11-05 13:59:11 +00:00
28e3d0b0d3 Remove action runners on user deletion () ()
Backport  by @earl-warren

- On user deletion, delete action runners that the user has created.
- Add a database consistency check to remove action runners that have
nonexistent belonging owner.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1720

(cherry picked from commit 009ca7223dab054f7f760b7ccae69e745eebfabb)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-11-05 13:20:00 +00:00
4c67c05480 Backport translations to v1.21 ()
I manually fixed most of the files so that used translation keys don't
get deleted.
2023-11-04 20:33:38 +08:00
cf7374c079 Remove set tabindex on view issue () ()
Backport  by @earl-warren

- Remove the set tabindex and instead let the browser figure out the
correct tab order.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1626

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-11-03 23:25:11 +08:00
8d0a4d7e9d Fix DownloadFunc when migrating releases () ()
Backport  by @Zettat123

We should not use `asset.ID` in DownloadFunc because DownloadFunc is a
closure.

1bf5527eac/services/migrations/gitea_downloader.go (L284-L295)

A similar bug when migrating from GitHub has been fixed in . This
PR fixes the bug when migrating from Gitea and GitLab.

Co-authored-by: Zettat123 <zettat123@gmail.com>
2023-11-03 08:29:30 +00:00
9ca1853495 Fix http protocol auth () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-11-02 16:34:55 +01:00
d6f7c49b8b Reduce margin/padding on flex-list items and divider () ()
Backport  by @silverwind

Small CSS tweak, reduces margin/padding from 14px to 10px, which I think
looks better
2023-11-02 13:24:03 +08:00
c074af6a6d refactor postgres connection string building () ()
Backport  by @mpldr

This patchset changes the connection string builder to use net.URL and
the host/port parser to use the stdlib function for splitting host from
port. It also adds a footnote about a potentially required portnumber
for postgres UNIX sockets.

Fixes: 

Co-authored-by: Moritz Poldrack <33086936+mpldr@users.noreply.github.com>
2023-11-01 23:19:02 +00:00
39596115da Change katex limits () ()
Backport  by @KN4CK3R

Fixes 

Use higher defaults again but limit the input size.


![grafik](https://github.com/go-gitea/gitea/assets/1666336/23cdf572-de30-4799-b9cf-ef386b1623b9)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-11-01 22:26:45 +01:00
352906b448 doc: actions/act-runner: document running as a systemd service () ()
Backport  by @nodiscc

This documents running `act-runner` as a systemd service under a
dedicated user account.

Co-authored-by: nodiscc <nodiscc@gmail.com>
2023-11-01 18:18:01 +01:00
6637bbf510 Delete repos of org when purge delete user () ()
Fixes https://codeberg.org/forgejo/forgejo/issues/1514

Backports 

---------

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-11-01 10:03:12 +08:00
6ac2ade97d Clean up template locale usage () ()
Backport 

The only conflict is `ThemeName` in `500.tmpl`, it has been resolved
manually by keeping using old
`{{.SignedUser.Theme}}{{else}}{{DefaultTheme}}`
2023-10-31 17:35:55 +01:00
18a782f73d Fix package webhook () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-10-31 11:26:28 +01:00
6af6f81780 Add user secrets API integration tests () ()
Backport  by @jbgomond

Adds the missing user secrets API integration tests so  does not
happen again

Co-authored-by: Jean-Baptiste Gomond <dev@jbgomond.com>
2023-10-31 04:14:04 +00:00
d282f5dab8 Fix wrong relative path on obtain token from command line () ()
Backport  by @lunny

Caused by 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-10-31 11:36:22 +08:00
f3f56d570b doc: actions/act-runner: document obtaining a runner registration token from gitea CLI () () 2023-10-30 20:16:05 -04:00
3c03b7db50 Fix/upload artifact error windows () () 2023-10-30 11:57:48 +00:00
ac22116211 Always use whole user name as link () ()
Backport  by @denyskon

Starting from  this shared template only linked the username of
the user if both display name and username were shown. I experienced
myself always trying to click on the display name - I think it is
annoying for others too.

After:


![grafik](https://github.com/go-gitea/gitea/assets/47871822/a0e82127-b773-4ca4-890f-d18422a7bef2)

![grafik](https://github.com/go-gitea/gitea/assets/47871822/79efcf93-2f50-4fc4-ba15-afc6174be48c)

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2023-10-30 12:25:40 +01:00
25bc3d562a Fix bad method call when deleting user secrets via API () ()
Backport  by @jbgomond

Fixed a little mistake when you deleting user secrets via the API. Found
it when working on .
It should be backported to 1.21 I think.

Co-authored-by: Jean-Baptiste Gomond <dev@jbgomond.com>
2023-10-29 22:08:01 +08:00
991c959110 Dockerfile small refactor () ()
Backport  by @nfsec

- Size and layer optimization,
- Maintaining consistency in definitions (comments, apk etc.),

Co-authored-by: Patryk Krawaczyński <nfsec@users.noreply.github.com>
2023-10-29 13:20:54 +01:00
2d2a5657ef Upgrade xorm to 1.3.4 () ()
Backport  by @lng2020

Noticeable change: 
Remove the `OrderBy("1") `
[patch](https://github.com/go-gitea/gitea/pull/27673#issuecomment-1768570142)
for mssql since xorm has [fixed
it](0f085408af).

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-10-27 14:17:27 +02:00
977f5db28e Chroma v2.10.0 () ()
Backport  by @bt90

Bump the chroma version to v2.10.0:
https://github.com/alecthomas/chroma/releases/tag/v2.10.0

This release includes a better Java lexer
https://github.com/alecthomas/chroma/pull/873

Co-authored-by: bt90 <btom1990@googlemail.com>
2023-10-27 13:25:25 +02:00
487c573c28 Add dedicated class for empty placeholders () ()
Backport  by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/27784

<img width="1033" alt="Screenshot 2023-10-25 at 19 07 15"
src="https://github.com/go-gitea/gitea/assets/115237/1a363851-1a86-48cb-99ec-0a573371bb6e">
<img width="1051" alt="Screenshot 2023-10-25 at 19 07 41"
src="https://github.com/go-gitea/gitea/assets/115237/add4b606-2264-430a-af35-249ef005817f">

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-10-26 09:26:05 +02:00
25acbfed36 Close all hashed buffers () ()
Backport  by @KN4CK3R

Add missing `.Close()` calls. The current code does not delete the
temporary files if the data grows over 32mb.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-10-25 22:24:25 +02:00
9dd8f34707 Add gap between diff boxes () ()
Backport  by @silverwind

Before (almost no gap between files):
<img width="1240" alt="Screenshot 2023-10-24 at 19 43 32"
src="https://github.com/go-gitea/gitea/assets/115237/30cdbdbc-d102-479c-89ce-3f68837ae0cd">

After (with 8px gap):
<img width="1241" alt="Screenshot 2023-10-24 at 19 43 22"
src="https://github.com/go-gitea/gitea/assets/115237/72b26a30-8730-4a36-8de9-be143b684b98">

Co-authored-by: silverwind <me@silverwind.io>
2023-10-25 09:09:08 +08:00
77bd3acb65 Do not force creation of _cargo-index repo on publish () ()
Backport  by @merlleu

Hello there,
Cargo Index over HTTP is now prefered over git for package updates: we
should not force users who do not need the GIT repo to have the repo
created/updated on each publish (it can still be created in the packages
settings).

The current behavior when publishing is to check if the repo exist and
create it on the fly if not, then update it's content.
Cargo HTTP Index does not rely on the repo itself so this will be
useless for everyone not using the git protocol for cargo registry.

This PR only disable the creation on the fly of the repo when publishing
a crate.

This is linked to  (error 500 when trying to publish a crate if
user is missing write access to the repo) because it's now optional.

Co-authored-by: merlleu <r.langdorph@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-10-24 15:40:02 +08:00
95db95ef91 Fix incorrect "tab" parameter for repo search sub-template () ()
Backport  by wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-24 11:01:26 +08:00
ffab2b7e4f fix issues in translation file () ()
Backport  

- use correct comment sign for INI (`;`)
- remove duplicated `repo.branch.search` key
- remove duplicated spaces & similar
2023-10-24 01:53:01 +00:00
cb9e10f971 Fix label render containing invalid HTML () ()
Backport  by @earl-warren

- The label HTML contained a quote that wasn't being closed.

Refs: https://codeberg.org/forgejo/forgejo/pulls/1651

(cherry picked from commit e2bc2c9a1fff482c49dbeb3a51e4e1c698bf506c)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-10-24 09:39:13 +08:00
5087de1a5c Fix link-action redirect network error () ()
Backport  by @lng2020

<img width="823" alt="image"
src="https://github.com/go-gitea/gitea/assets/70063547/99da3d5a-c28a-4fd0-8ae0-88461a9142e2">

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2023-10-23 13:52:30 +00:00
f2bac791db Fix duplicate project board when hitting enter key () ()
Backport  by @lng2020

When hitting the `enter` key to create a new project column, the request
is sent twice because the `submit` event and `key up` event are both
triggered.
Probably a better solution is to rewrite these parts of the code to
avoid using native jQuery but reuse the `form-fetch-action` class. But
it's beyond my ability.

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-10-23 13:04:53 +00:00
c279f8aab7 Fix incorrect ctx usage in defer function () () 2023-10-22 14:36:49 +00:00
9f2b8c7ead fix labeler config on release/v1.21 ()
Manual backport of 
2023-10-22 13:53:34 +00:00
48e3aec862 Enable followCursor for language stats bar () ()
Backport  by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/27600


![](https://github.com/go-gitea/gitea/assets/115237/96743d90-0712-4f13-84ec-66f84e6ed2d7)

Also tested together with https://github.com/go-gitea/gitea/pull/27704,
works well.

Co-authored-by: silverwind <me@silverwind.io>
2023-10-22 15:35:58 +02:00
aabcf2d7ad Add doctor dbconsistency fix to delete repos with no owner () ()
Backport 
2023-10-22 02:21:41 +02:00
6919a02ab7 Fix org team endpoint () ()
Backport  by @lng2020

Fix 

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-10-22 00:07:28 +00:00
1848858a1e Feed UI Improvements () ()
Backport  by @silverwind

Various improvements related to feeds:

- Fix markdown rendering
- Increase font size from 13px to default 14px via `flex-item`
- Add style to hashes
- Move the timestamp to title line. I realize it's not optimal for
translation, we may need to change all these translations

Before:
<img width="768" alt="Screenshot 2023-09-29 at 22 52 58"
src="https://github.com/go-gitea/gitea/assets/115237/edda8b84-23cf-4a43-90ad-a892798f4e6c">

After:
<img width="781" alt="Screenshot 2023-09-29 at 22 58 09"
src="https://github.com/go-gitea/gitea/assets/115237/7097474d-efcf-4f22-a2ab-834a4e25c4e8">

Co-authored-by: silverwind <me@silverwind.io>
2023-10-21 11:13:15 +00:00
a398089301 Improve diff tree spacing () ()
Backport  by @silverwind

1. Un-indent top-level items, matching GitHub rendering
2. Increase item padding and add 1px gap between items

Before and After:

<img width="247" alt="Screenshot 2023-10-20 at 18 37 32"
src="https://github.com/go-gitea/gitea/assets/115237/43c1ce86-1814-4a8a-9dd2-0c4a82a2be7c">
<img width="241" alt="Screenshot 2023-10-20 at 18 40 46"
src="https://github.com/go-gitea/gitea/assets/115237/b541b85b-c428-4903-becd-773ae5807495">

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <m.huber@kithara.com>
2023-10-21 10:44:58 +00:00
8885108c42 Improve feed icons and feed merge text color () ()
Backport  by @silverwind

1. Improve various feed icons
2. Fix merge message color


<img width="763" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/3f5bcb23-6d90-4c63-85f2-46bd7e1c96d6">
<img width="769" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/466c37b4-e2f4-42bb-922d-b86596cdc6d0">


Fixes: https://github.com/go-gitea/gitea/issues/27495
Continues: https://github.com/go-gitea/gitea/pull/27356

Co-authored-by: silverwind <me@silverwind.io>
2023-10-21 12:29:06 +02:00
993178b45f [FIX] resolve confusing colors in languages stats by insert a gap () ()
Backport  by @RightFS

The current language stats are too obsessed with color matching. Similar
colors are always next to each other. It is a bit troublesome to find
the place where the color matching is generated, so just follow the
example of github and add a gap.

## before

<img width="883" alt="image"
src="https://github.com/go-gitea/gitea/assets/12915306/cf54430c-616c-4b37-b561-5a37c20b2d94">

## after

<img width="877" alt="image"
src="https://github.com/go-gitea/gitea/assets/12915306/e518ea36-2b8f-4f11-a867-a58dc393db85">

Co-authored-by: MrDevil <Right.Sun@outlook.com>
2023-10-21 02:04:44 +08:00
345d70f7e4 Fix sticky diff header background () ()
Backport  by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/27604

Add negative margins so the header covers any shadow of active elements.
No rendering change of the content of the header because the padding
counteracts the effect.

<img width="128" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/3d0f55b6-9351-4985-a290-da9a92d15b4e">

Co-authored-by: silverwind <me@silverwind.io>
2023-10-20 17:44:46 +02:00
6dce671d02 Adapt .changelog.yml to new labeling system () ()
Backport  by @delvh

Otherwise, it is not possible anymore to generate changelogs.

Co-authored-by: delvh <dev.lh@web.de>
2023-10-20 00:29:50 +02:00
6cef7a767b cleanup repo details icons/labels () ()
Backport  by @denyskon

Fix  

Change confusing behavior when showing information about a repo via labels and icons.
Implement changes proposed by @lng2020 in
https://github.com/go-gitea/gitea/pull/27627#pullrequestreview-1678787673.

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2023-10-19 22:04:24 +02:00
6befca1695 Fix required checkboxes in issue forms () ()
Backport  by @JakobDev

If you set a checkbox as required in a issue form at the moment, the
checkbox is checked and read only, what does not make much sense. With
this PR, the Checkbox actually needs to be checked. The label supports
now also Markdown. This matches GitHub's behaviour.

And yes, I know the CSS is a ugly workaround. It looks like the given
CSS code is part Fomantic and I don't know how to change that. The
Maintainers are free to change that.


![grafik](https://github.com/go-gitea/gitea/assets/15185051/3f35be75-b0b4-42a7-9048-a4970384a035)

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-10-19 15:35:29 +02:00
89d3766d22 Upgrade xorm () ()
Backport  by @lng2020

Related to https://gitea.com/xorm/xorm/pulls/2341

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-10-19 10:56:39 +00:00
9b14f1a8ed Always delete existing scheduled action tasks () ()
Backport  by @KN4CK3R

Fixes 

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-10-19 09:37:20 +02:00
0b8b0072a2 Clipboard copy enhancements () ()
Backport  by @silverwind

1. Do not show temporary tooltips that are triggered from within
dropdowns. Previously this resulted in the tooltip being stuck to
top-left of the page like seen on issue comment URL copy. I could not
figure out any tippy options that prevent this, so I think it's better
to just not show it.
1. Refactor `initGlobalCopyToClipboardListener` so that it does not run
a often useless `document.querySelector` on every click, make
`data-clipboard-text-type` work with `data-clipboard-target`. No use in
current code base but still good to have. Finally some minor code
cleanup in the function.

Point 1 is for this copy button:

<img width="229" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/81f34746-8ea5-43d9-8c6f-f6f417a9e4ad">

Co-authored-by: silverwind <me@silverwind.io>
2023-10-19 00:23:28 +08:00
dab40cd5f4 Support allowed hosts for webhook to work with proxy () ()
Backport  by @wolfogre

When `webhook.PROXY_URL` has been set, the old code will check if the
proxy host is in `ALLOWED_HOST_LIST` or reject requests through the
proxy. It requires users to add the proxy host to `ALLOWED_HOST_LIST`.
However, it actually allows all requests to any port on the host, when
the proxy host is probably an internal address.

But things may be even worse. `ALLOWED_HOST_LIST` doesn't really work
when requests are sent to the allowed proxy, and the proxy could forward
them to any hosts.

This PR fixes it by:

- If the proxy has been set, always allow connectioins to the host and
port.
- Check `ALLOWED_HOST_LIST` before forwarding.

Co-authored-by: Jason Song <i@wolfogre.com>
2023-10-18 15:07:52 +02:00
5b80157aad Fix poster is not loaded in get default merge message () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-10-17 18:20:35 +02:00
bf76216de1 Hide archived labels by default from the suggestions when assigning labels for an issue () ()
Backport  by @puni9869

Followup of 
Finally closes 

## Screenshots
### Issue Sidebar
<img width="513" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/9f7fda2f-5a03-4684-8619-fd3498a95b41">

### PR sidebar
<img width="367" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/53db9b64-faec-4a67-91d6-76945596a469">

### PR sidebar with archived labels shown
<img width="352" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/9dc5050f-4e69-4f76-bb83-582480a2281e">

Signed-off-by: puni9869 <punitinani1@hotmail.com>
Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
2023-10-17 14:46:35 +00:00
21c3513d49 Improve dropdown button alignment and fix hover bug () ()
Backport  by @wxiaoguang

1. fix  , and add samples to devtest page
2. fix incorrect color for "ui dropdown button" when hover

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-16 16:15:15 +08:00
8cf7548a18 Improve retrying index issues () ()
Backport  by @wolfogre

Fix 

Co-authored-by: Jason Song <i@wolfogre.com>
2023-10-16 09:55:53 +08:00
066aee28a5 Fix 404 when deleting Docker package with an internal version () ()
Backport  by @lng2020

close 
The Docker registry has an internal version, which leads to 404

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-10-15 12:08:04 +02:00
148f6e3776 Change the default branch in the agit docs () ()
Backport  by @lng2020

It's main now.
relevant 

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-10-15 09:16:15 +08:00
fa6941cf8c Backport manually for a tmpl issue in v1.21 ()
backport  
close 
2023-10-14 11:51:58 +00:00
54dccbeb2e Fix build errors on BSD (in BSDMakefile) () ()
Backport  by @sryze

1. `make build` fails because `||` and `&&` have the same precedence in
sh/bash, so the `false` command always evaluated (leading to an error).

   ```
   + which gmake /usr/local/bin/gmake
   + false

   *** Failed target:  .BEGIN
*** Failed command: which "gmake" || printf "Error: GNU Make is
required!\n\n" 1>&2 && false
   *** Error code 1
   ```

2. When `GPREFIX` is set to an empty string with quotation marks,
`gmake` mistakenly thinks that it's a file name:

   ``` gmake: *** empty string invalid as file name.  Stop. ```

Co-authored-by: Sergey Zolotarev <sryze@protonmail.com>
2023-10-14 07:29:55 +00:00
9f228704a3 Upgrade go dependencies () ()
Backport 

Upgrade all dependencies in `go.mod`

`golang.org/x/net` v0.17.0 also fixes
[CVE-2023-39325](https://github.com/advisories/GHSA-4374-p667-p6c8)

Co-authored-by: delvh <dev.lh@web.de>
2023-10-13 17:23:17 +00:00
21f1e223d8 Keep filter when showing unfiltered results on explore page () ()
Backport  by @JakobDev

Fixes https://codeberg.org/Codeberg/Community/issues/1302

Co-authored-by: JakobDev <jakobdev@gmx.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-12 08:56:21 +08:00
63a321b83a Don't show Link to TOTP if not set up () ()
Backport  by @JakobDev

Fixes https://codeberg.org/forgejo/forgejo/issues/1592

When login in with WebAuth, the page has a link to use TOTP instead.
This link is always displayed, no matter if the User has set up TOTP or
not, which do of cause not work for those who have not.

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-10-11 22:59:21 +02:00
844ab9a441 Fix data-race bug when accessing task.LastRun () ()
Backport  by @wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-11 15:27:38 +00:00
7ec7c733c7 Replace ajax with fetch, improve image diff () ()
Backport  by @silverwind

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: silverwind <me@silverwind.io>
2023-10-11 16:12:31 +02:00
4986dc8351 fully replace drone with actions () ()
Backport  by @techknowlogick

this builds binaries and docker images for tags

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2023-10-11 12:03:06 +00:00
1380a46623 show manual cron run's last time () ()
Backport  by @earl-warren

- Currently in the cron tasks, the 'Previous Time' only displays the
previous time of when the cron library executes the function, but not
any of the manual executions of the task.
- Store the last run's time in memory in the Task struct and use that,
when that time is later than time that the cron library has executed
this task.
- This ensures that if an instance admin manually starts a task, there's
feedback that this task is/has been run, because the task might be run
that quick, that the status icon already has been changed to an
checkmark,
- Tasks that are executed at startup now reflect this as well, as the
time of the execution of that task on startup is now being shown as
'Previous Time'.
- Added integration tests for the API part, which is easier to test
because querying the HTML table of cron tasks is non-trivial.
- Resolves https://codeberg.org/forgejo/forgejo/issues/949

(cherry picked from commit fd34fdac1408ece6b7d9fe6a76501ed9a45d06fa)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: silverwind <me@silverwind.io>
2023-10-11 13:26:34 +02:00
f19feb0f47 Revert "Fix pr template ()" ()
Reverts backport go-gitea/gitea#27440
Fix 
2023-10-11 03:11:04 +00:00
9da92835d1 Fix attachment download bug () ()
Backport  by @lunny

Fix 

This PR allows `/<username>/<reponame>/attachments/<uuid>` access with
personal access token and also changed attachments API download url to
it so it can be download correctly.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-10-11 04:39:12 +02:00
478e7042f5 Increase queue length () ()
Backport  by @wolfogre

It should be OK to increase the default queue length since the default
type is "level".

IMO, the old default length (100) is a little too small. See
https://github.com/go-gitea/gitea/issues/27540#issuecomment-1754269491

IIRC, a larger length could lead to more memory usage only when the type
is "channel," but it's an obscure case. Otherwise, it's just a limit
(for "level" or "redis").

Co-authored-by: Jason Song <i@wolfogre.com>
2023-10-10 20:22:26 +08:00
63587a4aef Respect SSH.KeygenPath option when calculating ssh key fingerprints () ()
Backport  by @picsel2

Fixes 

Co-authored-by: Sebastian Grabowski <sebastian@grabel.de>
2023-10-10 07:37:58 +00:00
29d3949271 Avoid run change title process when the title is same () ()
Backport  manually.
2023-10-10 09:01:46 +02:00
71f091ef97 Remove max-width and add hide text overflow () ()
Backport  by @kdumontnu

Closes https://github.com/go-gitea/gitea/issues/27358

Co-authored-by: Kyle D <kdumontnu@gmail.com>
2023-10-09 22:02:26 -04:00
9a64a24f29 use hosted runners for nightly actions () ()
Backport  by @techknowlogick

I'm temporarily unable to properly evaluate actuated runners, and so I'm
switching back to hosted runners until I am able to focus on that again.

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: silverwind <me@silverwind.io>
2023-10-09 14:10:42 -04:00
d8513fc312 switch to using official AWS step in release nightly () ()
Backport  by @techknowlogick

`jakejarvis/s3-sync-action@master` is out of date, and using official
actions is always recommended

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2023-10-09 13:53:45 -04:00
8c969cdf9c Fix environment-to-ini inherited key bug () ()
Backport  by @wxiaoguang

Fix  

The INI package has a quirk: by default, the keys are inherited.
When maintaining the keys, the newly added sub key should not be
affected by the parent key.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-09 17:46:58 +00:00
4c9f7d0710 api: GetPullRequestCommits: return file list () ()
Backport  by @msantos

Fixes https://github.com/go-gitea/gitea/issues/27481

---
Patch tested:

```json
[
  {
    "url": "7664dcb441",
    "sha": "7664dcb44167e0f9efd994e4ca6a9164694adc27",
    "created": "2023-10-06T09:57:08-04:00",
    "html_url": "7664dcb441",
...
    "files": [
      {
        "filename": "README.md",
        "status": "modified"
      }
    ],
    "stats": {
      "total": 2,
      "additions": 2,
      "deletions": 0
    }
  }
]
```

Co-authored-by: Michael Santos <michael.santos@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-09 14:21:35 +02:00
a1ee172fb0 Improve dropdown's behavior when there is a search input in menu () ()
Backport  by @wxiaoguang

Follow 

The change in  is not ideal, this should be the complete fix:
support the layout which Fomantic doesn't support.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-09 15:15:18 +08:00
fb5ae2ab94 Restore warning commit status () ()
Backport  by @silverwind

Partial revert of https://github.com/go-gitea/gitea/pull/25839. This
commit status is used by a number of external integrations, so I think
we should not remove it (See
https://github.com/go-gitea/gitea/pull/25839#issuecomment-1729002077).
This is a rare case where an existing migration needed to be alterted to
avoid data loss.

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
2023-10-09 11:56:02 +08:00
8419897fba Update JS and PY dependencies () ()
Backport https://github.com/go-gitea/gitea/pull/27501 to 1.21

- Update all JS and PY dependencies
- Enable eslint `prefer-object-has-own` and autofix issue
- Fix styling on citation buttons
- Tested citation, mermaid, monaco, swagger, katex

Citation button issue was that these buttons were not filled:

<img width="136" alt="Screenshot 2023-10-07 at 14 05 08"
src="https://github.com/go-gitea/gitea/assets/115237/435f0c91-28ac-46b3-bae4-dad768b29c05">

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-10-08 19:31:33 +02:00
17698d4a62 Add hover background to wiki list page () ()
Backport  by @BLumia

This patch adds a hover background for the wiki row in wiki list page,
which make its behavior more close to repo's file list page.

This patch also make the wiki-git-entry visible on the row is hovered
instead of the cel, so users won't be confused since the 'grid' is not
visible from the web page.

After the patch: (when the wiki named 'Home' is hovered)


![image](https://github.com/go-gitea/gitea/assets/10095765/f6c67c41-ad54-4ce4-a3b1-8c7551396ce0)

Co-authored-by: Gary Wang <git@blumia.net>
2023-10-08 13:48:51 +00:00
0fb7294027 Fix mermaid flowchart margin issue () ()
Backport https://github.com/go-gitea/gitea/pull/27503 to 1.21

Fixes: https://github.com/go-gitea/gitea/issues/27435
Related: https://github.com/mermaid-js/mermaid/issues/4907

<img width="924" alt="image"

src="https://github.com/go-gitea/gitea/assets/115237/494a1d2e-4c56-48d0-9843-82a5e5aa977e">
2023-10-08 15:31:47 +02:00
8e1ef5787f bump go-deps () ()
Backport  by @techknowlogick

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: silverwind <me@silverwind.io>
2023-10-08 00:07:09 +00:00
65020fdf7f Enable markdownlint no-duplicate-header () ()
Backport  by @silverwind

Duplicate headers in a single Markdown document are problemlematic
because the auto-generated links won't be stable. Enable this rule with
no exceptions which is also the default of `markdownlint`. For example:

```md
# A
## Example
# B
## Example
```
Docasaurus will generated `example` and `example-1` links for this. If
the first heading is altered, the link `example` will unexpectedly move
to the second example heading.

Ref: https://github.com/go-gitea/gitea/pull/27461#discussion_r1347987659

Co-authored-by: silverwind <me@silverwind.io>
2023-10-07 21:41:41 +08:00
5b670d83e1 Fix panic in storageHandler () ()
Backport  by @sryze

storageHandler() is written as a middleware but is used as an endpoint
handler, and thus `next` is actually `nil`, which causes a null pointer
dereference when a request URL does not match the pattern (where it
calls `next.ServerHTTP()`).

Example CURL command to trigger the panic:

```
curl -I "http://yourhost/gitea//avatars/a"
```

Fixes 

---

Note: the diff looks big but it's actually a small change - all I did
was to remove the outer closure (and one level of indentation) ~and
removed the HTTP method and pattern checks as they seem redundant
because go-chi already does those checks~. You might want to check "Hide
whitespace" when reviewing it.

Alternative solution (a bit simpler): append `, misc.DummyOK` to the
route declarations that utilize `storageHandler()` - this makes it
return an empty response when the URL is invalid. I've tested this one
and it works too. Or maybe it would be better to return a 400 error in
that case (?)

Co-authored-by: Sergey Zolotarev <sryze@outlook.com>
2023-10-06 16:51:26 +02:00
9207331f4d Revert ()
Apparently, we didn't backport one of the refactoring PRs which caused
the fixup we backported to fail.

Fixes: https://github.com/go-gitea/gitea/issues/27473
2023-10-06 20:47:45 +08:00
44aca6a65a Don't let API add 2 exclusive labels from same scope () ()
Backport  by @JakobDev

Fixes 

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-10-06 05:06:31 +08:00
aaf35ee49c Refactor system setting () ()
Backport  by @wxiaoguang

This PR reduces the complexity of the system setting system.

It only needs one line to introduce a new option, and the option can be
used anywhere out-of-box.

It is still high-performant (and more performant) because the config
values are cached in the config system.


![image](https://github.com/go-gitea/gitea/assets/2114189/f8cdd743-1145-41ab-9f8f-3996aa97d440)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-05 10:37:59 +00:00
a9d547f55b When comparing with an non-exist repository, return 404 but 500 () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-10-04 14:41:57 +00:00
51001d9ffe Fix pr template () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-10-04 12:56:02 +00:00
1ff6b7783c Fix missing ctx in new_form.tmpl () ()
Backport  by @CaiCandong

Fix  
Regression of 

Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
2023-10-04 12:12:06 +00:00
99e2071eeb Fix yet another ctx template bug () ()
Backport  by @delvh

Fixes 

Co-authored-by: delvh <dev.lh@web.de>
2023-10-04 07:52:57 +00:00
1dd84ec3a1 Use flex-container for repo and org settings () ()
Backport  by @silverwind

Same as https://github.com/go-gitea/gitea/pull/26046 but for repo and
org settings pages, reducing the margins between the boxes:

<img width="1247" alt="Screenshot 2023-10-03 at 23 25 19"
src="https://github.com/go-gitea/gitea/assets/115237/4e68ad5e-5fdc-4466-aefb-ec71bf411d45">
<img width="1255" alt="Screenshot 2023-10-03 at 23 27 12"
src="https://github.com/go-gitea/gitea/assets/115237/9068369b-a75d-401e-8b8d-3bd4bbe097dc">

Co-authored-by: silverwind <me@silverwind.io>
2023-10-04 07:20:43 +00:00
290440e1ee Add Index to action.user_id () ()
Backport  by @JakobDev

Another Column that needs a Index. Found at
https://codeberg.org/forgejo/discussions/issues/61#issuecomment-1258744.

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-10-04 08:53:00 +02:00
881a844c9d Add 1.20.5 changelog () ()
frontend 
2023-10-03 22:21:19 +08:00
d5da0e622c Don't use subselect in DeleteIssuesByRepoID () ()
Backport  by @JakobDev

Part of https://codeberg.org/forgejo/discussions/issues/61

This is workaround for a bug in MariaDB

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-10-03 17:59:45 +08:00
8c6464e39b Add support for HEAD ref in /src/branch and /src/commit routes () ()
Backport  by @rbhz

Add support for HEAD in paths:
```
/src/branch/HEAD/README.md
/src/commit/HEAD/README.md
```

Closes 

Co-authored-by: Kirill Sorokin <48334247+rbhz@users.noreply.github.com>
2023-10-03 08:13:49 +00:00
4f02b4a7b9 Make Actions tasks/jobs timeouts configurable by the user () ()
Backport  by @fantognazza

With this PR we added the possibility to configure the Actions timeouts
values for killing tasks/jobs.
Particularly this enhancement is closely related to the `act_runner`
configuration reported below:
```
# The timeout for a job to be finished.
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
timeout: 3h
```

---

Setting the corresponding key in the INI configuration file, it is
possible to let jobs run for more than 3 hours.

Signed-off-by: Francesco Antognazza <francesco.antognazza@gmail.com>
2023-10-03 10:26:35 +08:00
7dc5ab2e95 Fix git 2.11 error when checking IsEmpty () ()
Backport  by @wxiaoguang

Fix 

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-02 22:36:18 +02:00
28d970e4a6 Hide archived labels when filtering by labels on the issue list () ()
Backport  by @puni9869

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: puni9869 <80308335+puni9869@users.noreply.github.com>
Co-authored-by: delvh <dev.lh@web.de>
2023-10-01 22:56:48 -04:00
4e824a735e Allow get release download files and lfs files with oauth2 token format () ()
Backport  by @lunny

Fix 
Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-10-01 19:54:11 +08:00
eea79ce586 highlight user details link () ()
Backport  by @denyskon

This PR adds a separated column in the users table for operations. The
username link now redirects back to user page.


![grafik](https://github.com/go-gitea/gitea/assets/47871822/df8c8b30-3da6-443c-ae0f-6e3cac7dd9bb)

Resolves
https://github.com/go-gitea/gitea/pull/26713#pullrequestreview-1603001285

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: silverwind <me@silverwind.io>
2023-10-01 10:23:42 +00:00
e9340ce9bc Fix missing ctx for GetRepoLink in dashboard () ()
Backport  by @CaiCandong

As title
Fix 
Regression of 

Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
2023-10-01 09:54:58 +00:00
de387102b4 Introduce fixes and more rigorous tests for 'Show on a map' feature () ()
Backport  by @n0toose

This change introduces some fixes for my original PR
(https://github.com/go-gitea/gitea/pull/26214) and introduces some
additional tests so that such a regression does not happen again in the
future.

Co-authored-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
2023-09-30 15:58:35 +00:00
79c17d8b6a Absolute positioned checkboxes overlay floated elements () ()
Backport  by @rafh

Currently, checkboxes are positioned as absolute. This positioning
causes the input to overlay an element that has been floated within the
editor. Floated elements are useful if you want your text to wrap around
this element. This PR fixes the overlaying of checkboxes by removing the
absolute positioning, updating the `ul` padding, and
displaying`.task-list-item` `flex` to ensure inputs and the associated
label are on the same line.

Screenshots:

Before:
<img width="762" alt="Screenshot 2023-09-01 at 3 40 59 PM"
src="https://github.com/go-gitea/gitea/assets/6152817/570247c7-7f5c-4697-bfc9-ad4655e37991">

After:
<img width="762" alt="Screenshot 2023-09-01 at 3 42 20 PM"
src="https://github.com/go-gitea/gitea/assets/6152817/db53df45-1294-4eee-84c0-b21ac4fdf805">

Co-authored-by: Rafael Heard <rafael.heard@gmail.com>
Co-authored-by: rafh <rafaelheard@gmail.com>
2023-09-30 17:10:48 +02:00
006c15fb5f Fix template bug () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-09-30 09:30:30 +00:00
0c4f97c112 Fix repo count in org action settings () ()
Backport  by @yp05327

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)

Co-authored-by: yp05327 <576951401@qq.com>
2023-09-29 20:00:24 +02:00
f9395eaa08 Add protected branch name description () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2023-09-29 16:38:11 +02:00
f13a294b47 More db.DefaultContext refactor () ()
Backport  by @JakobDev

Part of 

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.

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-09-29 13:35:01 +00:00
84ee02faa7 Improve tree not found page () ()
Backport  by @yp05327

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: yp05327 <576951401@qq.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-09-29 18:35:11 +08:00
f77b4cb4a2 Add logs for data broken of comment review () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-09-29 13:31:13 +08:00
7ea7f2b37f Add Index to comment.dependent_issue_id () ()
Backport  by @JakobDev

This Column is missing index. It is used by
[issue_service.deleteIssue](7ea2a910ce/services/issue/issue.go (L300)).

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-09-29 02:00:14 +00:00
c61b9c5f3c Fix the approval count of PR when there is no protection branch rule () ()
Backport  by @lng2020

As title

![ksnip_20230926-115158](https://github.com/go-gitea/gitea/assets/70063547/a60be44a-06ad-421e-ba27-e4e0adfa5db7)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-09-29 09:31:35 +08:00
e719bf8ead Fix review UI () ()
Backport  by @wxiaoguang

Close 


1. The `diff-detail-box` was abused, it shouldn't be used for
"DiffFileList/DiffFileTree".
2. Fix the sticky position for various screens.



![image](https://github.com/go-gitea/gitea/assets/2114189/558a5c06-c94c-4e5c-8395-d38473dd21c2)


![image](https://github.com/go-gitea/gitea/assets/2114189/3390fb0e-7dc7-457f-bd0c-398fdb6d24c0)


![image](https://github.com/go-gitea/gitea/assets/2114189/d19dd350-aecf-4909-8ef9-73b09d94560e)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-28 13:27:13 +00:00
9903b8d7ec Fix Bug in Issue Config when only contact links are set () ()
Backport  by @JakobDev

Blank Issues should be enabled if they are not explicit disabled through
the `blank_issues_enabled` field of the Issue Config. The Implementation
has currently a Bug: If you create a Issue Config file with only
`contact_links` and without a `blank_issues_enabled` field,
`blank_issues_enabled` is set to false by default.

The fix is only one line, but I decided to also improve the tests to
make sure there are no other problems with the Implementation.

This is a bugfix, so it should be backported to 1.20.

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-09-28 20:55:45 +08:00
77ccd215e2 Fix divider in subscription page () ()
Backport  by @yp05327

divider should always display in subscription page.

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/5a5c948c-8e45-4faa-827e-a05356f3a714)

![image](https://github.com/go-gitea/gitea/assets/18380374/8f6a6747-5414-45cc-8b4c-aa99ea869038)


After:
(no changes when there's no subscriptions)

![image](https://github.com/go-gitea/gitea/assets/18380374/261faf8d-97e2-4d79-a255-5077a42979d2)

![image](https://github.com/go-gitea/gitea/assets/18380374/fc73c837-2efb-40b2-a8f8-2b5c77c32f3b)

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2023-09-28 10:37:33 +00:00
71d1bfea7f Improve issue history dialog and make poster can delete their own history () ()
Backport  by @wxiaoguang

Fix  (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)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-28 09:46:46 +00:00
b00489886d Improve branch list UI () ()
Backport  by @wxiaoguang

1. Put the `"octicon-shield-lock"` into the flex container, then it
doesn't need a separate flex box
2. Remove some unnecessary `gt-df` helpers
3. Make `btn` button has the same flex behavior as `ui button`

![image](https://github.com/go-gitea/gitea/assets/2114189/60ce75f7-7fac-4157-9c42-91c7dee9300e)

![image](https://github.com/go-gitea/gitea/assets/2114189/ea606baf-6f52-41e1-b964-c4840d3b1529)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-28 06:14:34 +00:00
9b698362a3 Redefine the meaning of column is_active to make Actions Registration Token generation easier () ()
Backport  by @lunny

Partially Fix 

This PR redefined the meaning of column `is_active` in table
`action_runner_token`.
Before this PR, `is_active` means whether it has been used by any
runner. If it's true, other runner cannot use it to register again.

In this PR, `is_active` means whether it's validated to be used to
register runner. And if it's true, then it can be used to register
runners until it become false. When creating a new `is_active` register
token, any previous tokens will be set `is_active` to false.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-09-28 04:15:53 +00:00
1a923c95dd fix orphan check for deleted branch () ()
Backport  by @earl-warren

- Modify the deleted branch orphan check to check for the new table
instead.
- Regression from 6e19484f4d3bf372212f2da462110a1a8c10cbf2
- Resolves https://codeberg.org/forgejo/forgejo/issues/1522

(cherry picked from commit c1d888686fe445e4edecb9d835c5b3893b574b75)

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-09-28 10:52:53 +08:00
a6a79add68 Fix protected branch icon location () ()
Backport  by @yp05327

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/717c726d-d3ae-4ea3-86bf-36fd8430f1ba)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/f4508428-380a-4b44-9cc2-fa9483971808)

Co-authored-by: yp05327 <576951401@qq.com>
2023-09-27 22:51:01 +00:00
d74fba8175 Use vitest globals () ()
Backport  by @silverwind

Enable [globals](https://vitest.dev/config/#globals) in vitest, reducing
the noise in test files.

Co-authored-by: silverwind <me@silverwind.io>
2023-09-27 16:10:08 +02:00
e4cf9d22a7 bump bleve () ()
Backport  by @techknowlogick

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-09-27 07:47:30 +00:00
755369df56 Fix yaml test () ()
Backport  by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-09-27 15:05:35 +08:00
42f7c2ad89 Enable production source maps for index.js, fix CSS sourcemaps () ()
Backport  by @silverwind

Previously, the production build never output sourcemaps. Now we emit
one file for `index.js` because it is the most likely one where we need
to be able to better debug reported issues like
https://github.com/go-gitea/gitea/issues/27213. This will currently
increase the binary size of gitea by around 700kB which is what the
gzipped source map file has.

Also, I fixed the CSS sourcemap generation which was broken since the
introduction of lightningcss.

The chinese docs are machine-translated, please correct accordingly.

Co-authored-by: silverwind <me@silverwind.io>
2023-09-27 04:26:28 +02:00
fee8522052 Fix some animation bugs () ()
Backport 

Fix 
Replace 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-27 01:24:25 +00:00
34c440996d Add missed return to actions view fetch () ()
Backport  by @silverwind

Should fix: https://github.com/go-gitea/gitea/issues/27213

@denyskon can you test this? I can not reproduce this error locally.

Co-authored-by: silverwind <me@silverwind.io>
2023-09-27 09:10:21 +08:00
283b19bad5 Fix more yaml lint errors () ()
Backport  by @lunny

Fix 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-09-26 19:00:12 +02:00
f0045f4113 Add missing IconHTML size () ()
Backport  by @wxiaoguang

Fix 

Regression of 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-26 15:10:41 +00:00
0abd78e6a8 Fix incorrect change from () ()
Backport  by @delvh

Co-authored-by: delvh <dev.lh@web.de>
2023-09-26 13:39:39 +00:00
fc7d3f7315 Another round of db.DefaultContext refactor () ()
Backport  by @JakobDev

Part of 

Co-authored-by: JakobDev <jakobdev@gmx.de>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-09-25 19:24:35 +02:00
597b04fe2f Backport ctx locale refactoring manually () () ()
Backport   manually

---------

Co-authored-by: delvh <dev.lh@web.de>
2023-09-25 13:15:51 +00:00
2774a2afc6 Disable Test Delivery and Replay webhook buttons when webhook is inactive () ()
Backport  by @yardenshoham

These buttons are now disabled when the webhook is not active.

The buttons were always enabled before this change.

- Fixes 
- Replaces 

# Before


![image](https://github.com/go-gitea/gitea/assets/20454870/e783d0d8-b433-440e-b95f-50d7c42613d3)


![image](https://github.com/go-gitea/gitea/assets/20454870/b4886151-9f32-4e83-8001-dd3f20c23d70)

# After


![image](https://github.com/go-gitea/gitea/assets/20454870/74b76a72-0818-4143-8548-5d42c4119a05)


![image](https://github.com/go-gitea/gitea/assets/20454870/d5ae4e5c-c1ac-4751-a072-e6f7511b1e07)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2023-09-25 10:21:06 +00:00
89b6f20bf8 Fix PushEvent NullPointerException jenkinsci/github-plugin () ()
Backport  by @Nabapadma-sarker

Fixes 

Co-authored-by: Nabapadma-sarker <nabapadmacse1991@gmail.com>
2023-09-25 08:24:50 +00:00
37c7780e85 Use mask-based fade-out effect for .new-menu () ()
Backport  by @silverwind

The `.new-menu` was using a pseudo-element based fade-out effect.
Replace this with a more modern mask-based effect which in this case
required a child element to avoid fading out the background as well, so
I applied it to child `new-menu-inner` which was present on all these
menus except explore where I added it.

There is no visual difference except that the items on the explore page
have no `gap` between them any longer, making it consistent with other
menus. Before and after:

<img width="221" alt="Screenshot 2023-09-21 at 21 13 19"
src="https://github.com/go-gitea/gitea/assets/115237/b4a38ce2-cee1-4c54-84a5-e1d0bfd79e29">
<img width="222" alt="Screenshot 2023-09-21 at 21 32 36"
src="https://github.com/go-gitea/gitea/assets/115237/bb6b1335-d935-4ad4-bb85-3b0fc3027c2b">

Also, this cleans up the related CSS vars:

- `--color-header-wrapper-transparent` is removed, no longer needed
- `--color-header-wrapper` is defined in base theme as well, was
previously unset and therefor transparent.

[no whitespace
diff](https://github.com/go-gitea/gitea/pull/27181/files?diff=unified&w=1)
[demo of mask fade](https://jsfiddle.net/silverwind/tsfadb3u/)

Co-authored-by: silverwind <me@silverwind.io>
2023-09-25 07:52:41 +00:00
e0832da7fa Add missing public user visibility in user details page () ()
Backport  by @yp05327

It seems that `Public` user visibility is missing in the template.

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/a8e7f3e0-1b77-41a0-921a-10adba90211e)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/b0bffe13-0ca6-453e-95d7-0794528d5733)

Co-authored-by: yp05327 <576951401@qq.com>
2023-09-25 07:03:22 +00:00
daaf0ad473 cleanup locale function usage () ()
Backport  by @denyskon

Throughout the Gitea codebase, you can meet some weird constructions to
make `locale.Tr` work in subtemplates.
Since we now have `ctx.Locale.Tr` which solves that problem, clean up
various templates which pass `locale` through `dict` or use some weird
constructions like `$.root.locale`

Going on, it would be great to replace every case of `$.locale.Tr` and
`.locale.Tr` with `ctx.Locale.Tr`, but that needs to be done with
patience.

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2023-09-25 00:21:38 +00:00
9fc24a8f5e Fix z-index on markdown completion () ()
Backport  by @silverwind

Fixes: https://github.com/go-gitea/gitea/issues/27230

Co-authored-by: silverwind <me@silverwind.io>
2023-09-24 23:41:37 +00:00
a1029cb2ca Fix EOL handling in web editor () ()
Backport  by @silverwind

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

Co-authored-by: silverwind <me@silverwind.io>
2023-09-24 22:10:38 +00:00
134c7636ef Update database-preparation and add note re: MariaDB () ()
Backport  by @techknowlogick

update DB docs per feedback.
https://gitea.com/gitea/gitea-docusaurus/issues/69

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2023-09-25 05:27:25 +08:00
88271167d6 Allow copying issue comment link on archived repos and when not logged in () ()
Backport  by @JakobDev

Fixes https://codeberg.org/Codeberg/Community/issues/1303

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-09-24 19:25:09 +00:00
a8086f6148 fix issues on action runners page () ()
Backport  by @denyskon

- switch from some weird status badge to label
- translate untranslated `Reset registration token` string
- change documentation link from act_runner README to Gitea Docs site
- fix "No runners available" message width
- use `ctx.Locale.Tr` where possible


![grafik](https://github.com/go-gitea/gitea/assets/47871822/65547228-f9ed-4f80-9cfd-df5e55513a44)

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
2023-09-24 18:43:12 +00:00
f4f6885c1f Fix Fomantic UI dropdown icon bug when there is a search input in menu () ()
Backport  by @wxiaoguang

Fix 

And add the case to the devtest page.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-24 13:42:00 +00:00
64c0a6a4e2 Quote table release in sql queries () ()
Backport  by @KN4CK3R

Fixes 

`release` is a reserved keyword in MySql. I can't reproduce the issue on
my setup and we have a test for that code but it seems there can be
setups where it fails.


a101dbaa79/tests/integration/repo_activity_test.go (L45-L46)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-09-23 21:15:05 +00:00
2181b3713e Update go-enry to 2.8.5 () () 2023-09-23 16:05:59 -04:00
2084c3933d Update nodejs installation method in release container () ()
Backport  by @silverwind

Nodesource has
[deprecated](https://github.com/nodesource/distributions#new-update-%EF%B8%8F)
their install script, so use this new [manual
method](https://github.com/nodesource/distributions#installation-instructions)
instead.
2023-09-23 21:25:34 +08:00
b6dab855f5 fix: text decorator on issue sidebar menu label () ()
Backport  by @metiftikci

fix underline for label on issue sidebar

Co-authored-by: metiftikci <metiftikci@hotmail.com>
2023-09-23 20:47:40 +08:00
e9fcdf822c Update JS and Poetry dependencies and eslint () ()
Backport  by @silverwind

- Update all JS and Poetry dependencies
- Remove deprecated `eslint-plugin-custom-elements` and replace it with
rules from `eslint-plugin-wc`
- Add a convenience `make update` to update both js and py dependencies
- Tested markdown toolbar, swagger and citation

Co-authored-by: silverwind <me@silverwind.io>
2023-09-22 21:26:42 +00:00
7750a7313d Fix release URL in webhooks () ()
Backport  by @jolheiser

Resolves 

`URL` points to the API URL, `HTMLURL` points to the web page.

Notably, however, for PRs they are the same URL. I switched them to use
HTMLURL to match the rest of the codebase terminology.

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-09-21 23:22:14 +00:00
81ae35aa4f Fix review request number and add more tests () ()
Backport  by @lng2020

fix  
## testfixture yml
1. add issue20(a pr issue) in repo 23, org 17
2. add user15 to team 9
3. add four reviews about issue20
## test case
add two tests that are described with code comments
the code before pr  failed the first test
<img width="479" alt="image"
src="https://github.com/go-gitea/gitea/assets/70063547/1d9b5787-11b4-4c4d-931f-6a9869547f35">
current code failed the second test(as mentioned in )
<img width="484" alt="image"
src="https://github.com/go-gitea/gitea/assets/70063547/05608055-7587-43d1-bae1-92c688270819">
Any advice is appreciated.

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
2023-09-21 17:01:37 +00:00
2e49a4da48 Fix dropdown icon position () ()
Backport  by @wxiaoguang

According to https://fomantic-ui.com/modules/dropdown.html and our
"devtest" page, many dropdown elements has incorrect "icon" position.

This PR fixes all of them. Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-21 16:24:07 +00:00
8d9e2d07f3 Fix repo sub menu () ()
Backport  by @wxiaoguang

Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-21 13:22:38 +00:00
b34727c632 Fix the variable regexp pattern on web page () ()
Backport  by @lng2020

same as (https://github.com/go-gitea/gitea/pull/26910)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
2023-09-21 12:09:44 +00:00
0ca233258d Fix organization field being null in POST /orgs/{orgid}/teams () ()
Backport  by @memphis88

Similarly to the fix in https://github.com/go-gitea/gitea/pull/24694,
this addresses the team creation not returning the organization
information in the response.

This fix is connected to the
[issue](https://gitea.com/gitea/terraform-provider-gitea/issues/27)
discovered in the terraform provider.
Moreover, the
[documentation](https://docs.gitea.com/api/1.20/#tag/organization/operation/orgCreateTeam)
suggests that the response body should include the `organization` field
(currently being `null`).

Co-authored-by: Dionysios Kakouris <1369451+memphis88@users.noreply.github.com>
2023-09-21 12:15:20 +02:00
c3b7120042 Add index to issue_user.issue_id () ()
Backport  by @JakobDev

This fixes a performance bottleneck. It was discovered by Codeberg.
Every where query on that table (which has grown big over time) uses
this column, but there is no index on it.

See this part of the log which was posted on Matrix:
```
2023/09/10 00:52:01 ...rs/web/repo/issue.go:1446:ViewIssue() [W] [Slow SQL Query] UPDATE `issue_user` SET is_read=? WHERE uid=? AND issue_id=? [true x y] - 51.395434887s
2023/09/10 00:52:01 ...rs/web/repo/issue.go:1447:ViewIssue() [E] ReadBy: Error 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
2023/09/10 00:52:01 ...eb/routing/logger.go:102:func1() [I] router: completed GET /Codeberg/Community/issues/1201 for [::ffff:xxx]:0, 500 Internal Server Error in 52384.2ms @ repo/issue.go:1256(repo.ViewIssue)
```

Co-authored-by: JakobDev <jakobdev@gmx.de>
2023-09-21 11:42:34 +08:00
2802 changed files with 65717 additions and 88655 deletions
.air.toml
.devcontainer
.dockerignore.envrc.eslintrc.yaml.gitattributes
.gitea
.github
.gitignore.gitpod.yml.golangci.yml.ignore.markdownlint.yaml.stylelintrc.yamlCHANGELOG-archived.mdCHANGELOG.mdCONTRIBUTING.mdDockerfileDockerfile.rootlessMAINTAINERSMakefileREADME.mdREADME_ZH.mdSECURITY.md
assets
build
cmd
contrib
crowdin.yml
custom/conf
docs
README.mdREADME_ZH.md
content
administration
contributing
development
help
index.en-us.md
installation
usage
scripts
static/images/usage
flake.lockflake.nixgo.modgo.summain.go
models
actions
activities
admin
asymkey
auth
avatars
db
dbfs
error.gofixture_generation.gofixture_test.go
fixtures
git
issues
main_test.go
migrations
org.goorg_team.goorg_team_test.goorg_test.go
organization
packages
perm
project
pull
repo.go
repo
repo_test.gorepo_transfer.gorepo_transfer_test.go
secret
shared/types
system
unit
unittest
user
webhook
modules
actions
activitypub
auth/password
avatar
badge
base
cache
charset
container
context
contexttest
csv
doctor
dump
eventsource
git
attribute.gobatch.gobatch_reader.goblame.goblame_sha256_test.goblame_test.goblob_gogit.goblob_nogogit.gocommand.gocommit.gocommit_convert_gogit.gocommit_info_gogit.gocommit_info_nogogit.gocommit_reader.gocommit_sha256_test.gocommit_test.godiff.goerror.gogit.gogrep.gogrep_test.golast_commit_cache.golast_commit_cache_gogit.golog_name_status.gonotes_gogit.goobject_format.goobject_id.goobject_id_gogit.goobject_id_test.goparse_gogit.goparse_gogit_test.goparse_nogogit.goparse_nogogit_test.go
pipeline
ref.goremote.gorepo.gorepo_attribute.gorepo_attribute_test.gorepo_base.gorepo_base_gogit.gorepo_base_nogogit.gorepo_blob_gogit.gorepo_blob_nogogit.gorepo_blob_test.gorepo_branch.gorepo_branch_gogit.gorepo_branch_nogogit.gorepo_branch_test.gorepo_commit.gorepo_commit_gogit.gorepo_commit_nogogit.gorepo_commit_test.gorepo_commitgraph.gorepo_compare.gorepo_compare_test.gorepo_gpg.gorepo_index.gorepo_language_stats.gorepo_language_stats_gogit.gorepo_language_stats_nogogit.gorepo_object.gorepo_ref_gogit.gorepo_stats.gorepo_tag.gorepo_tag_gogit.gorepo_tag_nogogit.gorepo_tag_test.gorepo_tree.gorepo_tree_gogit.gorepo_tree_nogogit.gosha1.gosha1_gogit.gosha1_nogogit.gosha1_test.gosignature.gosubmodule.gotag.gotag_test.go
tests/repos
repo1_bare_sha256
repo5_pulls_sha256
repo6_blame_sha256
repo6_merge_sha256
tree.gotree_blob_gogit.gotree_entry_gogit.gotree_entry_nogogit.gotree_gogit.gotree_nogogit.goutils.goutils_test.go
gitrepo
graceful
hostmatcher
httpcache
httplib
indexer
issue/template
lfs
log
markup
migration
optional
packages
private
process
queue
references
repository
secret
session
setting
storage
structs
svg
system
templates
test
timeutil
translation
updatechecker
upload
util
web
options
label
license
locale
package-lock.jsonpackage.jsonplaywright.config.jspoetry.lock
public/assets/img
favicon.svglogo.svg
svg
fontawesome-save.svgfontawesome-windows.svggitea-alpine.svggitea-azuread.svggitea-azureadv2.svggitea-bitbucket.svggitea-cargo.svggitea-chef.svggitea-codebase.svggitea-composer.svggitea-conan.svggitea-conda.svggitea-cran.svggitea-debian.svggitea-discord.svggitea-empty-checkbox.svggitea-exclamation.svggitea-facebook.svggitea-git.svggitea-gitbucket.svggitea-gitea.svggitea-gitlab.svggitea-go.svggitea-gogs.svggitea-google.svggitea-helm.svggitea-jetbrains.svggitea-join.svggitea-lock-cog.svggitea-lock.svggitea-mastodon.svggitea-matrix.svggitea-maven.svggitea-microsoftonline.svggitea-nextcloud.svggitea-npm.svggitea-onedev.svggitea-openid.svggitea-pub.svggitea-python.svggitea-rubygems.svggitea-split.svggitea-swift.svggitea-twitter.svggitea-unlock.svggitea-vscode.svggitea-vscodium.svggitea-whitespace.svggitea-yandex.svgmaterial-invert-colors.svgmaterial-palette.svgocticon-accessibility-inset.svgocticon-accessibility.svgocticon-alert-fill.svgocticon-alert.svgocticon-archive.svgocticon-arrow-both.svgocticon-arrow-down-left.svgocticon-arrow-down.svgocticon-arrow-left.svgocticon-arrow-right.svgocticon-arrow-switch.svgocticon-arrow-up-right.svgocticon-arrow-up.svgocticon-beaker.svgocticon-bell-fill.svgocticon-bell-slash.svgocticon-bell.svgocticon-blocked.svgocticon-bold.svgocticon-book.svgocticon-bookmark-slash.svgocticon-briefcase.svgocticon-broadcast.svgocticon-bug.svgocticon-cache.svgocticon-calendar.svgocticon-check-circle-fill.svgocticon-check-circle.svgocticon-check.svgocticon-checkbox.svgocticon-checklist.svgocticon-chevron-down.svgocticon-chevron-left.svgocticon-chevron-right.svgocticon-chevron-up.svgocticon-circle-slash.svgocticon-circle.svgocticon-clock-fill.svgocticon-clock.svgocticon-cloud-offline.svgocticon-cloud.svgocticon-code-of-conduct.svgocticon-code-review.svgocticon-code-square.svgocticon-code.svgocticon-codescan-checkmark.svgocticon-codescan.svgocticon-codespaces.svgocticon-columns.svgocticon-command-palette.svgocticon-comment-discussion.svgocticon-comment.svgocticon-container.svgocticon-copilot-error.svgocticon-copilot-warning.svgocticon-copilot.svgocticon-cpu.svgocticon-credit-card.svgocticon-cross-reference.svgocticon-dash.svgocticon-database.svgocticon-dependabot.svgocticon-desktop-download.svgocticon-device-camera-video.svgocticon-device-camera.svgocticon-device-desktop.svgocticon-device-mobile.svgocticon-devices.svgocticon-diamond.svgocticon-diff-added.svgocticon-diff-ignored.svgocticon-diff-modified.svgocticon-diff-removed.svgocticon-diff-renamed.svgocticon-diff.svgocticon-discussion-closed.svgocticon-discussion-duplicate.svgocticon-discussion-outdated.svgocticon-dot-fill.svgocticon-dot.svgocticon-download.svgocticon-duplicate.svgocticon-ellipsis.svgocticon-eye-closed.svgocticon-eye.svgocticon-feed-discussion.svgocticon-feed-forked.svgocticon-feed-heart.svgocticon-feed-issue-closed.svgocticon-feed-issue-draft.svgocticon-feed-issue-open.svgocticon-feed-issue-reopen.svgocticon-feed-merged.svgocticon-feed-person.svgocticon-feed-plus.svgocticon-feed-public.svgocticon-feed-pull-request-closed.svgocticon-feed-pull-request-draft.svgocticon-feed-pull-request-open.svgocticon-feed-repo.svgocticon-feed-rocket.svgocticon-feed-star.svgocticon-feed-tag.svgocticon-feed-trophy.svgocticon-file-added.svgocticon-file-badge.svgocticon-file-binary.svgocticon-file-code.svgocticon-file-diff.svgocticon-file-directory-fill.svgocticon-file-directory-open-fill.svgocticon-file-directory-symlink.svgocticon-file-moved.svgocticon-file-submodule.svgocticon-file-symlink-file.svgocticon-file-zip.svgocticon-file.svgocticon-filter-remove.svgocticon-filter.svgocticon-fiscal-host.svgocticon-flame.svgocticon-fold-down.svgocticon-fold-up.svgocticon-fold.svgocticon-gear.svgocticon-gift.svgocticon-git-branch.svgocticon-git-commit.svgocticon-git-compare.svgocticon-git-merge-queue.svgocticon-git-merge.svgocticon-git-pull-request-closed.svgocticon-git-pull-request-draft.svgocticon-git-pull-request.svgocticon-globe.svgocticon-goal.svgocticon-grabber.svgocticon-graph.svgocticon-hash.svgocticon-heading.svgocticon-heart-fill.svgocticon-heart.svgocticon-history.svgocticon-home.svgocticon-horizontal-rule.svgocticon-hourglass.svgocticon-hubot.svgocticon-id-badge.svgocticon-image.svgocticon-inbox.svgocticon-infinity.svgocticon-info.svgocticon-issue-closed.svgocticon-issue-draft.svgocticon-issue-opened.svgocticon-issue-reopened.svgocticon-issue-tracked-by.svgocticon-issue-tracks.svgocticon-italic.svgocticon-iterations.svgocticon-kebab-horizontal.svgocticon-key-asterisk.svgocticon-key.svgocticon-law.svgocticon-light-bulb.svgocticon-link-external.svgocticon-link.svgocticon-list-ordered.svgocticon-list-unordered.svgocticon-location.svgocticon-lock.svgocticon-log.svgocticon-logo-gist.svgocticon-logo-github.svgocticon-mail.svgocticon-mark-github.svgocticon-megaphone.svgocticon-mention.svgocticon-meter.svgocticon-milestone.svgocticon-mirror.svgocticon-moon.svgocticon-mortar-board.svgocticon-move-to-bottom.svgocticon-move-to-end.svgocticon-move-to-start.svgocticon-move-to-top.svgocticon-multi-select.svgocticon-mute.svgocticon-no-entry.svgocticon-north-star.svgocticon-note.svgocticon-number.svgocticon-organization.svgocticon-package-dependencies.svgocticon-package-dependents.svgocticon-package.svgocticon-paintbrush.svgocticon-paperclip.svgocticon-passkey-fill.svgocticon-paste.svgocticon-pencil.svgocticon-people.svgocticon-person-add.svgocticon-person-fill.svgocticon-person.svgocticon-pin-slash.svgocticon-pin.svgocticon-pivot-column.svgocticon-play.svgocticon-plug.svgocticon-plus-circle.svgocticon-plus.svgocticon-project-roadmap.svgocticon-project-symlink.svgocticon-project-template.svgocticon-project.svgocticon-pulse.svgocticon-question.svgocticon-quote.svgocticon-read.svgocticon-redo.svgocticon-rel-file-path.svgocticon-reply.svgocticon-repo-clone.svgocticon-repo-deleted.svgocticon-repo-forked.svgocticon-repo-locked.svgocticon-repo-pull.svgocticon-repo-push.svgocticon-repo-template.svgocticon-repo.svgocticon-report.svgocticon-rocket.svgocticon-rows.svgocticon-rss.svgocticon-ruby.svgocticon-screen-full.svgocticon-screen-normal.svgocticon-search.svgocticon-server.svgocticon-share-android.svgocticon-shield-check.svgocticon-shield-lock.svgocticon-shield-slash.svgocticon-shield-x.svgocticon-shield.svgocticon-sidebar-collapse.svgocticon-sidebar-expand.svgocticon-sign-in.svgocticon-sign-out.svgocticon-skip-fill.svgocticon-skip.svgocticon-sliders.svgocticon-smiley.svgocticon-sort-asc.svgocticon-sort-desc.svgocticon-sparkle-fill.svgocticon-sponsor-tiers.svgocticon-square-fill.svgocticon-squirrel.svgocticon-stack.svgocticon-star-fill.svgocticon-star.svgocticon-stop.svgocticon-stopwatch.svgocticon-strikethrough.svgocticon-sun.svgocticon-sync.svgocticon-tab-external.svgocticon-tag.svgocticon-tasklist.svgocticon-telescope-fill.svgocticon-telescope.svgocticon-terminal.svgocticon-three-bars.svgocticon-thumbsdown.svgocticon-thumbsup.svgocticon-tools.svgocticon-tracked-by-closed-completed.svgocticon-tracked-by-closed-not-planned.svgocticon-trash.svgocticon-triangle-down.svgocticon-triangle-left.svgocticon-triangle-right.svgocticon-triangle-up.svgocticon-trophy.svgocticon-typography.svgocticon-undo.svgocticon-unfold.svgocticon-unlink.svgocticon-unlock.svgocticon-unmute.svgocticon-unread.svgocticon-unverified.svgocticon-upload.svgocticon-verified.svgocticon-versions.svgocticon-video.svgocticon-webhook.svgocticon-x-circle-fill.svgocticon-x-circle.svgocticon-x.svgocticon-zap.svgocticon-zoom-in.svgocticon-zoom-out.svg
pyproject.toml
routers
api
actions
packages
v1
common
init.go
install
private
utils
web
admin
auth
base.go
devtest
events
explore
feed
githttp.gogoget.go
healthcheck
home.go
misc
nodeinfo.go
org
passkey.go
repo
shared
swagger_json.go
user
web.gowebfinger.go
services
actions
agit
asymkey
attachment
auth
automerge
context
convert
cron
doctor
externalaccount
feed
forms
gitdiff
indexer
issue
lfs
mailer
markup
migrations
mirror
notify
org
packages
pull
release
repository
secrets
task
user
webhook
webtheme
wiki
snap
stylelint.config.jstailwind.config.js
templates
admin
api/packages/pypi
base
code
devtest
explore
home.tmplinstall.tmpl
mail
org
package
projects
repo
actions
activity.tmplblame.tmpl
branch
branch_dropdown.tmpl
cite
clone_buttons.tmplclone_script.tmpl
code
code_frequency.tmplcommit_load_branches_and_tags.tmplcommit_page.tmplcommit_statuses.tmplcommits.tmplcommits_list.tmplcommits_list_small.tmplcommits_search_dropdown.tmplcommits_table.tmplcontributors.tmplcreate.tmplcreate_helper.tmpl
diff
editor
empty.tmplfile_info.tmpl
find
forks.tmplgraph.tmpl
graph
header.tmplhome.tmplicon.tmpl
issue
latest_commit.tmpl
migrate
navbar.tmpl
projects
pulls
pulse.tmplrecent_commits.tmpl
release
release_tag_header.tmplsearch.tmpl
settings
star_unstar.tmplsub_menu.tmpl
tag
unicode_escape_prompt.tmpluser_cards.tmplview_file.tmplview_list.tmplwatch_unwatch.tmpl
wiki
shared
status
swagger
user
webhook
tests
e2e
gitea-repositories-meta
integration
README.mdREADME_ZH.mdactions_trigger_test.goapi_actions_artifact_test.goapi_actions_artifact_v4_test.goapi_activitypub_person_test.goapi_admin_org_test.goapi_admin_test.goapi_branch_test.goapi_comment_attachment_test.goapi_comment_test.goapi_fork_test.goapi_gpg_keys_test.goapi_helper_for_declarative_test.goapi_httpsig_test.goapi_issue_attachment_test.goapi_issue_config_test.goapi_issue_label_test.goapi_issue_milestone_test.goapi_issue_pin_test.goapi_issue_reaction_test.goapi_issue_stopwatch_test.goapi_issue_subscription_test.goapi_issue_test.goapi_issue_tracked_time_test.goapi_keys_test.goapi_nodeinfo_test.goapi_notification_test.goapi_oauth2_apps_test.goapi_org_avatar_test.goapi_org_test.goapi_packages_alpine_test.goapi_packages_cargo_test.goapi_packages_chef_test.goapi_packages_composer_test.goapi_packages_conan_test.goapi_packages_conda_test.goapi_packages_container_test.goapi_packages_cran_test.goapi_packages_debian_test.goapi_packages_generic_test.goapi_packages_goproxy_test.goapi_packages_helm_test.goapi_packages_maven_test.goapi_packages_npm_test.goapi_packages_nuget_test.goapi_packages_pub_test.goapi_packages_pypi_test.goapi_packages_rpm_test.goapi_packages_rubygems_test.goapi_packages_swift_test.goapi_packages_test.goapi_packages_vagrant_test.goapi_private_serv_test.goapi_pull_review_test.goapi_pull_test.goapi_releases_test.goapi_repo_archive_test.goapi_repo_avatar_test.goapi_repo_branch_test.goapi_repo_collaborator_test.goapi_repo_compare_test.goapi_repo_edit_test.goapi_repo_file_create_test.goapi_repo_file_delete_test.goapi_repo_file_update_test.goapi_repo_files_change_test.goapi_repo_get_contents_list_test.goapi_repo_get_contents_test.goapi_repo_git_blobs_test.goapi_repo_git_commits_test.goapi_repo_git_hook_test.goapi_repo_git_notes_test.goapi_repo_git_ref_test.goapi_repo_git_tags_test.goapi_repo_git_trees_test.goapi_repo_hook_test.goapi_repo_lfs_locks_test.goapi_repo_lfs_migrate_test.goapi_repo_lfs_test.goapi_repo_raw_test.goapi_repo_secrets_test.goapi_repo_tags_test.goapi_repo_teams_test.goapi_repo_test.goapi_repo_topic_test.goapi_repo_variables_test.goapi_team_test.goapi_team_user_test.goapi_token_test.goapi_twofa_test.goapi_user_avatar_test.goapi_user_block_test.goapi_user_email_test.goapi_user_follow_test.goapi_user_heatmap_test.goapi_user_info_test.goapi_user_org_perm_test.goapi_user_orgs_test.goapi_user_search_test.goapi_user_secrets_test.goapi_user_star_test.goapi_user_update_test.goapi_user_variables_test.goapi_user_watch_test.goapi_wiki_test.goattachment_test.goauth_ldap_test.gobranches_test.gocompare_test.gocors_test.gocsrf_test.godb_collation_test.goeditor_test.goempty_repo_test.goeventsource_test.goexplore_repos_test.goexplore_user_test.gogit_clone_wiki_test.gogit_helper_for_declarative_test.gogit_push_test.gogit_test.gogpg_git_test.goincoming_email_test.gointegration_test.goissue_test.golfs_getobject_test.golfs_view_test.golinguist_test.golinks_test.gomarkup_external_test.gomirror_pull_test.gomirror_push_test.goorg_count_test.goorg_project_test.goorg_test.goprivateactivity_test.goproject_test.gopull_commit_test.gopull_compare_test.gopull_create_test.gopull_merge_test.gopull_review_test.gopull_status_test.gopull_update_test.gorelease_test.gorename_branch_test.gorepo_activity_test.gorepo_archive_test.gorepo_branch_test.gorepo_commits_search_test.gorepo_fork_test.gorepo_mergecommit_revert_test.gorepo_search_test.gorepo_tag_test.gorepo_test.gorepo_topic_test.gorepo_webhook_test.gorepofiles_change_test.gosession_test.gosignin_test.gosignup_test.gouser_test.goxss_test.go
mssql.ini.tmplmysql.ini.tmplmysql8.ini.tmplpgsql.ini.tmplsqlite.ini.tmpltest_utils.go
tools
updates.config.jsvitest.config.js
web_src
css
fomantic
js
bootstrap.js
components
features
htmx.jsindex.jsjquery.js
markup
modules
standalone
svg.js
test
utils.js
utils
webcomponents
svg
webpack.config.js

@ -2,25 +2,12 @@ root = "."
tmp_dir = ".air"
[build]
pre_cmd = ["killall -9 gitea 2>/dev/null || true"] # kill off potential zombie processes from previous runs
cmd = "make --no-print-directory backend"
bin = "gitea"
delay = 2000
delay = 1000
include_ext = ["go", "tmpl"]
include_file = ["main.go"]
include_dir = ["cmd", "models", "modules", "options", "routers", "services"]
exclude_dir = [
"models/fixtures",
"models/migrations/fixtures",
"modules/avatar/identicon/testdata",
"modules/avatar/testdata",
"modules/git/tests",
"modules/migration/file_format_testdata",
"routers/private/tests",
"services/gitdiff/testdata",
]
exclude_dir = ["modules/git/tests", "services/gitdiff/testdata", "modules/avatar/testdata", "models/fixtures", "models/migrations/fixtures", "modules/migration/file_format_testdata", "modules/avatar/identicon/testdata"]
exclude_regex = ["_test.go$", "_gen.go$"]
stop_on_error = true
[log]
main_only = true

@ -1,16 +1,14 @@
{
"name": "Gitea DevContainer",
"image": "mcr.microsoft.com/devcontainers/go:1.22-bullseye",
"image": "mcr.microsoft.com/devcontainers/go:1.21-bullseye",
"features": {
// installs nodejs into container
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
"version":"20"
},
"ghcr.io/devcontainers/features/git-lfs:1.1.0": {},
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12"
}
"ghcr.io/devcontainers/features/python:1": {}
},
"customizations": {
"vscode": {
@ -24,7 +22,7 @@
"DavidAnson.vscode-markdownlint",
"Vue.volar",
"ms-azuretools.vscode-docker",
"vitest.explorer",
"zixuanchen.vitest-explorer",
"qwtel.sqlite-viewer",
"GitHub.vscode-pull-request-github"
]

@ -14,7 +14,7 @@ _test
# MS VSCode
.vscode
__debug_bin*
__debug_bin
# Architecture specific extensions/prefixes
*.[568vq]
@ -62,6 +62,7 @@ cpu.out
/data
/indexers
/log
/public/img/avatar
/tests/integration/gitea-integration-*
/tests/integration/indexers-*
/tests/e2e/gitea-e2e-*
@ -77,7 +78,7 @@ cpu.out
/public/assets/js
/public/assets/css
/public/assets/fonts
/public/assets/img/avatar
/public/assets/img/webpack
/vendor
/web_src/fomantic/node_modules
/web_src/fomantic/build/*
@ -95,9 +96,6 @@ cpu.out
/.air
/.go-licenses
# Files and folders that were previously generated
/public/assets/img/webpack
# Snapcraft
snap/.snapcraft/
parts/

1
.envrc

@ -1 +0,0 @@
use flake

File diff suppressed because it is too large Load Diff

1
.gitattributes vendored

@ -1,6 +1,5 @@
* text=auto eol=lf
*.tmpl linguist-language=Handlebars
*.pb.go linguist-generated
/assets/*.json linguist-generated
/public/assets/img/svg/*.svg linguist-generated
/templates/swagger/v1_json.tmpl linguist-generated

@ -3,7 +3,7 @@
<!--
1. Please speak English, this is the language all maintainers can speak and write.
2. Please ask questions or configuration/deploy problems on our Discord
server (https://discord.gg/gitea) or forum (https://forum.gitea.com).
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
3. Please take a moment to check that your issue doesn't already exist.
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
5. Please give all relevant information below for bug reports, because
@ -21,7 +21,7 @@
- [ ] MySQL
- [ ] MSSQL
- [ ] SQLite
- Can you reproduce the bug at https://demo.gitea.com:
- Can you reproduce the bug at https://try.gitea.io:
- [ ] Yes (provide example URL)
- [ ] No
- Log gist:

1
.github/FUNDING.yml vendored

@ -1 +1,2 @@
open_collective: gitea
custom: https://www.bountysource.com/teams/gitea

@ -1,6 +1,6 @@
name: Bug Report
description: Found something you weren't expecting? Report it here!
labels: ["type/bug"]
labels: ["kind/bug"]
body:
- type: markdown
attributes:
@ -11,7 +11,7 @@ body:
value: |
1. Please speak English, this is the language all maintainers can speak and write.
2. Please ask questions or configuration/deploy problems on our Discord
server (https://discord.gg/gitea) or forum (https://forum.gitea.com).
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
3. Make sure you are using the latest release and
take a moment to check that your issue hasn't been reported before.
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
@ -37,7 +37,7 @@ body:
label: Can you reproduce the bug on the Gitea demo site?
description: |
If so, please provide a URL in the Description field
URL of Gitea demo: https://demo.gitea.com
URL of Gitea demo: https://try.gitea.io
options:
- "Yes"
- "No"
@ -74,7 +74,7 @@ body:
attributes:
label: How are you running Gitea?
description: |
Please include information on whether you built Gitea yourself, used one of our downloads, are using https://demo.gitea.com or are using some other package
Please include information on whether you built Gitea yourself, used one of our downloads, are using https://try.gitea.io or are using some other package
Please also tell us how you are running Gitea, e.g. if it is being run from docker, a command-line, systemd etc.
If you are using a package or systemd tell us what distribution you are using
validations:

@ -7,7 +7,7 @@ contact_links:
url: https://discord.gg/Gitea
about: Please ask questions and discuss configuration or deployment problems here.
- name: Discourse Forum
url: https://forum.gitea.com
url: https://discourse.gitea.io
about: Questions and configuration or deployment problems can also be discussed on our forum.
- name: Frequently Asked Questions
url: https://docs.gitea.com/help/faq

@ -1,13 +1,13 @@
name: Feature Request
description: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here!
labels: ["type/proposal"]
labels: ["kind/proposal"]
body:
- type: markdown
attributes:
value: |
1. Please speak English, this is the language all maintainers can speak and write.
2. Please ask questions or configuration/deploy problems on our Discord
server (https://discord.gg/gitea) or forum (https://forum.gitea.com).
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
3. Please take a moment to check that your feature hasn't already been suggested.
- type: textarea
id: description

@ -1,6 +1,6 @@
name: Web Interface Bug Report
description: Something doesn't look quite as it should? Report it here!
labels: ["type/bug", "topic/ui"]
labels: ["kind/bug", "kind/ui"]
body:
- type: markdown
attributes:
@ -11,7 +11,7 @@ body:
value: |
1. Please speak English, this is the language all maintainers can speak and write.
2. Please ask questions or configuration/deploy problems on our Discord
server (https://discord.gg/gitea) or forum (https://forum.gitea.com).
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
3. Please take a moment to check that your issue doesn't already exist.
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
5. Please give all relevant information below for bug reports, because
@ -46,7 +46,7 @@ body:
label: Can you reproduce the bug on the Gitea demo site?
description: |
If so, please provide a URL in the Description field
URL of Gitea demo: https://demo.gitea.com
URL of Gitea demo: https://try.gitea.io
options:
- "Yes"
- "No"

13
.github/labeler.yml vendored

@ -4,6 +4,13 @@ modifies/docs:
- "**/*.md"
- "docs/**"
modifies/frontend:
- changed-files:
- any-glob-to-any-file:
- "web_src/**"
- "tailwind.config.js"
- "webpack.config.js"
modifies/templates:
- changed-files:
- all-globs-to-any-file:
@ -46,7 +53,7 @@ modifies/internal:
- ".gitpod.yml"
- ".markdownlint.yaml"
- ".spectral.yaml"
- "stylelint.config.js"
- ".stylelintrc.yaml"
- ".yamllint.yaml"
- ".github/**"
- ".gitea/"
@ -60,10 +67,11 @@ modifies/dependencies:
- any-glob-to-any-file:
- "package.json"
- "package-lock.json"
- "pyproject.toml"
- "poetry.toml"
- "poetry.lock"
- "go.mod"
- "go.sum"
- "pyproject.toml"
modifies/go:
- changed-files:
@ -74,4 +82,3 @@ modifies/js:
- changed-files:
- any-glob-to-any-file:
- "**/*.js"
- "**/*.vue"

54
.github/stale.yml vendored Normal file

@ -0,0 +1,54 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 14
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- status/blocked
- kind/security
- lgtm/done
- reviewed/confirmed
- priority/critical
- kind/proposal
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Label to use when marking as stale
staleLabel: stale
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had recent activity.
I am here to help clear issues left open even if solved or waiting for more insight.
This issue will be closed if no further activity occurs during the next 2 weeks.
If the issue is still valid just add a comment to keep it alive.
Thank you for your contributions.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been automatically closed because of inactivity.
You can re-open it if needed.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 1
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
pulls:
daysUntilStale: 60
daysUntilClose: 60
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you
for your contributions.
closeComment: >
This pull request has been automatically closed because of inactivity.
You can re-open it if needed.

@ -11,14 +11,14 @@ jobs:
if: github.repository == 'go-gitea/gitea'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- run: make generate-license generate-gitignore
timeout-minutes: 40
- name: push translations to repo
uses: appleboy/git-push-action@v0.0.3
uses: appleboy/git-push-action@v0.0.2
with:
author_email: "teabot@gitea.io"
author_name: GiteaBot

22
.github/workflows/cron-lock.yml vendored Normal file

@ -0,0 +1,22 @@
name: cron-lock
on:
schedule:
- cron: "0 0 * * *" # every day at 00:00 UTC
workflow_dispatch:
permissions:
issues: write
pull-requests: write
concurrency:
group: lock
jobs:
action:
runs-on: ubuntu-latest
if: github.repository == 'go-gitea/gitea'
steps:
- uses: dessant/lock-threads@v4
with:
issue-inactive-days: 45

@ -11,23 +11,18 @@ jobs:
if: github.repository == 'go-gitea/gitea'
steps:
- uses: actions/checkout@v4
- uses: crowdin/github-action@v1
with:
upload_sources: true
upload_translations: false
download_sources: false
download_translations: true
push_translations: false
push_sources: false
create_pull_request: false
config: crowdin.yml
- name: download from crowdin
uses: docker://jonasfranz/crowdin
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }}
PLUGIN_DOWNLOAD: true
PLUGIN_EXPORT_DIR: options/locale/
PLUGIN_IGNORE_BRANCH: true
PLUGIN_PROJECT_IDENTIFIER: gitea
- name: update locales
run: ./build/update-locales.sh
- name: push translations to repo
uses: appleboy/git-push-action@v0.0.3
uses: appleboy/git-push-action@v0.0.2
with:
author_email: "teabot@gitea.io"
author_name: GiteaBot
@ -36,3 +31,19 @@ jobs:
commit_message: "[skip ci] Updated translations via Crowdin"
remote: "git@github.com:go-gitea/gitea.git"
ssh_key: ${{ secrets.DEPLOY_KEY }}
crowdin-push:
runs-on: ubuntu-latest
if: github.repository == 'go-gitea/gitea'
steps:
- uses: actions/checkout@v4
- name: push translations to crowdin
uses: docker://jonasfranz/crowdin
env:
CROWDIN_KEY: ${{ secrets.CROWDIN_KEY }}
PLUGIN_UPLOAD: true
PLUGIN_EXPORT_DIR: options/locale/
PLUGIN_IGNORE_BRANCH: true
PLUGIN_PROJECT_IDENTIFIER: gitea
PLUGIN_FILES: |
locale_en-US.ini: options/locale/locale_en-US.ini
PLUGIN_BRANCH: main

@ -7,7 +7,18 @@ jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# FIXME: https://github.com/jlumbroso/free-disk-space/issues/17
- name: same as 'large-packages' but without 'google-cloud-sdk'
shell: bash
run: |
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
sudo apt-get autoremove -y
sudo apt-get clean
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:

@ -35,7 +35,7 @@ jobs:
yaml: ${{ steps.changes.outputs.yaml }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
@ -48,7 +48,6 @@ jobs:
- "Makefile"
- ".golangci.yml"
- ".editorconfig"
- "options/locale/locale_en-US.ini"
frontend:
- "**/*.js"
@ -58,7 +57,7 @@ jobs:
- "package-lock.json"
- "Makefile"
- ".eslintrc.yaml"
- "stylelint.config.js"
- ".stylelintrc.yaml"
- ".npmrc"
docs:
@ -73,7 +72,6 @@ jobs:
- "Makefile"
templates:
- "tools/lint-templates-*.js"
- "templates/**/*.tmpl"
- "pyproject.toml"
- "poetry.lock"

@ -17,9 +17,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make lint-backend
@ -32,17 +32,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
python-version: "3.11"
- run: pip install poetry
- run: make deps-py
- run: make deps-frontend
- run: make lint-templates
lint-yaml:
@ -51,9 +45,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-python@v4
with:
python-version: "3.12"
python-version: "3.11"
- run: pip install poetry
- run: make deps-py
- run: make lint-yaml
@ -64,11 +58,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- run: make deps-frontend
- run: make lint-swagger
@ -90,9 +82,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make lint-go-windows lint-go-vet
@ -107,9 +99,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make lint-go
@ -122,9 +114,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs
@ -135,11 +127,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- run: make deps-frontend
- run: make lint-frontend
- run: make checks-frontend
@ -152,9 +142,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
# no frontend build here as backend should be able to build
# even without any frontend files
@ -184,11 +174,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- run: make deps-frontend
- run: make lint-md
- run: make docs
@ -199,8 +187,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- uses: actions/setup-go@v4
- run: make lint-actions

@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
services:
pgsql:
image: postgres:12
image: postgres:15
env:
POSTGRES_DB: test
POSTGRES_PASSWORD: postgres
@ -31,17 +31,17 @@ jobs:
minio:
# as github actions doesn't support "entrypoint", we need to use a non-official image
# that has a custom entrypoint set to "minio server /data"
image: bitnami/minio:2023.8.31
image: bitnami/minio:2021.3.17
env:
MINIO_ROOT_USER: 123456
MINIO_ROOT_PASSWORD: 12345678
MINIO_ACCESS_KEY: 123456
MINIO_SECRET_KEY: 12345678
ports:
- "9000:9000"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
@ -67,9 +67,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- run: make deps-backend
- run: make backend
@ -91,6 +91,13 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: test
ports:
- "3306:3306"
elasticsearch:
image: elasticsearch:7.5.0
env:
@ -103,6 +110,13 @@ jobs:
MEILI_ENV: development # disable auth
ports:
- "7700:7700"
smtpimap:
image: tabascoterrier/docker-imap-devel:latest
ports:
- "25:25"
- "143:143"
- "587:587"
- "993:993"
redis:
image: redis
options: >- # wait until redis has started
@ -121,9 +135,9 @@ jobs:
- "9000:9000"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
@ -144,16 +158,16 @@ jobs:
RACE_ENABLED: true
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
test-mysql:
test-mysql5:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: testgitea
MYSQL_DATABASE: test
ports:
- "3306:3306"
elasticsearch:
@ -171,9 +185,9 @@ jobs:
- "993:993"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
@ -191,15 +205,43 @@ jobs:
USE_REPO_TEST_DIR: 1
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
test-mysql8:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
runs-on: ubuntu-latest
services:
mysql8:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: testgitea
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts'
- run: make deps-backend
- run: make backend
env:
TAGS: bindata
- run: make test-mysql8-migration test-mysql8
timeout-minutes: 50
env:
TAGS: bindata
USE_REPO_TEST_DIR: 1
test-mssql:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed
# specifying the version of ubuntu in use as mssql fails on newer kernels
# pending resolution from vendor
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
services:
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
image: mcr.microsoft.com/mssql/server:latest
env:
ACCEPT_EULA: Y
MSSQL_PID: Standard
@ -208,9 +250,9 @@ jobs:
- "1433:1433"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'

@ -16,8 +16,8 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
push: false
tags: gitea/gitea:linux-amd64
@ -27,8 +27,8 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
push: false
file: Dockerfile.rootless

@ -17,15 +17,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- run: make deps-frontend frontend deps-backend
- run: npx playwright install --with-deps
- run: make test-e2e-sqlite

@ -2,15 +2,13 @@ name: release-nightly
on:
push:
branches: [main, release/v*]
branches: [ main, release/v* ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
disk-clean:
uses: ./.github/workflows/disk-clean.yml
nightly-binary:
runs-on: nscloud
steps:
@ -18,15 +16,13 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- run: make deps-frontend deps-backend
# xgo build
- run: make release
@ -34,7 +30,7 @@ jobs:
TAGS: bindata sqlite sqlite_unlock_notify
- name: import gpg key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
@ -49,7 +45,7 @@ jobs:
run: |
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
echo "Cleaned name is ${REF_NAME}"
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
- name: configure aws
uses: aws-actions/configure-aws-credentials@v4
with:
@ -66,12 +62,12 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Get cleaned branch name
id: clean_name
run: |
@ -83,14 +79,14 @@ jobs:
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: fetch go modules
run: make vendor
- name: build rootful docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
@ -103,12 +99,12 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Get cleaned branch name
id: clean_name
run: |
@ -120,14 +116,14 @@ jobs:
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: fetch go modules
run: make vendor
- name: build rootless docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64

@ -3,7 +3,7 @@ name: release-tag-rc
on:
push:
tags:
- "v1*-rc*"
- 'v1*-rc*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -17,15 +17,13 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- run: make deps-frontend deps-backend
# xgo build
- run: make release
@ -33,7 +31,7 @@ jobs:
TAGS: bindata sqlite sqlite_unlock_notify
- name: import gpg key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
@ -74,8 +72,8 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v5
id: meta
with:
@ -86,12 +84,12 @@ jobs:
tags: |
type=semver,pattern={{version}}
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build rootful docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
@ -105,8 +103,8 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v5
id: meta
with:
@ -119,12 +117,12 @@ jobs:
tags: |
type=semver,pattern={{version}}
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build rootless docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64

@ -3,9 +3,9 @@ name: release-tag-version
on:
push:
tags:
- "v1.*"
- "!v1*-rc*"
- "!v1*-dev"
- 'v1.*'
- '!v1*-rc*'
- '!v1*-dev'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@ -19,15 +19,13 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v5
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
go-version: "~1.21"
check-latest: true
- uses: actions/setup-node@v4
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: package-lock.json
- run: make deps-frontend deps-backend
# xgo build
- run: make release
@ -35,7 +33,7 @@ jobs:
TAGS: bindata sqlite sqlite_unlock_notify
- name: import gpg key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
@ -76,8 +74,8 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v5
id: meta
with:
@ -92,12 +90,12 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build rootful docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
@ -111,8 +109,8 @@ jobs:
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v5
id: meta
with:
@ -130,12 +128,12 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build rootless docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64

12
.gitignore vendored

@ -11,11 +11,10 @@ _test
.idea
# Goland's output filename can not be set manually
/go_build_*
/gitea_*
# MS VSCode
.vscode
__debug_bin*
__debug_bin
*.cgo1.go
*.cgo2.c
@ -58,7 +57,7 @@ cpu.out
/data
/indexers
/log
/public/assets/img/avatar
/public/img/avatar
/tests/integration/gitea-integration-*
/tests/integration/indexers-*
/tests/e2e/gitea-e2e-*
@ -77,6 +76,7 @@ cpu.out
/public/assets/css
/public/assets/fonts
/public/assets/licenses.txt
/public/assets/img/webpack
/vendor
/web_src/fomantic/node_modules
/web_src/fomantic/build/*
@ -94,9 +94,6 @@ cpu.out
/.air
/.go-licenses
# Files and folders that were previously generated
/public/assets/img/webpack
# Snapcraft
/gitea_a*.txt
snap/.snapcraft/
@ -108,9 +105,6 @@ prime/
*_source.tar.bz2
.DS_Store
# nix-direnv generated files
.direnv/
# Make evidence files
/.make_evidence

@ -10,19 +10,10 @@ tasks:
- name: Run backend
command: |
gp sync-await setup
# Get the URL and extract the domain
url=$(gp url 3000)
domain=$(echo $url | awk -F[/:] '{print $4}')
if [ -f custom/conf/app.ini ]; then
sed -i "s|^ROOT_URL =.*|ROOT_URL = ${url}/|" custom/conf/app.ini
sed -i "s|^DOMAIN =.*|DOMAIN = ${domain}|" custom/conf/app.ini
sed -i "s|^SSH_DOMAIN =.*|SSH_DOMAIN = ${domain}|" custom/conf/app.ini
sed -i "s|^NO_REPLY_ADDRESS =.*|SSH_DOMAIN = noreply.${domain}|" custom/conf/app.ini
else
if [ ! -f custom/conf/app.ini ]
then
mkdir -p custom/conf/
echo -e "[server]\nROOT_URL = ${url}/" > custom/conf/app.ini
echo -e "[server]\nROOT_URL=$(gp url 3000)/" > custom/conf/app.ini
echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = $GITPOD_REPO_ROOT/data/gitea.db" >> custom/conf/app.ini
fi
export TAGS="sqlite sqlite_unlock_notify"
@ -42,7 +33,7 @@ vscode:
- DavidAnson.vscode-markdownlint
- Vue.volar
- ms-azuretools.vscode-docker
- vitest.explorer
- zixuanchen.vitest-explorer
- qwtel.sqlite-viewer
- GitHub.vscode-pull-request-github

@ -1,14 +1,13 @@
linters:
enable-all: false
disable-all: true
fast: false
enable:
- bidichk
# - deadcode # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- depguard
- dupl
- errcheck
- forbidigo
- gocritic
# - gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
- gofmt
- gofumpt
- gosimple
@ -18,17 +17,24 @@ linters:
- nolintlint
- revive
- staticcheck
# - structcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- stylecheck
- typecheck
- unconvert
- unused
# - varcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- wastedassign
enable-all: false
disable-all: true
fast: false
run:
go: "1.21"
timeout: 10m
output:
sort-results: true
skip-dirs:
- node_modules
- public
- web_src
linters-settings:
stylecheck:
@ -46,39 +52,30 @@ linters-settings:
errorCode: 1
warningCode: 1
rules:
- name: atomic
- name: bare-return
- name: blank-imports
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: duplicated-imports
- name: empty-lines
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: error-naming
- name: exported
- name: identical-branches
- name: if-return
- name: increment-decrement
- name: indent-error-flow
- name: modifies-value-receiver
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: superfluous-else
- name: time-naming
- name: unconditional-recursion
- name: unexported-return
- name: unreachable-code
- name: var-declaration
- name: var-naming
- name: indent-error-flow
- name: errorf
- name: duplicated-imports
- name: modifies-value-receiver
gofumpt:
extra-rules: true
lang-version: "1.21"
depguard:
rules:
main:
@ -95,15 +92,12 @@ linters-settings:
desc: do not use the internal package, use AddXxx function instead
- pkg: gopkg.in/ini.v1
desc: do not use the ini package, use gitea's config system instead
- pkg: gitea.com/go-chi/cache
desc: do not use the go-chi cache package, use gitea's cache system
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs: [node_modules, public, web_src]
exclude-case-sensitive: true
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocyclo
@ -121,19 +115,19 @@ issues:
- path: cmd
linters:
- forbidigo
- text: "webhook"
linters:
- linters:
- dupl
- text: "`ID' should not be capitalized"
linters:
text: "webhook"
- linters:
- gocritic
- text: "swagger"
linters:
text: "`ID' should not be capitalized"
- linters:
- unused
- deadcode
- text: "argument x is overwritten before first use"
linters:
text: "swagger"
- linters:
- staticcheck
text: "argument x is overwritten before first use"
- text: "commentFormatting: put a space between `//` and comment text"
linters:
- gocritic

@ -4,8 +4,6 @@
/modules/options/bindata.go
/modules/public/bindata.go
/modules/templates/bindata.go
/options/gitignore
/options/license
/public/assets
/vendor
/public/assets
node_modules

Some files were not shown because too many files have changed in this diff Show More