]> source.dussan.org Git - gitea.git/log
gitea.git
14 months agoFix commit status color on dashboard repolist (#25993) (#25998)
Giteabot [Wed, 19 Jul 2023 23:24:04 +0000 (19:24 -0400)]
Fix commit status color on dashboard repolist (#25993) (#25998)

Backport #25993 by @silverwind

Followup to https://github.com/go-gitea/gitea/pull/25935 which has
missed to change the icon on the repolist because the logic is not
shared with templates.

Co-authored-by: silverwind <me@silverwind.io>
14 months agoavoid hard-coding height in language dropdown menu (#25986) (#25997)
Giteabot [Wed, 19 Jul 2023 23:05:22 +0000 (19:05 -0400)]
avoid hard-coding height in language dropdown menu (#25986) (#25997)

Backport #25986 by @earl-warren

This commit removes the hard-coded height of 500px, using that as a
max-height instead. The height of items in the dropdown menu, assuming a
default font size of 16px, is 36px, so the old CSS would cause overly
large dropdown menus in instances where less than 14 languages are
offered.

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

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: rome-user <rome-user@noreply.codeberg.org>
14 months agoparseScope with owner/repo always sets owner to zero (#25987) (#25989)
Giteabot [Wed, 19 Jul 2023 14:57:17 +0000 (10:57 -0400)]
parseScope with owner/repo always sets owner to zero (#25987) (#25989)

Backport #25987 by @earl-warren

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

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
14 months agoUpdate path related documents (#25417) (#25982)
Giteabot [Wed, 19 Jul 2023 09:48:54 +0000 (05:48 -0400)]
Update path related documents (#25417) (#25982)

Backport #25417 by @wxiaoguang

Update WorkPath/WORK_PATH related documents, remove out-dated
information.

Remove "StaticRootPath" on the admin config display page, because few
end user really need it, it only causes misconfiguration.

![image](https://github.com/go-gitea/gitea/assets/2114189/8095afa4-da76-436b-9e89-2a92c229c01d)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
14 months agoMake pending commit status yellow again (#25935) (#25968)
Giteabot [Wed, 19 Jul 2023 06:43:41 +0000 (02:43 -0400)]
Make pending commit status yellow again (#25935) (#25968)

Backport #25935 by @silverwind

With the introduction of Actions, the pending commit icon has changed
from yellow to grey for Drone integrations which never set the "running"
status, so it stays in "pending" until completion.

I find it better to have this icon colored like on 1.19. Now both the
"pending" and "running" icons look the same, but I guess we could add an
animation to the "running" state similar to GitHub has to it later.

Before:
<img width="339" alt="Screenshot 2023-07-17 at 19 14 19"
src="https://github.com/go-gitea/gitea/assets/115237/2f4886e4-74fd-42ea-b59e-9af8f141bf1f">

After:
<img width="335" alt="Screenshot 2023-07-17 at 19 14 30"
src="https://github.com/go-gitea/gitea/assets/115237/53189642-e72d-47f6-9cbe-f14eda28f730">

Also, it matches GH's icon:

<img width="466" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/5804ff90-d223-4a3c-8093-7a9abbaacf87">

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
14 months agoShow the mismatched ROOT_URL warning on the sign-in page if OAuth2 is enabled (#25947...
Giteabot [Wed, 19 Jul 2023 04:35:16 +0000 (00:35 -0400)]
Show the mismatched ROOT_URL warning on the sign-in page if OAuth2 is enabled (#25947) (#25972)

Backport #25947 by @wolfogre

Since OAuth2 will callback the root URL, if the user starts signing in
from a wrong host, Gitea will return 500 because it cannot find the
session.

<details>
<summary>How to reproduce</summary>

<img width="901" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/2c2e255c-e13e-4a11-9be7-b226bee54920">

<img width="1014" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/b31cfcf6-a320-483d-9ce5-ba8562f065e1">

</details>

So show the mismatched ROOT_URL warning on the sign-in page if OAuth2 is
enabled.

<img width="1015" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/99e80b17-c790-49a3-bbf2-2bd9396a7daa">

Co-authored-by: Jason Song <i@wolfogre.com>
14 months agoFix SSPI auth panic (#25955) (#25969)
Giteabot [Tue, 18 Jul 2023 22:28:06 +0000 (18:28 -0400)]
Fix SSPI auth panic (#25955) (#25969)

Backport #25955 by @wxiaoguang

Try to fix #25952

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
14 months agoAvoid creating directories when loading config (#25944) (#25957)
wxiaoguang [Tue, 18 Jul 2023 20:24:07 +0000 (04:24 +0800)]
Avoid creating directories when loading config (#25944) (#25957)

Backport #25944

The "creating dir/file during load config" is a longstanding and complex
problem.

This PR only does a quick patch, it still needs more refactorings in the
future.

Fix #25938

14 months agoDisallow dangerous URL schemes (#25960) (#25964)
KN4CK3R [Tue, 18 Jul 2023 19:48:52 +0000 (21:48 +0200)]
Disallow dangerous URL schemes (#25960) (#25964)

Regression: https://github.com/go-gitea/gitea/pull/24805
Closes: #25945
- Disallow `javascript`, `vbscript` and `data` (data uri images still
work) url schemes even if all other schemes are allowed
- Fixed older `cbthunderlink` tests

---------

Co-authored-by: delvh <dev.lh@web.de>
15 months agoIgnore `runs-on` with expressions when warning no matched runners (#25917) (#25933)
Giteabot [Tue, 18 Jul 2023 06:40:28 +0000 (02:40 -0400)]
Ignore `runs-on` with expressions when warning no matched runners (#25917) (#25933)

Backport #25917 by @wolfogre

Fix #25905

Co-authored-by: Jason Song <i@wolfogre.com>
15 months agoMake environment-to-ini work with INSTALL_LOCK=true (#25926) (#25937)
Giteabot [Mon, 17 Jul 2023 18:28:54 +0000 (14:28 -0400)]
Make environment-to-ini work with INSTALL_LOCK=true (#25926) (#25937)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
fix #25924

15 months agoAvoid opening/closing PRs which are already merged (#25883) (#25903)
Giteabot [Mon, 17 Jul 2023 12:14:22 +0000 (08:14 -0400)]
Avoid opening/closing PRs which are already merged (#25883) (#25903)

Backport #25883 by @yp05327

We can select PRs to open/close them by one click, but we forgot to
check whether it is merged.
You can get an opening merged PR:

![image](https://github.com/go-gitea/gitea/assets/18380374/22c2e747-4bb9-4742-a9aa-ef39d5308bc5)

You can confirm this in:
https://try.gitea.io/yp05327/testrepo/pulls/5

Co-authored-by: yp05327 <576951401@qq.com>
15 months agoSkip unuseful error message in dev mode when watching local filesystem (#25919) ...
Giteabot [Mon, 17 Jul 2023 10:26:29 +0000 (06:26 -0400)]
Skip unuseful error message in dev mode when watching local filesystem (#25919) (#25927)

Backport #25919 by @wxiaoguang

Before, in dev mode, there might be some error logs like:

```
2023/07/17 13:54:51 ...s/assetfs/layered.go:221:WatchLocalChanges() [E] Unable to watch directory .: lstat /data/work/gitea/custom/templates: no such file or directory

```

Because there is no "custom/templates" directory.

After: ignore such error, no such error message anymore.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoAdd shutting down notice (#25920) (#25922)
Giteabot [Mon, 17 Jul 2023 09:44:10 +0000 (05:44 -0400)]
Add shutting down notice (#25920) (#25922)

Backport #25920 by @KN4CK3R

Got the same problem as #25915 when updating an instance. The
`log.Fatal` should have been marked as breaking in #23911.

This PR adds a notice that the system is shutting down because of the
deprecated setting.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
15 months agoFix incorrect milestone count when provide a keyword (#25880) (#25904)
Giteabot [Mon, 17 Jul 2023 09:12:59 +0000 (05:12 -0400)]
Fix incorrect milestone count when provide a keyword (#25880) (#25904)

Backport #25880 by @yp05327

You can confirm this issue in:
https://try.gitea.io/yp05327/testrepo/milestones?state=open&q=a
There's no milestone, but the count is 1.

![image](https://github.com/go-gitea/gitea/assets/18380374/25e58cee-aeeb-43c1-8ec8-6e2ec6bf1284)

Co-authored-by: yp05327 <576951401@qq.com>
15 months agoAdd 1.20.0 changelog (#25901) (#25910) v1.20.0
delvh [Sun, 16 Jul 2023 19:08:53 +0000 (21:08 +0200)]
Add 1.20.0 changelog (#25901) (#25910)

Backport of #25901

15 months agofix incorrect repo url when changed the case of ownername (#25733) (#25881)
Giteabot [Sat, 15 Jul 2023 17:47:24 +0000 (13:47 -0400)]
fix incorrect repo url when changed the case of ownername (#25733) (#25881)

Backport #25733 by @hiifong

When only the casing of the username changes, update the owner name of the repo,
and keep the original logic consistent with other conditions.

example: assume your username is `gitea`, lowercase username is `gitea` too,
repo URL is `.../gitea/{repo}`.
You change your username to `Gitea`, `GiTea` or something like that,
as long as the lowercase username is still `gitea`, the repo URL remained `.../gitea/{repo}`.

this pr keeps the new username consistent with the repo URL.

Before:

![image](https://github.com/go-gitea/gitea/assets/89133723/84177296-f0ff-4176-84f1-1f9ec3f5b86f)
![image](https://github.com/go-gitea/gitea/assets/89133723/8f8f4a12-ecdd-4dec-af89-85c009b0ccfe)

After:

![image](https://github.com/go-gitea/gitea/assets/89133723/0564edb6-9467-405a-8cd4-d6f70e6f614b)
![image](https://github.com/go-gitea/gitea/assets/89133723/554ecd6e-e5a1-43bc-a46d-99e988c2ff58)

Co-authored-by: hiifong <i@hiif.ong>
15 months agoBackport locales to v1.20 (#25899)
Denys Konovalov [Sat, 15 Jul 2023 15:26:40 +0000 (17:26 +0200)]
Backport locales to v1.20 (#25899)

15 months agoMake `add line comment` buttons focusable (#25894) (#25896)
Giteabot [Sat, 15 Jul 2023 10:18:49 +0000 (06:18 -0400)]
Make `add line comment` buttons focusable (#25894) (#25896)

Backport #25894 by @sebastian-sauer

Use a real button and add an aria-label.
Additionally, show the button whenever it is focused.
See https://codeberg.org/forgejo/forgejo/issues/998 for explanation.

Our handling of this button is now equal to that of GitHub.
Nothing has changed visually.

Co-authored-by: sebastian-sauer <sauer.sebastian@gmail.com>
15 months agoAdd support for different Maven POM encoding (#25873) (#25890)
Giteabot [Fri, 14 Jul 2023 10:27:15 +0000 (06:27 -0400)]
Add support for different Maven POM encoding (#25873) (#25890)

Backport #25873 by @KN4CK3R

Fixes #25853

- Maven POM files aren't always UTF-8 encoded.
- Reject the upload of unparsable POM files

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
15 months agoFix incorrect release count (#25879) (#25887)
Giteabot [Fri, 14 Jul 2023 09:32:43 +0000 (05:32 -0400)]
Fix incorrect release count (#25879) (#25887)

Backport #25879 by @yp05327

Release count is not correct:
https://try.gitea.io/yp05327/testrepo/tags

![image](https://github.com/go-gitea/gitea/assets/18380374/07f97c62-d450-4ccb-b3f2-3e0af9d9fc52)

https://try.gitea.io/yp05327/testrepo/releases

![image](https://github.com/go-gitea/gitea/assets/18380374/6f1d55a4-bb68-445d-84b9-90552a40f403)

https://try.gitea.io/yp05327/testrepo/releases/tag/testtag

![image](https://github.com/go-gitea/gitea/assets/18380374/09ab5d51-52b6-4621-a571-3100198eb260)

We already have correct release count, no need to calculate it again.

https://github.com/go-gitea/gitea/blob/c5e187c389b35b9e080a3187b93a775a3c81e585/modules/context/repo.go#L547

Co-authored-by: yp05327 <576951401@qq.com>
15 months agoFix empty project displayed in issue sidebar (#25802) (#25854)
Giteabot [Wed, 12 Jul 2023 17:07:03 +0000 (13:07 -0400)]
Fix empty project displayed in issue sidebar (#25802) (#25854)

Backport #25802 by @yp05327

You can confirm this issue in
https://try.gitea.io/yp05327/testrepo/issues/2

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/1ab476dc-2f9b-4c85-9e87-105fc73af1ee)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/786f984d-5c27-4eff-b3d9-159f68034ce4)

This issue comes from the change in #25468.
`LoadProject` will always return at least one record, so we use
`ProjectID` to check whether an issue is linked to a project in the old
code.
As other `issue.LoadXXX` functions, we need to check the return value
from `xorm.Session.Get`.

In recent unit tests, we only test `issueList.LoadAttributes()` but
don't test `issue.LoadAttributes()`. So I added a new test for
`issue.LoadAttributes()` in this PR.

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Denys Konovalov <privat@denyskon.de>
15 months agoFix the error message when the token is incorrect (#25701) (#25836)
Giteabot [Wed, 12 Jul 2023 10:18:27 +0000 (06:18 -0400)]
Fix the error message when the token is incorrect (#25701) (#25836)

Backport #25701 by @CaiCandong

we refactored `userIDFromToken` for the token parsing part into a new
function `parseToken`. `parseToken` returns the string `token` from
request, and a boolean `ok` representing whether the token exists or
not. So we can distinguish between token non-existence and token
inconsistency in the `verfity` function, thus solving the problem of no
proper error message when the token is inconsistent.
close #24439
related #22119

Co-authored-by: caicandong <50507092+CaiCandong@users.noreply.github.com>
Co-authored-by: Jason Song <i@wolfogre.com>
15 months agoBackport locale to 1.20 (#25840)
wxiaoguang [Wed, 12 Jul 2023 09:43:57 +0000 (17:43 +0800)]
Backport locale to 1.20 (#25840)

With manual fixes

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoShow correct SSL Mode on "install page" (#25818) (#25838)
Giteabot [Wed, 12 Jul 2023 06:01:38 +0000 (02:01 -0400)]
Show correct SSL Mode on "install page" (#25818) (#25838)

Backport #25818 by @wxiaoguang

Fix #25817

![image](https://github.com/go-gitea/gitea/assets/2114189/49f7b85d-c229-41b5-86fd-58cd812eaca6)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoFix incorrect oldest sort in project list (#25806) (#25835)
Giteabot [Wed, 12 Jul 2023 05:22:17 +0000 (01:22 -0400)]
Fix incorrect oldest sort in project list (#25806) (#25835)

Backport #25806 by @yp05327

sort type `oldest` should be `Asc`.
Added a test for this.

I see we have `SearchOrderBy` in db model, but we are using many
different ways to define the sort type.
~Maybe we can improve this later.~
↑ Improved in this PR

Co-authored-by: yp05327 <576951401@qq.com>
15 months agoFix activity type match in `matchPullRequestEvent` (#25746) (#25796)
Zettat123 [Tue, 11 Jul 2023 06:42:07 +0000 (14:42 +0800)]
Fix activity type match in `matchPullRequestEvent` (#25746) (#25796)

Backport #25746

Fix #25736
Caused by #24048

Right now we only check the activity type for `pull_request` event when
`types` is specified or there are no `types` and filter. If a workflow
only specifies filters but no `types` like this:
```
on:
  pull_request:
    branches: [main]
```
the workflow will be triggered even if the activity type is not one of
`[opened, reopened, sync]`. We need to check the activity type in this
case.

15 months agoFor API attachments, use API URL (#25639) (#25814)
Giteabot [Mon, 10 Jul 2023 12:56:16 +0000 (08:56 -0400)]
For API attachments, use API URL (#25639) (#25814)

Backport #25639 by @lunny

Fix #25257

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
15 months agoMake "install page" respect environment config (#25648) (#25799)
wxiaoguang [Mon, 10 Jul 2023 11:51:05 +0000 (19:51 +0800)]
Make "install page" respect environment config (#25648) (#25799)

Backport #25648

Replace #25580

Fix #19453

The problem was: when users set "GITEA__XXX__YYY" , the "install page"
doesn't respect it.

So, to make the result consistent and avoid surprising end users, now
the "install page" also writes the environment variables to the config
file.

And, to make things clear, there are enough messages on the UI to tell
users what will happen.

There are some necessary/related changes to `environment-to-ini.go`:

* The "--clear" flag is removed and it was incorrectly written there.
The "clear" operation should be done if INSTALL_LOCK=true
* The "--prefix" flag is removed because it's never used, never
documented and it only causes inconsistent behavior.

The only conflict during backport is "ui divider" in
templates/install.tmpl

15 months agoAvoid amending the Rebase and Fast-forward merge if there is no message template...
Giteabot [Mon, 10 Jul 2023 10:23:54 +0000 (06:23 -0400)]
Avoid amending the Rebase and Fast-forward merge if there is no message template (#25779) (#25809)

Backport #25779 by @wxiaoguang

Related #22669. Close #25177

After the fix:

![image](https://github.com/go-gitea/gitea/assets/2114189/0e900927-ea72-4f8f-bde6-5ed927cb02f4)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoFix WORK_DIR for docker (root) image (#25738) (#25811)
Giteabot [Mon, 10 Jul 2023 08:54:16 +0000 (04:54 -0400)]
Fix WORK_DIR for docker (root) image (#25738) (#25811)

Backport #25738 by @wxiaoguang

Fix #25726

#17846 chose an incorrect WORK_DIR path for docker root image.

Gitea's work-path was already used as the base path for various paths
(like AppDataPath), so, the work-path should be mounted to a volume in a
docker image.

Now, for docker root image, it's unavoidable to mix the
WorkPath/CustomPath/AppDataPath in the same directory ("/data/gitea"),
because some of them have already been mixed.

Some directories in the screenshot are for "CustomPath" , while others
are for "AppDataPath", due to the technical debts in old code:

```
CUSTOM_PATH="/data/gitea"
APP_DATA_PATH = /data/gitea
```

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/9f0648ac-f731-4a08-9f26-1af01a1824b1)

</details>

This PR is breaking but this is the only way at the moment to avoid
users losing their data accidently

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoClarify "text-align" CSS helpers, fix clone button padding (#25763) (#25764)
wxiaoguang [Sun, 9 Jul 2023 22:19:24 +0000 (06:19 +0800)]
Clarify "text-align" CSS helpers, fix clone button padding (#25763) (#25764)

Backport  #25763

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoRevert package access change from #23879 (#25707) (#25785)
Giteabot [Sun, 9 Jul 2023 21:00:42 +0000 (17:00 -0400)]
Revert package access change from #23879 (#25707) (#25785)

Backport #25707 by @KN4CK3R

Fixes (?) #25538
Fixes https://codeberg.org/forgejo/forgejo/issues/972

Regression #23879

#23879 introduced a change which prevents read access to packages if a
user is not a member of an organization.

That PR also contained a change which disallows package access if the
team unit is configured with "no access" for packages. I don't think
this change makes sense (at the moment). It may be relevant for private
orgs. But for public or limited orgs that's useless because an
unauthorized user would have more access rights than the team member.
This PR restores the old behaviour "If a user has read access for an
owner, they can read packages".

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
15 months agoRemove unused code (#25734) (#25788)
Giteabot [Sun, 9 Jul 2023 19:47:58 +0000 (15:47 -0400)]
Remove unused code (#25734) (#25788)

Backport #25734 by @KN4CK3R

The method is only used in the test. Found it because I changed the
fixtures and had a hard time fixing this test. My revenge is deleting
it.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
15 months agoFix notification list bugs (#25781) (#25787)
Giteabot [Sun, 9 Jul 2023 19:15:00 +0000 (15:15 -0400)]
Fix notification list bugs (#25781) (#25787)

Backport #25781 by @wxiaoguang

Fix #25627

1. `ctx.Data["Link"]` should use relative URL but not AppURL
2. The `data-params` is incorrect because it doesn't contain "page". JS
can simply use "window.location.search" to construct the AJAX URL
3. The `data-xxx` and `id` in notification_subscriptions.tmpl were
copied&pasted, they don't have affect.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoTest if container blob is accessible before mounting (#22759) (#25784)
Giteabot [Sun, 9 Jul 2023 12:00:04 +0000 (08:00 -0400)]
Test if container blob is accessible before mounting (#22759) (#25784)

Backport #22759 by @KN4CK3R

related #16865

This PR adds an accessibility check before mounting container blobs.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
15 months agoAlways pass 6-digit hex color to monaco (#25780) (#25782)
silverwind [Sun, 9 Jul 2023 11:06:13 +0000 (13:06 +0200)]
Always pass 6-digit hex color to monaco (#25780) (#25782)

Backport https://github.com/go-gitea/gitea/pull/25780, clean
cherry-pick.

Monaco can not deal with color formats other than 6-digit hex, so we
convert the colors for it via new
[`tinycolor2`](https://github.com/bgrins/TinyColor) dependency (5kB
minzipped).

Also, with the addition of the module, we can replace the existing
`hexToRGBColor` usage, I verified it is compatible with the current
tests before removing the function.

Fixes: https://github.com/go-gitea/gitea/issues/25770
15 months agodocs: rootless docker ssh's default port is 2222 (#25771) (#25772)
Giteabot [Sun, 9 Jul 2023 07:45:42 +0000 (03:45 -0400)]
docs: rootless docker ssh's default port is 2222 (#25771) (#25772)

Backport #25771 by @leavesster

---

according `docker/rootless/usr/local/bin/docker-setup.sh` , in rootless
docker setup, ssh port is 2222.
and mysql database case should port same as PostgreSQL port

Co-authored-by: leavesster <11785335+leavesster@users.noreply.github.com>
15 months agoTranslate untranslated string in issues list (#25759) (#25761)
Giteabot [Fri, 7 Jul 2023 23:04:08 +0000 (19:04 -0400)]
Translate untranslated string in issues list (#25759) (#25761)

Backport #25759 by @Maks1mS

Co-authored-by: Maxim Slipenko <no-reply@maxim.slipenko.com>
15 months agoHide `add file` button for pull mirrors (#25748) (#25751)
Giteabot [Fri, 7 Jul 2023 14:12:59 +0000 (10:12 -0400)]
Hide `add file` button for pull mirrors (#25748) (#25751)

Backport #25748 by @hiifong

I think hiding the add file button for mirror repositories that can keep
the ui clean.

Before:

![image](https://github.com/go-gitea/gitea/assets/89133723/84ecf1a5-1a92-4bb1-b472-b4988a4441a9)

After:

![image](https://github.com/go-gitea/gitea/assets/89133723/95382e73-286b-4114-9997-456ed77e07ca)

Co-authored-by: hiifong <i@hiif.ong>
15 months agoRemove broken translations (#25737)
wxiaoguang [Fri, 7 Jul 2023 07:10:21 +0000 (15:10 +0800)]
Remove broken translations (#25737)

Some translations were just copied&pasted and they duplicated a lot.

Now, they are broken .....

To avoid blocking 1.20 release, as a quick fix, remove all of them, only
keep the en-US texts.

15 months agoSeveral fixes for mobile UI (#25634) (#25689)
Denys Konovalov [Thu, 6 Jul 2023 22:34:00 +0000 (00:34 +0200)]
Several fixes for mobile UI (#25634) (#25689)

Backport #25634

Resolves https://github.com/go-gitea/gitea/issues/25622

<details>
<summary>Screenshots</summary>

![Bildschirmfoto vom 2023-07-02

20-47-34](https://github.com/go-gitea/gitea/assets/47871822/a8a0bff6-9ae3-48f3-b008-00c196a3f8fd)
![Bildschirmfoto vom 2023-07-02

20-47-45](https://github.com/go-gitea/gitea/assets/47871822/172a0021-af74-4690-aa67-0e66688ce733)
![Bildschirmfoto vom 2023-07-02

20-48-37](https://github.com/go-gitea/gitea/assets/47871822/14572ebd-0106-4c8a-ba27-b6b631375ee6)
![Bildschirmfoto vom 2023-07-02

20-49-08](https://github.com/go-gitea/gitea/assets/47871822/7c0ba3aa-1712-482c-aae9-13394dbdaf8a)
![Bildschirmfoto vom 2023-07-02

20-50-28](https://github.com/go-gitea/gitea/assets/47871822/8bd68e26-099a-4abd-8817-16d52af13167)
![Bildschirmfoto vom 2023-07-02

20-51-46](https://github.com/go-gitea/gitea/assets/47871822/3beab8c6-3747-4829-be50-bafaed11000c)
![Bildschirmfoto vom 2023-07-02

20-54-12](https://github.com/go-gitea/gitea/assets/47871822/51f82ef3-a32c-4c27-9056-e8711ed469cc)

</details>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoAllow/fix review (approve/reject) of empty PRs (#25690) (#25732)
Giteabot [Thu, 6 Jul 2023 19:34:41 +0000 (15:34 -0400)]
Allow/fix review (approve/reject) of empty PRs (#25690) (#25732)

Backport #25690 by @sebastian-sauer

gitea allows to create empty PRs.

Currently when you need approvals for a merge, you have to manually add
/files to the url to get to the files tab to approve / reject the PR.

This PR allows to open the files tab via the normal tab / link and then
fixes the layout of the files tab.

**Screenshots:**

Before:

![image](https://github.com/go-gitea/gitea/assets/1135157/b5082e5e-8c32-4412-993e-b854905e96d3)

After:

![image](https://github.com/go-gitea/gitea/assets/1135157/1f5e056e-396f-4dfb-8d14-e17a2f6495d9)

Co-authored-by: sebastian-sauer <sauer.sebastian@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
15 months agoCheck `ctx.Written()` for `GetActionIssue` (#25698) (#25711)
Giteabot [Thu, 6 Jul 2023 19:04:26 +0000 (15:04 -0400)]
Check `ctx.Written()` for `GetActionIssue` (#25698) (#25711)

Backport #25698 by @wolfogre

Fix #25697.

Just avoid panic, maybe there's another bug to trigger this case.

Co-authored-by: Jason Song <i@wolfogre.com>
15 months agoShow correct naming for 1 comment (#25704) (#25712)
Giteabot [Thu, 6 Jul 2023 16:04:13 +0000 (12:04 -0400)]
Show correct naming for 1 comment (#25704) (#25712)

Backport #25704 by @earl-warren

- Resolves https://codeberg.org/forgejo/forgejo/issues/948

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
15 months agoCorrect permissions for `.ssh` and `authorized_keys` (#25721) (#25730)
Giteabot [Thu, 6 Jul 2023 15:02:56 +0000 (11:02 -0400)]
Correct permissions for `.ssh` and `authorized_keys` (#25721) (#25730)

Backport #25721 by @wolfogre

Set the correct permissions on the .ssh directory and authorized_keys
file, or sshd will refuse to use them and lead to clone/push/pull
failures.

It could happen when users have copied their data to a new volume and
changed the file permission by accident, and it would be very hard to
troubleshoot unless users know how to check the logs of sshd which is
started by s6.

Co-authored-by: Jason Song <i@wolfogre.com>
15 months agoFix tags header and pretty format numbers (#25624) (#25694)
Giteabot [Wed, 5 Jul 2023 07:08:16 +0000 (03:08 -0400)]
Fix tags header and pretty format numbers (#25624) (#25694)

Backport #25624 by @lunny

This casused by #23465

Before

release disabled
<img width="1320" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/190a1c81-daa5-41bc-91ac-c9a0bf629b5f">

release enabled
<img width="1320" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/a0372c31-727c-4ee0-a6b9-30e502498d90">

After

release disabled
<img width="1304" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/a747ea80-a3d9-4792-8f6d-e8955da78b9e">

release enabled
<img width="1290" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/7c0bc43a-9149-4148-859d-35839aeb60ca">

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
15 months agoFix position of org follow button (#25688) (#25692)
Giteabot [Wed, 5 Jul 2023 06:31:12 +0000 (02:31 -0400)]
Fix position of org follow button (#25688) (#25692)

Backport #25688 by @silverwind

This has recently regressed it seems. Put it back into same position as
https://github.com/go-gitea/gitea/pull/24345.

Before:
<img width="1246" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/bb410c29-5539-4dad-8351-8da8470f7091">

After:
<img width="1236" alt="Screenshot 2023-07-04 at 21 19 13"
src="https://github.com/go-gitea/gitea/assets/115237/072e0e83-defd-484d-8861-33d73fa0e446">

Co-authored-by: silverwind <me@silverwind.io>
15 months agoReplace `interface{}` with `any` (#25686) (#25687)
silverwind [Wed, 5 Jul 2023 03:41:32 +0000 (05:41 +0200)]
Replace `interface{}` with `any` (#25686) (#25687)

Same perl replacement as https://github.com/go-gitea/gitea/pull/25686
but for 1.20 to ease future backporting.

15 months agoPrevent duplicate image loading (#25675) (#25684)
Giteabot [Tue, 4 Jul 2023 14:49:39 +0000 (10:49 -0400)]
Prevent duplicate image loading (#25675) (#25684)

Backport #25675 by @delvh

Regression of #25672.

Co-authored-by: delvh <dev.lh@web.de>
15 months agoActions list enhancements (#25601) (#25678)
silverwind [Tue, 4 Jul 2023 13:00:34 +0000 (15:00 +0200)]
Actions list enhancements (#25601) (#25678)

Backport https://github.com/go-gitea/gitea/pull/25601 to 1.20.

Various small enhancements to the actions list. Before and after:

<img width="1264" alt="Screenshot 2023-06-30 at 00 11 40"
src="https://github.com/go-gitea/gitea/assets/115237/bb4162ee-cdcf-4a73-b05e-f9521562edbb">
<img width="1264" alt="Screenshot 2023-06-30 at 00 09 51"
src="https://github.com/go-gitea/gitea/assets/115237/52a70ea9-4bb3-406e-904b-0fdaafde9582">

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoManual backport of locale for 1.20 (2nd) (#25668)
wxiaoguang [Tue, 4 Jul 2023 11:40:26 +0000 (19:40 +0800)]
Manual backport of locale for 1.20 (2nd) (#25668)

The backport needs manually checking because some 1.21 strings might not
be right for 1.20

This backport also includes most fixes from
https://github.com/go-gitea/gitea/pull/25291#issuecomment-1617678658
(thanks to lunny's manual fix on Crowdin side)

Close #25638

15 months agoFix the nil pointer when assigning issues to projects (#25665) (#25677)
Giteabot [Tue, 4 Jul 2023 10:59:01 +0000 (06:59 -0400)]
Fix the nil pointer when assigning issues to projects (#25665) (#25677)

Backport #25665 by @Zettat123

Fixes #25649
Caused by #25468

Co-authored-by: Zettat123 <zettat123@gmail.com>
15 months agoPrevent SVG shrinking (#25652) (#25669)
silverwind [Tue, 4 Jul 2023 10:03:03 +0000 (12:03 +0200)]
Prevent SVG shrinking (#25652) (#25669)

Backport https://github.com/go-gitea/gitea/pull/25652

This will prevent the most common cases of SVG shrinking because lack of
space. I evaluated multiple options and this seems to be the one with
the least impact in size and processing cost, so I went with it.

Unfortunately, CSS can not dynamically convert `16` obtained from
`attr()` to `16px`, or else a generic solution for all sizes would have
been possible. But a solution is [in

sight](https://developer.mozilla.org/en-US/docs/Web/CSS/attr#type-or-unit)
with `attr(width px)` but no browser supports it currently.

15 months agoFix show more for image on diff page (#25672) (#25673)
Giteabot [Tue, 4 Jul 2023 08:44:45 +0000 (04:44 -0400)]
Fix show more for image on diff page (#25672) (#25673)

Backport #25672 by @HesterG

Right now when clicking on loadmore on files change page, if the loaded
content is image, it will be always in load status:

https://github.com/go-gitea/gitea/assets/17645053/39e449b6-067a-474c-9443-9dd98d5bbfe2

This PR fixes this by adding `initImageDiff ` to `onShowMoreFiles `

After:

https://github.com/go-gitea/gitea/assets/17645053/87bbb13e-0064-4a6e-a7ad-0f0060eb8bff

Co-authored-by: HesterG <hestergong@gmail.com>
15 months agoAdd unit test for repository collaboration (#25640) (#25658)
Giteabot [Tue, 4 Jul 2023 06:29:43 +0000 (02:29 -0400)]
Add unit test for repository collaboration (#25640) (#25658)

Backport #25640 by @earl-warren

- Add a few extra test cases and test functions for the collaboration
model to get everything covered by tests (except for error handling, as
we cannot suddenly mock errors from the database).

```
-> % go tool cover -func=coverage.out | grep "code.gitea.io/gitea/models/repo/collaboration.go"
```

Before:
```
code.gitea.io/gitea/models/repo/collaboration.go:28:                            init                                            100.0%
code.gitea.io/gitea/models/repo/collaboration.go:39:                            GetCollaborators                                61.5%
code.gitea.io/gitea/models/repo/collaboration.go:65:                            CountCollaborators                              0.0%
code.gitea.io/gitea/models/repo/collaboration.go:70:                            GetCollaboration                                0.0%
code.gitea.io/gitea/models/repo/collaboration.go:83:                            IsCollaborator                                  100.0%
code.gitea.io/gitea/models/repo/collaboration.go:87:                            getCollaborations                               42.9%
code.gitea.io/gitea/models/repo/collaboration.go:102:                           ChangeCollaborationAccessMode                   77.8%
code.gitea.io/gitea/models/repo/collaboration.go:141:                           IsOwnerMemberCollaborator                       0.0%
```

After:
```
code.gitea.io/gitea/models/repo/collaboration.go:28:                            init                                            100.0%
code.gitea.io/gitea/models/repo/collaboration.go:39:                            GetCollaborators                                61.5%
code.gitea.io/gitea/models/repo/collaboration.go:65:                            CountCollaborators                              100.0%
code.gitea.io/gitea/models/repo/collaboration.go:70:                            GetCollaboration                                100.0%
code.gitea.io/gitea/models/repo/collaboration.go:83:                            IsCollaborator                                  100.0%
code.gitea.io/gitea/models/repo/collaboration.go:87:                            getCollaborations                               100.0%
code.gitea.io/gitea/models/repo/collaboration.go:102:                           ChangeCollaborationAccessMode                   83.3%
code.gitea.io/gitea/models/repo/collaboration.go:141:                           IsOwnerMemberCollaborator                       87.5%
```

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/825

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: silverwind <me@silverwind.io>
15 months agoLog the real reason when authentication fails (but don't show the user) (#25414)...
Giteabot [Mon, 3 Jul 2023 23:26:36 +0000 (19:26 -0400)]
Log the real reason when authentication fails (but don't show the user) (#25414) (#25660)

Backport #25414 by @lunny

Fix #24498

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
15 months agoFix UI misalignment on user setting page (#25629) (#25656)
Giteabot [Mon, 3 Jul 2023 21:16:58 +0000 (17:16 -0400)]
Fix UI misalignment on user setting page (#25629) (#25656)

Backport #25629 by @wxiaoguang

Fix #25628

Diff with ignoring space:
https://github.com/go-gitea/gitea/pull/25629/files?diff=unified&w=1

The "modal" shouldn't appear between "ui attached segment", otherwise
these segments lose margin-top.

After the fix:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/ac15e73d-4ca8-416a-950d-ffc912c6ab61)

![image](https://github.com/go-gitea/gitea/assets/2114189/eb431336-4d21-4e44-8beb-8919595a83c8)

![image](https://github.com/go-gitea/gitea/assets/2114189/dffaed88-5ba2-419d-a241-24cb200f757c)

![image](https://github.com/go-gitea/gitea/assets/2114189/e8c5a03e-e16a-4c94-a1a5-7845d4e1a824)

</details>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months ago Fix bug of branches API with tests(#25578) (#25579)
Lunny Xiao [Mon, 3 Jul 2023 14:17:30 +0000 (22:17 +0800)]
 Fix bug of branches API with tests(#25578) (#25579)

Backport #25578

This PR added a repository's check when creating/deleting branches via
API. Mirror repository and archive repository cannot do that.

15 months agoManuall backport of locale for 1.20 (#25635)
wxiaoguang [Mon, 3 Jul 2023 14:14:25 +0000 (22:14 +0800)]
Manuall backport of locale for 1.20 (#25635)

15 months agoFix bug when change user name (#25637) (#25646)
Giteabot [Mon, 3 Jul 2023 11:23:35 +0000 (07:23 -0400)]
Fix bug when change user name (#25637) (#25646)

Backport #25637 by @lunny

Fix #25621

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
15 months agoMake "cancel" buttons have proper type in modal forms (#25618) (#25641)
wxiaoguang [Mon, 3 Jul 2023 09:09:38 +0000 (17:09 +0800)]
Make "cancel" buttons have proper type in modal forms (#25618) (#25641)

Replace #25446, fix #25438

All "cancel" buttons which do not have "type" should not submit the
form, should not be triggered by "Enter".

This is a complete fix for all modal dialogs.

The major change is "modules/aria/modal.js", "devtest" related code is
for demo/test purpose.

15 months agouse css on labels (#25626) (#25636)
Giteabot [Mon, 3 Jul 2023 04:25:16 +0000 (00:25 -0400)]
use css on labels (#25626) (#25636)

Backport #25626 by @derelm

Changes html to use CSS label class similar to
`templates/shared/actions/runner_list.tmpl`

Before:

![grafik](https://github.com/go-gitea/gitea/assets/465155/6729d580-3ea6-4a90-972e-6e5117459da7)

After:

![grafik](https://github.com/go-gitea/gitea/assets/465155/d4fc280c-c40b-4db4-b1ba-877270f875c8)

List view (for reference - unchanged):

![grafik](https://github.com/go-gitea/gitea/assets/465155/5ad2d8d1-2fb5-414d-823b-48a368a74724)

Co-authored-by: derelm <465155+derelm@users.noreply.github.com>
15 months agoUse AfterCommitId to get commit for Viewed functionality (#25529) (#25612)
Giteabot [Fri, 30 Jun 2023 23:56:56 +0000 (19:56 -0400)]
Use AfterCommitId to get commit for Viewed functionality (#25529) (#25612)

Backport #25529 by @sebastian-sauer

the PullHeadCommitID is not always available when the PR is merged.

Not sure if this is the best solution but in my simple tests it looks
like this fixes the problem - happy to get any feedback.

hopefully fixes https://github.com/go-gitea/gitea/issues/24813

Co-authored-by: sebastian-sauer <sauer.sebastian@gmail.com>
15 months agoRestrict `[actions].DEFAULT_ACTIONS_URL` to only `github` or `self` (#25581) (#25604)
Giteabot [Fri, 30 Jun 2023 07:53:00 +0000 (03:53 -0400)]
Restrict `[actions].DEFAULT_ACTIONS_URL` to only `github` or `self` (#25581) (#25604)

Backport #25581 by @wolfogre

Resolve #24789

## :warning: BREAKING :warning:

Before this, `DEFAULT_ACTIONS_URL` cound be set to any custom URLs like
`https://gitea.com` or `http://your-git-server,https://gitea.com`, and
the default value was `https://gitea.com`.

But now, `DEFAULT_ACTIONS_URL` supports only
`github`(`https://github.com`) or `self`(the root url of current Gitea
instance), and the default value is `github`.

If it has configured with a URL, an error log will be displayed and it
will fallback to `github`.

Actually, what we really want to do is always make it
`https://github.com`, however, this may not be acceptable for some
instances of internal use, so there's extra support for `self`, but no
more, even `https://gitea.com`.

Please note that `uses: https://xxx/yyy/zzz` always works and it does
exactly what it is supposed to do.

Although it's breaking, I belive it should be backported to `v1.20` due
to some security issues.

Follow-up on the runner side:

- https://gitea.com/gitea/act_runner/pulls/262
- https://gitea.com/gitea/act/pulls/70

Co-authored-by: Jason Song <i@wolfogre.com>
15 months agoread-only checkboxes don't appear and don't entirely act the way one might expect...
Giteabot [Thu, 29 Jun 2023 22:53:43 +0000 (18:53 -0400)]
read-only checkboxes don't appear and don't entirely act the way one might expect (#25573) (#25602)

Backport #25573 by @saegl5

This pull request fades read-only checkboxes and checkmark, and it makes
the checkboxes act more read-only/disabled by not changing the
border-color when clicked.

Examples using light mode:

| Before | After |
| - | - |
| ![Kapture 2023-06-28 at 00 20
45](https://github.com/go-gitea/gitea/assets/63764270/0899fd5c-18a9-4290-9ba9-d3cf71033cf8)
| ![Kapture 2023-06-28 at 00 23
12](https://github.com/go-gitea/gitea/assets/63764270/0db9be14-e16c-42ed-8fb1-999928fd1d25)
|
| ![Kapture 2023-06-28 at 00 25
22](https://github.com/go-gitea/gitea/assets/63764270/65c6c380-b928-4e6c-b403-3655d3565896)
| ![Kapture 2023-06-28 at 00 27
28](https://github.com/go-gitea/gitea/assets/63764270/d8c2a019-e07c-43a1-a7fa-93c0d4e01900)
|
| | read-only checkboxes and checkmark are faded<br>and the checkboxes
act more read-only/disabled |

Fixes/Closes/Resolves #25076

Co-authored-by: Ed Silkworth <ed.silkworth@icloud.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoRedirect to package after version deletion (#25594) (#25599)
KN4CK3R [Thu, 29 Jun 2023 22:14:57 +0000 (00:14 +0200)]
Redirect to package after version deletion (#25594) (#25599)

Related #25559

Current behaviour:
1. Deletion of a package version
2. Redirect to the owners package list

New behaviour:
1. Deletion of a package version
2.1. If there are more versions available, redirect to the package again
2.2. If there are no versions available, redirect to the owners package
list

15 months agoAdd documentation about supported workflow trigger events (#25582) (#25589)
Giteabot [Thu, 29 Jun 2023 12:51:46 +0000 (08:51 -0400)]
Add documentation about supported workflow trigger events (#25582) (#25589)

Backport #25582 by @Zettat123

Right now Gitea doesn't support all [Events that trigger
workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows).
This PR lists the supported events to help users write workflow files.

Co-authored-by: Zettat123 <zettat123@gmail.com>
15 months agoReduce table padding globally (#25568) (#25577)
Giteabot [Thu, 29 Jun 2023 09:24:02 +0000 (05:24 -0400)]
Reduce table padding globally (#25568) (#25577)

Backport #25568 by @silverwind

Fomantic's tables have too much padding. Reduce it so we have more
information density in them. Especially the admin tables need this
because they are bursting already because of column count.

## Admin repolist before and after

<img width="909" alt="Screenshot 2023-06-28 at 20 27 55"
src="https://github.com/go-gitea/gitea/assets/115237/954c925c-8db5-47ce-ae51-a2168b857014">
<img width="897" alt="Screenshot 2023-06-28 at 20 36 03"
src="https://github.com/go-gitea/gitea/assets/115237/0bddc09a-9117-48b3-a17e-3d34c58d8d3d">

## Other tables

<img width="1230" alt="Screenshot 2023-06-28 at 20 36 22"
src="https://github.com/go-gitea/gitea/assets/115237/38f555b6-a7ce-416a-9f1f-706eaf18863b">
<img width="1236" alt="Screenshot 2023-06-28 at 20 26 37"
src="https://github.com/go-gitea/gitea/assets/115237/82b2878e-358c-4dc2-a6b4-c66e43cd2dfb">
<img width="1231" alt="Screenshot 2023-06-28 at 20 59 30"
src="https://github.com/go-gitea/gitea/assets/115237/c6a92e55-a3a3-4c80-9a0d-50aebb49886c">

Files table is unaffected because it has custom padding already.

Co-authored-by: silverwind <me@silverwind.io>
15 months agoFix milestones deletion (#25583) (#25584)
Giteabot [Thu, 29 Jun 2023 08:52:05 +0000 (04:52 -0400)]
Fix milestones deletion (#25583) (#25584)

Backport #25583 by @HesterG

Close #25557
Fix regression from #25315

`data-id` is still needed for deleting milestone.

Co-authored-by: HesterG <hestergong@gmail.com>
15 months agoDo not prepare oauth2 config if it is not enabled, do not write config in some sub...
wxiaoguang [Thu, 29 Jun 2023 04:30:40 +0000 (12:30 +0800)]
Do not prepare oauth2 config if it is not enabled, do not write config in some sub-commands (#25567) (#25576)

Backport #25567

Ref:

* https://github.com/go-gitea/gitea/issues/25377#issuecomment-1609757289

And some sub-commands like "generate" / "docs", they do not need to use
the ini config

15 months agoFix content holes in Actions task logs file (#25560) (#25566)
Giteabot [Wed, 28 Jun 2023 23:39:23 +0000 (19:39 -0400)]
Fix content holes in Actions task logs file (#25560) (#25566)

Backport #25560 by @wolfogre

Fix #25451.

Bugfixes:
- When stopping the zombie or endless tasks, set `LogInStorage` to true
after transferring the file to storage. It was missing, it could write
to a nonexistent file in DBFS because `LogInStorage` was false.
- Always update `ActionTask.Updated` when there's a new state reported
by the runner, even if there's no change. This is to avoid the task
being judged as a zombie task.

Enhancement:
- Support `Stat()` for DBFS file.
- `WriteLogs` refuses to write if it could result in content holes.

Co-authored-by: Jason Song <i@wolfogre.com>
15 months agoUse correct response code in push mirror creation response in v1_json.tmpl (#25476...
Giteabot [Wed, 28 Jun 2023 23:00:56 +0000 (19:00 -0400)]
Use correct response code in push mirror creation response in v1_json.tmpl (#25476) (#25571)

Backport #25476 by @GeorgDangl

In the process of doing a bit of automation via the API, we've
discovered a _small_ issue in the Swagger definition. We tried to create
a push mirror for a repository, but our generated client raised an
exception due to an unexpected status code.

When looking at this function:

https://github.com/go-gitea/gitea/blob/3c7f5ed7b5bff347198cbb26492e6354ea42733b/routers/api/v1/repo/mirror.go#L236-L240

We see it defines `201 - Created` as response:

https://github.com/go-gitea/gitea/blob/3c7f5ed7b5bff347198cbb26492e6354ea42733b/routers/api/v1/repo/mirror.go#L260-L262

But it actually returns `200 - OK`:

https://github.com/go-gitea/gitea/blob/3c7f5ed7b5bff347198cbb26492e6354ea42733b/routers/api/v1/repo/mirror.go#L373

So I've just updated the Swagger definitions to match the code😀

Co-authored-by: Georg Dangl <10274404+GeorgDangl@users.noreply.github.com>
15 months agoFix bugs related to notification endpoints (#25548) (#25562)
Giteabot [Wed, 28 Jun 2023 16:24:48 +0000 (12:24 -0400)]
Fix bugs related to notification endpoints (#25548) (#25562)

Backport #25548 by @Zettat123

This PR
- fixes #25545
- fixes two incorrect `reqToken()` in `/notifications` endpoints (caused
by #24767)

Co-authored-by: Zettat123 <zettat123@gmail.com>
15 months agoAlign language menu icon and fit the footer area (#25556) (#25563)
Giteabot [Wed, 28 Jun 2023 15:51:24 +0000 (11:51 -0400)]
Align language menu icon and fit the footer area (#25556) (#25563)

Backport #25556 by @wxiaoguang

Close #25551

## Before

![image](https://github.com/go-gitea/gitea/assets/2114189/f35aebeb-9c86-4632-8c1f-1c90aa757640)

## After

![image](https://github.com/go-gitea/gitea/assets/2114189/4a623687-6c6d-442a-a4f9-07dadeb9fc6d)

----

![image](https://github.com/go-gitea/gitea/assets/2114189/6a4e5ecf-b88b-4c22-98c3-21898bd41bc5)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoFix sub-command log level (#25537) (#25553)
wxiaoguang [Wed, 28 Jun 2023 09:35:20 +0000 (17:35 +0800)]
Fix sub-command log level (#25537) (#25553)

Backport #25537

More fix for #24981

* #24981

Close #22361, #25552

* #22361
* #25552

There were many patches for Gitea's sub-commands to satisfy the facts:

* Some sub-commands shouldn't output any log, otherwise the git protocol
would be broken
* Sometimes the users want to see "verbose" or "quiet" outputs

That's a longstanding problem, and very fragile. This PR is only a quick
patch for the problem.

In the future, the sub-command system should be refactored to a clear
solution.

----

Other changes:

* Use `ReplaceAllWriters` to replace
`RemoveAllWriters().AddWriters(writer)`, then it's an atomic operation.
* Remove unnecessary `syncLevelInternal` calls, because
`AddWriters/addWritersInternal` already calls it.

15 months agoChange `Regenerate Secret` button display (#25534) (#25541)
Giteabot [Tue, 27 Jun 2023 20:14:58 +0000 (16:14 -0400)]
Change `Regenerate Secret` button display (#25534) (#25541)

Backport #25534 by @KN4CK3R

Fixes #25527

Preview:

![grafik](https://github.com/go-gitea/gitea/assets/1666336/a84ad1ba-43e6-42e5-a0e2-585fb226875d)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
15 months agoFix admin-dl-horizontal (#25512) (#25535)
Giteabot [Tue, 27 Jun 2023 17:06:36 +0000 (13:06 -0400)]
Fix admin-dl-horizontal (#25512) (#25535)

Backport #25512 by @wxiaoguang

![image](https://github.com/go-gitea/gitea/assets/2114189/fb731e07-da30-4470-8200-73b5ca8b78f1)

![image](https://github.com/go-gitea/gitea/assets/2114189/85930b6f-5df7-437f-863f-423f3b81dd26)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: HesterG <hestergong@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
15 months agoFix rerun icon on action view component (#25531) (#25536)
Giteabot [Tue, 27 Jun 2023 16:28:14 +0000 (12:28 -0400)]
Fix rerun icon on action view component (#25531) (#25536)

Backport #25531 by @HesterG

Right now rerun icon on action view component will not be seen when
duration text length is long, because the wrapper `job-brief-info` has a
fixed width, and the svg is squeezed. The way to fix this in this PR is
to change width to `fit-content` and exchange position of duration text
and rerun svg.

Before (rerun svg not shown on hover):

<img width="1401" alt="Screen Shot 2023-06-27 at 12 53 41"
src="https://github.com/go-gitea/gitea/assets/17645053/bb3f62ec-8c56-4dbc-96f1-718b50426d91">

After:

<img width="1409" alt="Screen Shot 2023-06-27 at 12 50 59"
src="https://github.com/go-gitea/gitea/assets/17645053/620aa02c-2326-408d-a763-453f48f42c40">

Co-authored-by: HesterG <hestergong@gmail.com>
15 months agoFix input `line-height` cutting off `g` (#25334) (#25533)
Giteabot [Tue, 27 Jun 2023 09:31:18 +0000 (05:31 -0400)]
Fix input `line-height` cutting off `g` (#25334) (#25533)

Backport #25334 by @hiifong

Fix the incomplete display of input text
Before:

![image](https://github.com/go-gitea/gitea/assets/89133723/6bd8ca29-a096-46a8-bd23-fb833f45186f)

![image](https://github.com/go-gitea/gitea/assets/89133723/27e51e62-7150-45cd-8606-09317d462d70)
After:

![image](https://github.com/go-gitea/gitea/assets/89133723/8d0db5d3-d768-42b4-9a75-0b8816f0a299)

![image](https://github.com/go-gitea/gitea/assets/89133723/4193adc9-b635-4ed6-8e11-715ec5150563)

Co-authored-by: hiifong <i@hiif.ong>
Co-authored-by: silverwind <me@silverwind.io>
15 months agoChangelog for v1.20.0-rc2 (#25474)
6543 [Tue, 27 Jun 2023 04:08:37 +0000 (06:08 +0200)]
Changelog for v1.20.0-rc2 (#25474)

as title

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
15 months agoAllow change line of admin-dl-horizontal dt (#25508) (#25516)
HesterG [Mon, 26 Jun 2023 20:20:22 +0000 (04:20 +0800)]
Allow change line of admin-dl-horizontal dt (#25508) (#25516)

As https://github.com/go-gitea/gitea/pull/25515#issuecomment-1606626886
says, still need this backport

Close #25389

After:

<img width="915" alt="Screen Shot 2023-06-26 at 11 00 12"
src="https://github.com/go-gitea/gitea/assets/17645053/45026447-cf50-4603-ade3-7b80a9023c20">

admin/dashboard:

<img width="957" alt="Screen Shot 2023-06-26 at 10 59 51"
src="https://github.com/go-gitea/gitea/assets/17645053/f4f95bbe-f747-46f1-8fbd-5778a19ebef7">

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoAdd Adopt repository event and handler (#25497) (#25518)
Giteabot [Mon, 26 Jun 2023 20:09:07 +0000 (16:09 -0400)]
Add Adopt repository event and handler (#25497) (#25518)

Backport #25497 by @lunny

Fix #14304

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
15 months agoClarify the reason why the user can't add a new email if there is a pending activatio...
Giteabot [Mon, 26 Jun 2023 09:28:48 +0000 (05:28 -0400)]
Clarify the reason why the user can't add a new email if there is a pending activation (#25509) (#25514)

Backport #25509 by @wxiaoguang

![image](https://github.com/go-gitea/gitea/assets/2114189/cff20df0-ad0c-4140-b8e2-5782cad8a53a)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoFix CLI sub-command handling (#25501) (#25517)
Giteabot [Mon, 26 Jun 2023 08:41:52 +0000 (04:41 -0400)]
Fix CLI sub-command handling (#25501) (#25517)

Backport #25501 by @wxiaoguang

A regression of #25330 : The nil "Action" should be treated as "help"

In old releases: `./gitea admin` show helps

After #25330: `./gitea admin` panics (although the code returned `nil`
if action is nil, but Golang's quirk is: nil in interface is not nil)

With this PR: `./gitea admin` shows helps as the old releases.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoImprove loadprojects for issue list (#25468) (#25493)
Giteabot [Mon, 26 Jun 2023 02:06:58 +0000 (22:06 -0400)]
Improve loadprojects for issue list (#25468) (#25493)

15 months agoDocument creating an API key from the CLI (#25504)
lonix1 [Mon, 26 Jun 2023 01:33:34 +0000 (03:33 +0200)]
Document creating an API key from the CLI (#25504)

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

---------

Co-authored-by: delvh <dev.lh@web.de>
15 months agoFine tune "dropdown button" icon (#25442) (#25499)
Giteabot [Sun, 25 Jun 2023 06:35:26 +0000 (02:35 -0400)]
Fine tune "dropdown button" icon (#25442) (#25499)

Backport #25442 by @wxiaoguang

![image](https://github.com/go-gitea/gitea/assets/2114189/143e043d-85c9-43a4-85ae-ca55f507f738)

----

![image](https://github.com/go-gitea/gitea/assets/2114189/bcba03a5-732e-4139-bc35-96a7f8bfcb88)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoUse InitWorkPathAndCfgProvider for environment-to-ini to avoid unnecessary checks... v1.20.0-rc2
Giteabot [Sat, 24 Jun 2023 14:04:50 +0000 (10:04 -0400)]
Use InitWorkPathAndCfgProvider for environment-to-ini to avoid unnecessary checks (#25480) (#25488)

Backport #25480 by @wxiaoguang

Fix #25481

The `InitWorkPathAndCommonConfig` calls `LoadCommonSettings` which does
many checks like "current user is root or not".

Some commands like "environment-to-ini" shouldn't do such check, because
it might be run with "root" user at the moment (eg: the docker's setup
script)

ps: in the future, the docker's setup script should be improved to avoid
Gitea's command running with "root"

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoRevert "Make buttons in a modal form have proper type. (#25446) (#25478)" (#25484)
wxiaoguang [Sat, 24 Jun 2023 13:28:55 +0000 (21:28 +0800)]
Revert "Make buttons in a modal form have proper type. (#25446) (#25478)" (#25484)

There is a side effect because some modal doesn't have a proper "ok"
button.

This reverts commit 050c38ca19cce06040741321e7871121981c76f4.

15 months agoFix wrong warn messages in migration steps (#25475) (#25487)
Giteabot [Sat, 24 Jun 2023 09:51:26 +0000 (05:51 -0400)]
Fix wrong warn messages in migration steps (#25475) (#25487)

15 months agoMake buttons in a modal form have proper type. (#25446) (#25478)
Denys Konovalov [Sat, 24 Jun 2023 03:56:06 +0000 (05:56 +0200)]
Make buttons in a modal form have proper type. (#25446) (#25478)

Backport #25446 by @wxiaoguang

Fix  #25438

All non-"ok" buttons which do not have "type" should not submit the
form, should not be triggered by "Enter".

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoImprove wiki sidebar and TOC (#25460) (#25477)
Giteabot [Sat, 24 Jun 2023 02:16:15 +0000 (22:16 -0400)]
Improve wiki sidebar and TOC (#25460) (#25477)

Backport #25460 by @wxiaoguang

Close #20976
Close #20975

1. Fix the bug: the TOC in footer was incorrectly rendered as main
content's TOC
2. Fix the layout: on mobile, the TOC is put above the main content,
while the sidebar is put below the main content
3. Auto collapse the TOC on mobile

ps: many styles of "wiki.css" are moved from old css files, so leave
nits to following PRs.

### for desktop

![image](https://github.com/go-gitea/gitea/assets/2114189/6c84201c-0648-465a-99e6-c53cdaee53c0)

### for mobile

![image](https://github.com/go-gitea/gitea/assets/2114189/9cb4fdfe-b6ab-4e6f-ae82-219ddb8fa27e)

### other changed pages

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/ef077736-2c3e-4e3d-82fe-d9bf1ebcca98)

![image](https://github.com/go-gitea/gitea/assets/2114189/bb528429-ad5f-4258-a5c4-05f997c624ea)

</details>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoFix repo search broken because of profile page added (#25455) (#25467) v1.20.0-rc1
Giteabot [Fri, 23 Jun 2023 13:48:35 +0000 (09:48 -0400)]
Fix repo search broken because of profile page added (#25455) (#25467)

Backport #25455 by @lunny

Fix #25433
Caused by #23260

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
15 months agoMake "dismiss" content shown correctly (#25461) (#25465)
Giteabot [Fri, 23 Jun 2023 11:04:15 +0000 (07:04 -0400)]
Make "dismiss" content shown correctly (#25461) (#25465)

Backport #25461 by @wxiaoguang

Close #25127

![image](https://github.com/go-gitea/gitea/assets/2114189/7d6be811-8e4a-4982-a5e4-857d171758d4)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoGitea version in Makefile (#25456) (#25457)
John Olheiser [Fri, 23 Jun 2023 07:52:03 +0000 (02:52 -0500)]
Gitea version in Makefile (#25456) (#25457)

Backport-ish of #25456

Signed-off-by: jolheiser <john.olheiser@gmail.com>
15 months agoSupport Drone building binaries too
techknowlogick [Fri, 23 Jun 2023 01:13:54 +0000 (21:13 -0400)]
Support Drone building binaries too

15 months agoRemove test string (#25447) (#25448)
Denys Konovalov [Thu, 22 Jun 2023 17:30:51 +0000 (19:30 +0200)]
Remove test string (#25447) (#25448)

Backport #25447

Remove test string on delete project button, I overlooked it in a
previous PR

15 months agoRefactor path & config system (#25330) (#25416)
wxiaoguang [Thu, 22 Jun 2023 16:27:18 +0000 (00:27 +0800)]
Refactor path & config system (#25330) (#25416)

Backport #25330

# The problem

There were many "path tricks":

* By default, Gitea uses its program directory as its work path
* Gitea tries to use the "work path" to guess its "custom path" and
"custom conf (app.ini)"
* Users might want to use other directories as work path
* The non-default work path should be passed to Gitea by GITEA_WORK_DIR
or "--work-path"
* But some Gitea processes are started without these values
    * The "serv" process started by OpenSSH server
    * The CLI sub-commands started by site admin
* The paths are guessed by SetCustomPathAndConf again and again
* The default values of "work path / custom path / custom conf" can be
changed when compiling

# The solution

* Use `InitWorkPathAndCommonConfig` to handle these path tricks, and use
test code to cover its behaviors.
* When Gitea's web server runs, write the WORK_PATH to "app.ini", this
value must be the most correct one, because if this value is not right,
users would find that the web UI doesn't work and then they should be
able to fix it.
* Then all other sub-commands can use the WORK_PATH in app.ini to
initialize their paths.
* By the way, when Gitea starts for git protocol, it shouldn't output
any log, otherwise the git protocol gets broken and client blocks
forever.

The "work path" priority is: WORK_PATH in app.ini > cmd arg --work-path
> env var GITEA_WORK_DIR > builtin default

The "app.ini" searching order is: cmd arg --config > cmd arg "work path
/ custom path" > env var "work path / custom path" > builtin default

## ⚠️ BREAKING

If your instance's "work path / custom path / custom conf" doesn't meet
the requirements (eg: work path must be absolute), Gitea will report a
fatal error and exit. You need to set these values according to the
error log.

15 months agoMove some regexp out of functions (#25430) (#25445)
John Olheiser [Thu, 22 Jun 2023 16:01:54 +0000 (11:01 -0500)]
Move some regexp out of functions (#25430)  (#25445)

Partial backport of #25430

Not a bug, but worth backporting for efficiency.

Signed-off-by: jolheiser <john.olheiser@gmail.com>