]> source.dussan.org Git - gitea.git/log
gitea.git
5 months agoFix incorrect object id hash function (#30708)
wxiaoguang [Fri, 26 Apr 2024 09:49:48 +0000 (17:49 +0800)]
Fix incorrect object id hash function (#30708)

Great thanks to @oliverpool for figuring out the problem and proposing a
fix.

Regression of #28138

Incorrect hash causes the user's LFS files get all deleted when running
`doctor fix all`

(by the way, remove unused/non-standard comments)

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoAdd route handler info for debugging purpose (#30705)
wxiaoguang [Fri, 26 Apr 2024 09:09:49 +0000 (17:09 +0800)]
Add route handler info for debugging purpose (#30705)

Follow #30519

5 months agoBump htmx version to 1.9.12 (#30711)
Yarden Shoham [Fri, 26 Apr 2024 07:27:34 +0000 (10:27 +0300)]
Bump htmx version to 1.9.12 (#30711)

There are no breaking changes. I tested and everything works as before.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
5 months agoDeduplicate lfs common code (#30704)
wxiaoguang [Fri, 26 Apr 2024 02:53:30 +0000 (10:53 +0800)]
Deduplicate lfs common code (#30704)

5 months agoImprove job commit description (#30579)
yp05327 [Fri, 26 Apr 2024 02:22:45 +0000 (11:22 +0900)]
Improve job commit description (#30579)

Fix https://github.com/go-gitea/gitea/issues/30567

When job is a schedule:

![image](https://github.com/go-gitea/gitea/assets/18380374/b07e9d43-e8b7-4ee2-87b3-a7050c3a8ca5)
When it is a normal one:

![image](https://github.com/go-gitea/gitea/assets/18380374/0d58dab9-74bb-421b-8952-0578cdf21a52)

also add a 'space' behind  `:`

![image](https://github.com/go-gitea/gitea/assets/18380374/4cebece0-bfe6-4ad9-b806-e5c49bb9be43)

![image](https://github.com/go-gitea/gitea/assets/18380374/02da7681-474b-4c0f-9dad-b6558f6cb484)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
5 months agoImprove test for TestPullCompare (#30699)
Lunny Xiao [Fri, 26 Apr 2024 01:52:28 +0000 (09:52 +0800)]
Improve test for TestPullCompare (#30699)

5 months agoAllow to save empty comment (#30706)
wxiaoguang [Fri, 26 Apr 2024 01:17:43 +0000 (09:17 +0800)]
Allow to save empty comment (#30706)

Fix #29986

5 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 26 Apr 2024 00:26:00 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

5 months agoRefactor imagediff and fix regression bug (#30694)
wxiaoguang [Thu, 25 Apr 2024 13:01:38 +0000 (21:01 +0800)]
Refactor imagediff and fix regression bug (#30694)

Fix #30683

5 months agoImprove oauth2 client "preferred username field" logic and the error handling (#30622)
wxiaoguang [Thu, 25 Apr 2024 11:22:32 +0000 (19:22 +0800)]
Improve oauth2 client "preferred username field" logic and the error handling (#30622)

Follow #30454
And fix #24957

When using "preferred_username", if no such field,
`extractUserNameFromOAuth2` (old `getUserName`) shouldn't return an
error. All other USERNAME options do not return such error.

And fine tune some logic and error messages, make code more stable and
more friendly to end users.

5 months agoFix active item in tab menu (#30690)
silverwind [Thu, 25 Apr 2024 10:53:39 +0000 (12:53 +0200)]
Fix active item in tab menu (#30690)

Before, item would also resize on hover because of font weight:
<img width="381" alt="Screenshot 2024-04-25 at 01 28 53"
src="https://github.com/go-gitea/gitea/assets/115237/4f3291fc-90be-4d66-ae8b-3c2f763cb956">

After:
<img width="381" alt="Screenshot 2024-04-25 at 01 28 40"
src="https://github.com/go-gitea/gitea/assets/115237/06145bf2-1ddd-4171-9217-d92c100ea405">

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoIf a repository return no commitstatus, then still cache it but not query it from...
Lunny Xiao [Thu, 25 Apr 2024 09:14:23 +0000 (17:14 +0800)]
If a repository return no commitstatus, then still cache it but not query it from database (#30700)

The previous repository default branch commit status cache will only
store if the commit status has value. So the repository which have no
any commit status will always be fetched from database.

This PR will store the empty state of commit status of a repository into
cache because the cache will be updated once there is a commit status
stored.

5 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 25 Apr 2024 00:26:13 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

5 months agoFix view of readme file in the home code page. (#30564)
Jiaxin Zhu [Thu, 25 Apr 2024 00:07:38 +0000 (08:07 +0800)]
Fix view of readme file in the home code page. (#30564)

Gitea attempts to display image file, pdf file, etc. named readme in the
home code page (but it cannot).
I think only the markdown and plain-text file should be displayed, which
is also the behavior of GitHub.

Co-authored-by: jxshin <zhujiaxinabc@gmail.com>
5 months agoAdd test for #30674 (#30679)
Lunny Xiao [Wed, 24 Apr 2024 14:11:49 +0000 (22:11 +0800)]
Add test for #30674 (#30679)

5 months agoFix border-radius of header+segment boxes (#30667)
silverwind [Wed, 24 Apr 2024 13:11:52 +0000 (15:11 +0200)]
Fix border-radius of header+segment boxes (#30667)

This is a very old bug with the bottom border-radiuses not being there
and the `:has` selector now makes it possible to cleanly solve it. It
affects all header+segment boxes, which there are many throughout the
UI:

<img width="1017" alt="Screenshot 2024-04-23 at 20 47 21"
src="https://github.com/go-gitea/gitea/assets/115237/870fe352-cc38-4bd6-bfe6-9fe8c3066f92">

5 months agoFix a panic bug when head repository deleting (#30674)
Lunny Xiao [Wed, 24 Apr 2024 05:26:50 +0000 (13:26 +0800)]
Fix a panic bug when head repository deleting (#30674)

When visiting a pull request files which head repository has been
deleted, it will panic because headrepo is nil.

5 months agoFix some bug on migrations (#30647)
Lunny Xiao [Wed, 24 Apr 2024 01:58:24 +0000 (09:58 +0800)]
Fix some bug on migrations (#30647)

Fix https://github.com/go-gitea/gitea/pull/23894#discussion_r1573718690

5 months agoFix checkbox field markup (#30666)
silverwind [Tue, 23 Apr 2024 21:53:57 +0000 (23:53 +0200)]
Fix checkbox field markup (#30666)

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

Previous use was not a supported way by fomantic and the misuse only
became visible after the checkbox migration.

5 months agoAvoid doubled border for the PR info segment (#30663)
wxiaoguang [Tue, 23 Apr 2024 19:24:10 +0000 (03:24 +0800)]
Avoid doubled border for the PR info segment (#30663)

5 months agoInterpolate runs-on with variables when scheduling tasks (#30640)
sillyguodong [Tue, 23 Apr 2024 18:55:25 +0000 (02:55 +0800)]
Interpolate runs-on with variables when scheduling tasks (#30640)

Follow #29468
1. Interpolate runs-on with variables when scheduling tasks.
2. The `GetVariablesOfRun` function will check if the `Repo` of the run
is nil.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoInitial support for colorblindness-friendly themes (#30625)
wxiaoguang [Tue, 23 Apr 2024 16:18:41 +0000 (00:18 +0800)]
Initial support for colorblindness-friendly themes (#30625)

Initial support for #25680

This PR only adds some simple styles from GitHub, it is big enough and
it focuses on adding the necessary framework-level supports. More styles
could be fine-tuned later.

5 months agoFix flash message for flex-container (#30657)
wxiaoguang [Tue, 23 Apr 2024 08:31:51 +0000 (16:31 +0800)]
Fix flash message for flex-container (#30657)

5 months agoPerform Newest sort type correctly when sorting issues (#30644)
Kemal Zebari [Tue, 23 Apr 2024 07:10:01 +0000 (00:10 -0700)]
Perform Newest sort type correctly when sorting issues (#30644)

Should resolve #30642.

Before this commit, we were treating an empty `?sort=` query parameter
as the correct sorting type (which is to sort issues in descending order
by their created UNIX time). But when we perform `sort=latest`, we did
not include this as a type so we would sort by the most recently updated
when reaching the `default` switch statement block.

This commit fixes this by considering the empty string, "latest", and
just any other string that is not mentioned in the switch statement as
sorting by newest.

5 months agoFix project name wrapping, remove horizontal margin on header (#30631)
silverwind [Tue, 23 Apr 2024 04:17:51 +0000 (06:17 +0200)]
Fix project name wrapping, remove horizontal margin on header (#30631)

Enable wrapping of unbroken lines:

<img width="1308" alt="Screenshot 2024-04-22 at 00 31 33"
src="https://github.com/go-gitea/gitea/assets/115237/1a28ade1-d708-4260-96a3-cf508b6dcb79">

Remove extra margin added by nested `.ui.container` on certain
viewports:

Before:
<img width="1305" alt="Screenshot 2024-04-22 at 00 40 23"
src="https://github.com/go-gitea/gitea/assets/115237/d3d8c0d1-380c-4867-b95c-4d53d70d4a93">

After:
<img width="1310" alt="Screenshot 2024-04-22 at 00 40 33"
src="https://github.com/go-gitea/gitea/assets/115237/2ba7b9f2-db2f-4bcc-8cce-5c415625ddea">

5 months agoAdd a db consistency check to remove runners that do not belong to a repository ...
Zettat123 [Tue, 23 Apr 2024 03:51:52 +0000 (11:51 +0800)]
Add a db consistency check to remove runners that do not belong to a repository (#30614)

Follow #30406

5 months agoFix wrong table name (#30557)
Lunny Xiao [Tue, 23 Apr 2024 03:00:57 +0000 (11:00 +0800)]
Fix wrong table name (#30557)

The table name should be `oauth2_application` but `o_auth2_application`

Caused by
https://github.com/go-gitea/gitea/pull/21316/files#diff-9610efbc608a41f1f2eaff5790423f0a187906f6ff0beb23a5e8d18366cc2ccfR38

5 months agoFix compare api swagger (#30648)
Lunny Xiao [Tue, 23 Apr 2024 02:22:43 +0000 (10:22 +0800)]
Fix compare api swagger (#30648)

The swagger format on #30349 is not right. This PR will fix it.

5 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 23 Apr 2024 00:24:55 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

5 months agoFix queue test (#30646)
wxiaoguang [Mon, 22 Apr 2024 23:55:43 +0000 (07:55 +0800)]
Fix queue test (#30646)

Fix #30643

The old test code is not stable due to the data-race described in the
TODO added at that time.

Make it stable, and remove a debug-only field from old test code.

5 months agoEnable jquery-related eslint rules that have no violations (#30632)
silverwind [Mon, 22 Apr 2024 14:24:47 +0000 (16:24 +0200)]
Enable jquery-related eslint rules that have no violations (#30632)

All these have no violations, so enable them.

5 months agoEnable more `revive` linter rules (#30608)
silverwind [Mon, 22 Apr 2024 11:48:42 +0000 (13:48 +0200)]
Enable more `revive` linter rules (#30608)

Noteable additions:

- `redefines-builtin-id` forbid variable names that shadow go builtins
- `empty-lines` remove unnecessary empty lines that `gofumpt` does not
remove for some reason
- `superfluous-else` eliminate more superfluous `else` branches

Rules are also sorted alphabetically and I cleaned up various parts of
`.golangci.yml`.

5 months agoRemove obsolete CSS text classes (#30576)
silverwind [Mon, 22 Apr 2024 11:21:06 +0000 (13:21 +0200)]
Remove obsolete CSS text classes (#30576)

- `.text-thin` and `.text-italic` are not present in CSS so were doing nothing and I removed them.
- `.text.middle` was unused so I removed it.
- `.text.italic` is replaced with `tw-italic`.
- `.text.normal` had exactly one use and it wasn't even needed.
- add a `muted` class to the link to `org_profile_avatar.tmpl`.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
5 months agoHide diff stats on empty PRs (#30629)
silverwind [Mon, 22 Apr 2024 10:48:14 +0000 (12:48 +0200)]
Hide diff stats on empty PRs (#30629)

When a PR is empty, e.g. has neither additions nor deletions, we don't
need to show this:

<img width="125" alt="Screenshot 2024-04-21 at 23 25 38"
src="https://github.com/go-gitea/gitea/assets/115237/0b987eb5-66f5-4b9b-b5aa-7e9e267e9b52">

5 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 22 Apr 2024 00:25:56 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

5 months agoUse correct hash for "git update-index" (#30626)
wxiaoguang [Mon, 22 Apr 2024 00:13:44 +0000 (08:13 +0800)]
Use correct hash for "git update-index" (#30626)

5 months agoFix repo home UI when there is no repo description (#30552)
wxiaoguang [Sun, 21 Apr 2024 23:47:31 +0000 (07:47 +0800)]
Fix repo home UI when there is no repo description (#30552)

Fix #30502 by a new approach.

![image](https://github.com/go-gitea/gitea/assets/2114189/22f48bca-82d1-45cc-b1b7-ee2344b81a76)

5 months agoFix dropdown text ellipsis (#30628)
wxiaoguang [Sun, 21 Apr 2024 23:14:33 +0000 (07:14 +0800)]
Fix dropdown text ellipsis (#30628)

Follow
https://github.com/go-gitea/gitea/pull/30547#discussion_r1573866519

Fix #30624

The Fomantic UI Dropdown wasn't designed to work that way, its "text"
element might contain images. So the "overflow" shouldn't be added to
any general dropdown text.

![image](https://github.com/go-gitea/gitea/assets/2114189/f6ceaabd-bc89-4bf2-baa2-a6f0324c1962)

5 months agofix(api): refactor branch and tag existence checks (#30618)
Bo-Yi Wu [Sun, 21 Apr 2024 22:19:59 +0000 (06:19 +0800)]
fix(api): refactor branch and tag existence checks (#30618)

- Update branch existence check to also include tag existence check
- Adjust error message for branch/tag existence check

ref: https://github.com/go-gitea/gitea/pull/30349

---------

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoAdd --skip-db option to dump command (#30613)
Kemal Zebari [Sun, 21 Apr 2024 21:32:12 +0000 (14:32 -0700)]
Add --skip-db option to dump command (#30613)

Attempts to resolve #28720.

---

Note that I am not a Gitea administrator so I don't normally use the
gitea CLI. Just saw this issue and wanted an opportunity to understand
how this subcommand works and see if I can add this feature :^)

I tested both with `--skip-db` and without and it appears to not add any
database-specific files to the generated archive i.e. I don't see a
`gitea-db.sql` or `gitea.db` file:
```console
$ TAGS="bindata sqlite sqlite_unlock_notify" make backend
Running go generate...
bindata for migration already up-to-date
bindata for options already up-to-date
bindata for public already up-to-date
bindata for templates already up-to-date
$ ./gitea dump --skip-db
2024/04/20 01:16:11 ...s/setting/session.go:77:loadSessionFrom() [I] Session Service Enabled
2024/04/20 01:16:11 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/attachments
2024/04/20 01:16:11 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/avatars
2024/04/20 01:16:11 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/repo-avatars
2024/04/20 01:16:11 ...s/storage/storage.go:186:initLFS() [I] Initialising LFS storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/lfs
2024/04/20 01:16:11 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/repo-archive
2024/04/20 01:16:11 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/packages
2024/04/20 01:16:11 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/actions_log
2024/04/20 01:16:11 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local
2024/04/20 01:16:11 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /workspaces/gitea/data/actions_artifacts
2024/04/20 01:16:11 cmd/dump.go:172:runDump() [I] Dumping local repositories... /workspaces/gitea/data/gitea-repositories
2024/04/20 01:16:11 cmd/dump.go:195:runDump() [I] Skipping database
2024/04/20 01:16:11 cmd/dump.go:229:runDump() [I] Adding custom configuration file from /workspaces/gitea/custom/conf/app.ini
2024/04/20 01:16:11 cmd/dump.go:256:runDump() [I] Packing data directory.../workspaces/gitea/data
2024/04/20 01:16:11 cmd/dump.go:335:runDump() [I] Finish dumping in file /workspaces/gitea/gitea-dump-1713575771.zip
$ unzip /workspaces/gitea/gitea-dump-1713575771.zip -d example
Archive:  /workspaces/gitea/gitea-dump-1713575771.zip
. . .
$ ls example/
app.ini  custom  data  repos
$ ls example/data/
actions_artifacts  actions_log  avatars  home  indexers  jwt  queues  repo-archive  repo-avatars  tmp
```

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoFix flash on dashboard (#30572)
silverwind [Sun, 21 Apr 2024 20:24:56 +0000 (22:24 +0200)]
Fix flash on dashboard (#30572)

Fixes https://github.com/go-gitea/gitea/issues/30566, regression from
https://github.com/go-gitea/gitea/pull/30214.

5 months agochore: use errors.New to replace fmt.Errorf with no parameters will much better ...
Cheng [Sun, 21 Apr 2024 19:44:03 +0000 (03:44 +0800)]
chore: use errors.New to replace fmt.Errorf with no parameters will much better (#30621)

use errors.New to replace fmt.Errorf with no parameters will much better

5 months agoFix issue comment form and quick-submit (#30623)
wxiaoguang [Sun, 21 Apr 2024 17:00:04 +0000 (01:00 +0800)]
Fix issue comment form and quick-submit (#30623)

1. Rewrite initGlobalEnterQuickSubmit (by the way, remove jQuery)
2. Fix issue comment form layout

5 months agoUse maintained gziphandler (#30592)
Lunny Xiao [Sun, 21 Apr 2024 00:53:45 +0000 (08:53 +0800)]
Use maintained gziphandler (#30592)

Replace #27894

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
5 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 21 Apr 2024 00:26:57 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

5 months agoFix package list performance (#30520)
KN4CK3R [Sat, 20 Apr 2024 11:07:00 +0000 (13:07 +0200)]
Fix package list performance (#30520)

Fixes #28255

The new query uses the id field to sort by "newer". This most not be
correct (usually it is) but it's faster (see #28255).
If someone has a better idea, please propose changes.

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoClarify permission "HasAccess" behavior (#30585)
wxiaoguang [Sat, 20 Apr 2024 03:15:04 +0000 (11:15 +0800)]
Clarify permission "HasAccess" behavior (#30585)

Follow #30495

"HasAccess" behavior wasn't clear, to make it clear:

* Use a new name `HasAnyUnitAccess`, it will be easier to review related
code and permission problems.
* Separate everyone access mode to a separate field, then all calls to
HasAccess are reverted to old behavior before #30495.
* Add new tests.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoFix links in PyPI Simple Repository API page (#30594)
wxiaoguang [Sat, 20 Apr 2024 01:15:14 +0000 (09:15 +0800)]
Fix links in PyPI Simple Repository API page (#30594)

Thanks to @Zottelchen for looking into problem and proposing the fix.

Ref: https://github.com/astral-sh/uv/issues/3017 ,
https://peps.python.org/pep-0503/

This PR's change is from Zottelchen's work.

And I by the way rename the `$p` to `$pd` because `p` is used as
"package" in code, while `pd` is used as "package description".

----

Co-authored-by: Zottelchen
5 months agoUse action user as the trigger user of schedules (#30581)
yp05327 [Sat, 20 Apr 2024 00:35:29 +0000 (09:35 +0900)]
Use action user as the trigger user of schedules (#30581)

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

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

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

---------

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoFix commit file status parser (#30602)
wxiaoguang [Fri, 19 Apr 2024 14:41:03 +0000 (22:41 +0800)]
Fix commit file status parser (#30602)

Try to fix  #30492

5 months agoFix HEAD method for robots.txt (#30603)
wxiaoguang [Fri, 19 Apr 2024 13:43:56 +0000 (21:43 +0800)]
Fix HEAD method for robots.txt (#30603)

Fix #30601

5 months agoFix project description rendering for org (#30587)
wxiaoguang [Fri, 19 Apr 2024 07:58:56 +0000 (15:58 +0800)]
Fix project description rendering for org (#30587)

Fix #30263

![image](https://github.com/go-gitea/gitea/assets/2114189/41cabe6c-f94a-4874-a26f-d01bb89bb28c)

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoFix changelog (main) (#30582)
wxiaoguang [Fri, 19 Apr 2024 06:08:30 +0000 (14:08 +0800)]
Fix changelog (main) (#30582)

1. The 1.21.11 changelog is missing
2. Split the old content to CHANGELOG-archived.md, to reduce the size of
CHANGELOG.md

5 months agoAvoid importing `modules/web/middleware` in `modules/session` (#30584)
Jason Song [Fri, 19 Apr 2024 04:03:53 +0000 (12:03 +0800)]
Avoid importing `modules/web/middleware` in `modules/session` (#30584)

Related to #30375.

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

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

5 months agoEnable npm cache on `setup-node` action (#30577)
silverwind [Fri, 19 Apr 2024 03:29:08 +0000 (05:29 +0200)]
Enable npm cache on `setup-node` action (#30577)

Enable npm dependency cache in
[setup-node](https://github.com/actions/setup-node). This should work
reliably and across branches as well.

5 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 19 Apr 2024 00:24:35 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

5 months agoMock queue backoff duration (#30553)
wxiaoguang [Thu, 18 Apr 2024 20:00:59 +0000 (04:00 +0800)]
Mock queue backoff duration (#30553)

During testing, the backoff duration shouldn't be longer than other
durations

5 months agoImprove "Reference in new issue" modal (#30547)
silverwind [Thu, 18 Apr 2024 19:31:53 +0000 (21:31 +0200)]
Improve "Reference in new issue" modal (#30547)

Fixes: https://github.com/go-gitea/gitea/issues/29994
Also some misc enhancements done to the form in the modal.

<img width="840" alt="Screenshot 2024-04-17 at 23 02 55"
src="https://github.com/go-gitea/gitea/assets/115237/e71fba55-55cd-4e48-a497-6b1025c36a43">

5 months agoAdd a few root files to lint-spell (#30530)
silverwind [Thu, 18 Apr 2024 18:54:40 +0000 (20:54 +0200)]
Add a few root files to lint-spell (#30530)

Files in root were not linted, add them. No new violations.

5 months agoRefactor and fix archive link bug (#30535)
wxiaoguang [Thu, 18 Apr 2024 16:45:50 +0000 (00:45 +0800)]
Refactor and fix archive link bug (#30535)

Regression of #29920
Fixes: #30569
Also this is a rewriting to eliminate the remaining jQuery usages from code.

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoFixup app.example.ini for task section, which is now queue.task (#30555)
Jerry Jacobs [Thu, 18 Apr 2024 11:22:06 +0000 (13:22 +0200)]
Fixup app.example.ini for task section, which is now queue.task (#30555)

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

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
5 months agoSome following up changes for routes (#30550)
wxiaoguang [Thu, 18 Apr 2024 09:36:19 +0000 (17:36 +0800)]
Some following up changes for routes (#30550)

1. Switch back to the old order for `reqRepoAdmin, context.RepoRef()`
2. Add a routing function info for global NotFound

5 months agoAdd form field id generation, remove duplicated ids (#30546)
silverwind [Thu, 18 Apr 2024 09:01:06 +0000 (11:01 +0200)]
Add form field id generation, remove duplicated ids (#30546)

Fixes: https://github.com/go-gitea/gitea/issues/30384
On repo settings page, there id `repo_name` was used 5 times on the same
page, some in modal and such. I think we are better off just
auto-generating these IDs in the future so that labels link up with
their form element.

Ideally this id generation would be done in backend in a subtemplate,
but seeing that we already have similar JS patches for checkboxes, I
took the easy path for now.

I also checked that these `#repo_name` were not in use in JS and the
only case where this id appears in JS is on the migration page where
it's still there.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoFix border-radius on view, blame and code search (#30545)
silverwind [Thu, 18 Apr 2024 08:34:23 +0000 (10:34 +0200)]
Fix border-radius on view, blame and code search (#30545)

Fixes: https://github.com/go-gitea/gitea/issues/30540
1. Fix all these boxes by adding `bottom attached` and removing a
problematic CSS rule:

<img width="1319" alt="Screenshot 2024-04-17 at 22 25 31"
src="https://github.com/go-gitea/gitea/assets/115237/346445a4-4944-4003-a1ef-6f5b0eda624e">
<img width="643" alt="Screenshot 2024-04-17 at 22 21 18"
src="https://github.com/go-gitea/gitea/assets/115237/10f17ed3-9ad6-48de-92fa-bac6621815b9">

2. Change the "last commit" box to `ui segment` which has correct
border-radius. Also included is a tiny tweak to make author name ellipse
instead of wrap.

<img width="1331" alt="Screenshot 2024-04-17 at 22 23 23"
src="https://github.com/go-gitea/gitea/assets/115237/285fbd45-ced0-4d33-abe3-7384ffa03188">

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoDisable enter key for accepting code completion in Monaco (#30548)
silverwind [Thu, 18 Apr 2024 08:06:56 +0000 (10:06 +0200)]
Disable enter key for accepting code completion in Monaco (#30548)

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

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoAdd an api test for updating user (#30539)
Lunny Xiao [Thu, 18 Apr 2024 03:16:20 +0000 (11:16 +0800)]
Add an api test for updating user (#30539)

Fix #30518

5 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 18 Apr 2024 00:26:04 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

5 months agoExpose fuzzy search for issues/pulls (#29701)
6543 [Thu, 18 Apr 2024 00:16:52 +0000 (02:16 +0200)]
Expose fuzzy search for issues/pulls (#29701)

close  #29685

---------

Signed-off-by: 6543 <6543@obermui.de>
Co-authored-by: silverwind <me@silverwind.io>
5 months agoAllow everyone to read or write a wiki by a repo unit setting (#30495)
wxiaoguang [Wed, 17 Apr 2024 15:58:37 +0000 (23:58 +0800)]
Allow everyone to read or write a wiki by a repo unit setting (#30495)

Replace #6312
Help #5833
Wiki solution for #639

5 months agoSupport nuspec manifest download for nuget packages (#28921)
Michael Kriese [Wed, 17 Apr 2024 15:30:41 +0000 (17:30 +0200)]
Support nuspec manifest download for nuget packages (#28921)

Support downloading nuget nuspec manifest[^1]. This is useful for
renovate because it uses this api to find the corresponding repository

- Store nuspec along with nupkg on upload
- allow downloading nuspec
- add doctor command to add missing nuspec files

[^1]:
https://learn.microsoft.com/en-us/nuget/api/package-base-address-resource#download-package-manifest-nuspec

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
5 months agoFix branch_protection api shows users/teams who has no readAccess (#30291)
Edward Zhang [Wed, 17 Apr 2024 13:24:07 +0000 (21:24 +0800)]
Fix branch_protection api shows users/teams who has no readAccess (#30291)

Add some logic in `convert.ToBranchProtection` to return only the names
associated with readAccess instead of returning all names. This will
ensure consistency in behavior between the frontend and backend.
Fixes: #27694
---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: wenzhuo.zhang <wenzhuo.zhang@geely.com>
Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoCorrect locale string rendering (#30522)
wxiaoguang [Wed, 17 Apr 2024 10:24:08 +0000 (18:24 +0800)]
Correct locale string rendering (#30522)

Since #29165, the translations are rendered as HTML in templates, so:

1. if the translation does contain `<>`, use `TrString`
2. use `{dummy}` instead of `<dummy>` as much as possible

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoRun `go generate` and `go vet` on all packages (#30529)
silverwind [Wed, 17 Apr 2024 09:40:35 +0000 (11:40 +0200)]
Run `go generate` and `go vet` on all packages (#30529)

Fixes: https://github.com/go-gitea/gitea/issues/30512
I think this does mean those tools would run on a potential `vendor`
directory, but I'm not sure we really support vendoring of dependencies
anymore.

`release` has a `vendor` prerequisite so likely the source tarballs
contain vendor files?

5 months agoFix and tweak pull request commit list (#30528)
silverwind [Wed, 17 Apr 2024 08:58:08 +0000 (10:58 +0200)]
Fix and tweak pull request commit list (#30528)

Fixes https://github.com/go-gitea/gitea/issues/30493, regression from
https://github.com/go-gitea/gitea/pull/30374.

Also did the flexbox convertion as suggested by the existing comment.

<img width="850" alt="Screenshot 2024-04-16 at 22 28 48"
src="https://github.com/go-gitea/gitea/assets/115237/e8905944-620a-4211-b5c5-53ed3b3ee23e">

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoRefactor web routes (#30519)
wxiaoguang [Wed, 17 Apr 2024 08:31:37 +0000 (16:31 +0800)]
Refactor web routes (#30519)

Re-organize the routes in web.go and use ctx constants instead of `context.UnitTypes()`

---------

Co-authored-by: Giteabot <teabot@gitea.io>
5 months agoFix install page checkboxes and dropdown width (#30526)
silverwind [Wed, 17 Apr 2024 07:30:46 +0000 (09:30 +0200)]
Fix install page checkboxes and dropdown width (#30526)

Fixes: https://github.com/go-gitea/gitea/issues/30523
1. Fix checkbox rendering
2. Fix width of selection dropdowns (was too small)

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
6 months agoReduce unnecessary database queries on actions table (#30509)
Lunny Xiao [Wed, 17 Apr 2024 01:25:03 +0000 (09:25 +0800)]
Reduce unnecessary database queries on actions table (#30509)

6 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 17 Apr 2024 00:24:47 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

6 months agoTweak and fix toggle checkboxes (#30527)
silverwind [Tue, 16 Apr 2024 22:39:19 +0000 (00:39 +0200)]
Tweak and fix toggle checkboxes (#30527)

Fixes: https://github.com/go-gitea/gitea/issues/30524. Slightly restyled
them so that the "knob" is contained inside the background.

<img width="179" alt="Screenshot 2024-04-16 at 21 58 09"
src="https://github.com/go-gitea/gitea/assets/115237/be94517b-9cb7-46e2-ae96-fcf6767ce4ba">
<img width="187" alt="Screenshot 2024-04-16 at 21 58 50"
src="https://github.com/go-gitea/gitea/assets/115237/c13a1959-5c5a-4e88-9225-e5f6fb72e3e0">

6 months agoTweak repo buttons on mobile and labeled button border-radius (#30503)
silverwind [Tue, 16 Apr 2024 15:46:12 +0000 (17:46 +0200)]
Tweak repo buttons on mobile and labeled button border-radius (#30503)

Fixes: https://github.com/go-gitea/gitea/issues/30514
Fixes:
https://github.com/go-gitea/gitea/pull/30288#issuecomment-2057466623

- Fix border-radius regression from
https://github.com/go-gitea/gitea/pull/30475
- Fix and simplify hover state
- Move the modal HTML so it does not interfere with the CSS
- Make the star and unwatch text show on mobile. There is still plenty
of space, below is iPhone 12 viewport size

<img width="696" alt="Screenshot 2024-04-15 at 20 34 03"
src="https://github.com/go-gitea/gitea/assets/115237/af90bb00-4671-4973-a255-8eb44ee6ba8d">
<img width="230" alt="Screenshot 2024-04-15 at 20 31 42"
src="https://github.com/go-gitea/gitea/assets/115237/986ef533-7a01-4bb0-8dcd-fd19e4259e84">
<img width="233" alt="Screenshot 2024-04-15 at 20 31 47"
src="https://github.com/go-gitea/gitea/assets/115237/5b825dd8-0ccc-4d56-9d8f-774abb935b68">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
6 months agoFix long branch name overflows (#30345)
silverwind [Tue, 16 Apr 2024 08:52:45 +0000 (10:52 +0200)]
Fix long branch name overflows (#30345)

Fixes: https://github.com/go-gitea/gitea/issues/27971
Fixes: https://github.com/go-gitea/gitea/pull/28010
<img width="689" alt="Screenshot 2024-04-09 at 00 19 57"
src="https://github.com/go-gitea/gitea/assets/115237/7c895a47-274f-40a6-a126-290658f1982d">

Also fixes a similar issue in issue list where CSS was there but not
active because of missing `display: block`.

<img width="372" alt="Screenshot 2024-04-09 at 00 18 25"
src="https://github.com/go-gitea/gitea/assets/115237/cfbee7cd-2e15-4ac7-96ce-020816f48798">

6 months agoUpdate API to return 'source_id' for users (#29718)
Tobias Balle-Petersen [Tue, 16 Apr 2024 06:08:48 +0000 (08:08 +0200)]
Update API to return 'source_id' for users (#29718)

Using the API, a user's _source_id_ can be set in the _CreateUserOption_
model, but the field is not returned in the _User_ model.

This PR updates the _User_ model to include the field _source_id_ (The
ID of the Authentication Source).

6 months agoAllow `preferred_username` as username source for OIDC (#30454)
SimonErm [Tue, 16 Apr 2024 05:41:39 +0000 (07:41 +0200)]
Allow `preferred_username` as username source for OIDC (#30454)

This PR adds the preferred_username claim as a possible username source
for the oauth2_client.

Closes #21518

6 months agoFix empty field `login_name` in API response JSON when creating user (#30511)
yp05327 [Tue, 16 Apr 2024 05:13:00 +0000 (14:13 +0900)]
Fix empty field `login_name` in API response JSON when creating user (#30511)

Fix #30508

ps: if `sourceID` is not set, `LoginName` will be ignored

6 months agofeat(api): implement branch/commit comparison API (#30349)
Bo-Yi Wu [Tue, 16 Apr 2024 03:45:04 +0000 (11:45 +0800)]
feat(api): implement branch/commit comparison API (#30349)

- Add new `Compare` struct to represent comparison between two commits
- Introduce new API endpoint `/compare/*` to get commit comparison
information
- Create new file `repo_compare.go` with the `Compare` struct definition
- Add new file `compare.go` in `routers/api/v1/repo` to handle
comparison logic
- Add new file `compare.go` in `routers/common` to define `CompareInfo`
struct
- Refactor `ParseCompareInfo` function to use `common.CompareInfo`
struct
- Update Swagger documentation to include the new API endpoint for
commit comparison
- Remove duplicate `CompareInfo` struct from
`routers/web/repo/compare.go`
- Adjust base path in Swagger template to be relative (`/api/v1`)

GitHub API
https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
6 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 16 Apr 2024 00:23:51 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

6 months agoFix various overflows on actions view (#30344)
silverwind [Mon, 15 Apr 2024 19:46:52 +0000 (21:46 +0200)]
Fix various overflows on actions view (#30344)

Fix a number of text overflow issues in actions view and run list. Also
improve mobile view of run list.

Fixes: https://github.com/go-gitea/gitea/issues/30328
<img width="782" alt="Screenshot 2024-04-08 at 23 10 16"
src="https://github.com/go-gitea/gitea/assets/115237/3d9f9f88-3eab-44a0-8144-30c2b58b24cb">
<img width="935" alt="Screenshot 2024-04-08 at 23 17 46"
src="https://github.com/go-gitea/gitea/assets/115237/581d73ea-a31d-416b-be3a-47313b879b12">
<img width="1008" alt="Screenshot 2024-04-08 at 23 49 05"
src="https://github.com/go-gitea/gitea/assets/115237/c5d10565-f285-477f-8659-1caf94797647">
<img width="397" alt="Screenshot 2024-04-08 at 23 55 30"
src="https://github.com/go-gitea/gitea/assets/115237/368aaa75-1903-4058-9d75-d1fe91c564d6">

6 months agoConvert max file name length to 255 (#30489)
yp05327 [Mon, 15 Apr 2024 19:08:31 +0000 (04:08 +0900)]
Convert max file name length to 255 (#30489)

Quick/Partly fix #29907

In Linux and MacOS, by default the max file name length is 255.
In windows, it depends on the version and settings, and has no file name
length limitation, but has path length limitation.
By default it is 260, considering path length is longer than filename,
so I think it is ok to do this.

For Windows, see
https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
For Linux, see
https://github.com/torvalds/linux/blob/master/include/uapi/linux/limits.h#L12-L13
For MacOS, see
https://discussions.apple.com/thread/254788848?sortBy=best

6 months agoRemove active border on pointing menu (#30486)
silverwind [Mon, 15 Apr 2024 18:22:53 +0000 (20:22 +0200)]
Remove active border on pointing menu (#30486)

It looks better when these menus don't flash a border-bottom on click.

6 months agoFix button color on red and green buttons (#30500)
silverwind [Mon, 15 Apr 2024 17:20:32 +0000 (19:20 +0200)]
Fix button color on red and green buttons (#30500)

Previously these colors were provided by fomantic css. I missed them.

Fixes: https://github.com/go-gitea/gitea/issues/30499
Regressed by: https://github.com/go-gitea/gitea/pull/30475

6 months agoFix code owners will not be mentioned when a pull request comes from a forked reposit...
Lunny Xiao [Mon, 15 Apr 2024 14:11:07 +0000 (22:11 +0800)]
Fix code owners will not be mentioned when a pull request comes from a forked repository (#30476)

Fix #30277
Caused by #29783

6 months agoFix overflow on issue dependency (#30484)
silverwind [Mon, 15 Apr 2024 08:49:48 +0000 (10:49 +0200)]
Fix overflow on issue dependency (#30484)

Small tweak here to prevent this and likely other events from
overflowing in the timeline:

<img width="895" alt="Screenshot 2024-04-14 at 22 53 17"
src="https://github.com/go-gitea/gitea/assets/115237/001b4f6b-f649-44ff-b2f0-c8e0dedeb384">

Co-authored-by: Giteabot <teabot@gitea.io>
6 months agoKill all gitea processes before air build (#30477)
silverwind [Mon, 15 Apr 2024 08:24:36 +0000 (10:24 +0200)]
Kill all gitea processes before air build (#30477)

So it happened to me multiple times that air leaves zombie processes
after termination. I think ultimately it's some kind of bug in air, but
we can work around.

The change in the delay is unrelated to the zombie processes but seems
to help a bit with duplicate changes resulting in duplicate `make
generate` as seen here:

<img width="424" alt="Screenshot 2024-04-14 at 17 05 47"
src="https://github.com/go-gitea/gitea/assets/115237/6dd1d787-6be3-4fb2-8b0b-cd711c281793">

---------

Co-authored-by: delvh <dev.lh@web.de>
6 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 15 Apr 2024 02:40:53 +0000 (02:40 +0000)]
[skip ci] Updated licenses and gitignores

6 months agoRevert 100% label max-width (#30481)
silverwind [Mon, 15 Apr 2024 01:04:02 +0000 (03:04 +0200)]
Revert 100% label max-width (#30481)

Partial revert of https://github.com/go-gitea/gitea/pull/30479

It's causing problems at least here:
https://github.com/go-gitea/gitea/pull/30344#discussion_r1564895591

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
6 months agoImprove flex ellipsis (#30479)
wxiaoguang [Sun, 14 Apr 2024 19:43:30 +0000 (03:43 +0800)]
Improve flex ellipsis (#30479)

![image](https://github.com/go-gitea/gitea/assets/2114189/857794d8-2170-42be-a5bf-47ebacbafebd)

---------

Co-authored-by: silverwind <me@silverwind.io>
6 months agoRemove fomantic button module (#30475)
silverwind [Sun, 14 Apr 2024 17:53:52 +0000 (19:53 +0200)]
Remove fomantic button module (#30475)

CSS-only module. Button colors are reduced to this:

<img width="639" alt="Screenshot 2024-04-14 at 15 36 07"
src="https://github.com/go-gitea/gitea/assets/115237/882d6c02-d1de-44f2-b707-db02a9f5070d">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
6 months agoImprove "must-change-password" logic and document (#30472)
wxiaoguang [Sun, 14 Apr 2024 17:22:14 +0000 (01:22 +0800)]
Improve "must-change-password" logic and document (#30472)

Unify the behaviors of "user create" and "user change-password".

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
6 months agoFix commitstatus summary (#30431)
Lunny Xiao [Sun, 14 Apr 2024 12:16:54 +0000 (20:16 +0800)]
Fix commitstatus summary (#30431)

The target_url is necessary for the UI, but missed in
commit_status_summary table. This PR fix it.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
6 months agoRemove fomantic menu module (#30325)
silverwind [Sun, 14 Apr 2024 11:43:46 +0000 (13:43 +0200)]
Remove fomantic menu module (#30325)

A lot of variants are in use, so the diff stat isn't so great.

Co-authored-by: Giteabot <teabot@gitea.io>