]> source.dussan.org Git - gitea.git/log
gitea.git
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 7 Jul 2024 00:29:37 +0000 (00:29 +0000)]
[skip ci] Updated translations via Crowdin

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 6 Jul 2024 00:26:24 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoAllow force push to protected branches (#28086)
Henry Goodman [Fri, 5 Jul 2024 18:21:56 +0000 (04:21 +1000)]
Allow force push to protected branches (#28086)

Fixes #22722

### Problem
Currently, it is not possible to force push to a branch with branch
protection rules in place. There are often times where this is necessary
(CI workflows/administrative tasks etc).

The current workaround is to rename/remove the branch protection,
perform the force push, and then reinstate the protections.

### Solution
Provide an additional section in the branch protection rules to allow
users to specify which users with push access can also force push to the
branch. The default value of the rule will be set to `Disabled`, and the
UI is intuitive and very similar to the `Push` section.

It is worth noting in this implementation that allowing force push does
not override regular push access, and both will need to be enabled for a
user to force push.

This applies to manual force push to a remote, and also in Gitea UI
updating a PR by rebase (which requires force push)

This modifies the `BranchProtection` API structs to add:
- `enable_force_push bool`
- `enable_force_push_whitelist bool`
- `force_push_whitelist_usernames string[]`
- `force_push_whitelist_teams string[]`
- `force_push_whitelist_deploy_keys bool`

### Updated Branch Protection UI:

<img width="943" alt="image"
src="https://github.com/go-gitea/gitea/assets/79623665/7491899c-d816-45d5-be84-8512abd156bf">

### Pull Request `Update branch by Rebase` option enabled with source
branch `test` being a protected branch:

![image](https://github.com/go-gitea/gitea/assets/79623665/e018e6e9-b7b2-4bd3-808e-4947d7da35cc)
<img width="1038" alt="image"
src="https://github.com/go-gitea/gitea/assets/79623665/57ead13e-9006-459f-b83c-7079e6f4c654">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoRefactor login page (#31530)
Anbraten [Fri, 5 Jul 2024 17:10:09 +0000 (19:10 +0200)]
Refactor login page (#31530)

As requested in
https://github.com/go-gitea/gitea/pull/31504#issuecomment-2196196646.
This PR refactor the login page:

![Screenshot from 2024-07-04
19-23-10](https://github.com/go-gitea/gitea/assets/6918444/c45700f4-6747-473c-bdee-2156718a7953)

![Screenshot from 2024-07-04
19-23-21](https://github.com/go-gitea/gitea/assets/6918444/b1bf71cf-85f9-4517-a409-cc6d72e6af8f)

![Screenshot from 2024-06-30
09-35-20](https://github.com/go-gitea/gitea/assets/6918444/728cc37e-0cca-4883-afec-a43663d2c666)

# Changes
- [x] use separate box for passkey login and go to registration
- [x] move forgot passoword next to password label
- [x] fix password required label `*` and padding
- [x] remove tabs from login page

---------

Co-authored-by: silverwind <me@silverwind.io>
3 months agoFix slow patch checking with commits that add or remove many files (#31548)
Brecht Van Lommel [Thu, 4 Jul 2024 18:57:11 +0000 (20:57 +0200)]
Fix slow patch checking with commits that add or remove many files (#31548)

Running git update-index for every individual file is slow, so add and
remove everything with a single git command.

When such a big commit lands in the default branch, it could cause PR
creation and patch checking for all open PRs to be slow, or time out
entirely. For example, a commit that removes 1383 files was measured to
take more than 60 seconds and timed out. With this change checking took
about a second.

This is related to #27967, though this will not help with commits that
change many lines in few files.

3 months agoAdd typescript guideline and typescript-specific eslint plugins and fix issues (...
silverwind [Wed, 3 Jul 2024 15:48:14 +0000 (17:48 +0200)]
Add typescript guideline and typescript-specific eslint plugins and fix issues (#31521)

1. Add some general guidelines how to write our typescript code
2. Add `@typescript-eslint/eslint-plugin`, general typescript rules
3. Add `eslint-plugin-deprecation` to detect deprecated code
4. Fix all new lint issues that came up

3 months agoUpdate `golang.org/x/image` to v0.18.0 (#31541)
silverwind [Tue, 2 Jul 2024 19:41:14 +0000 (21:41 +0200)]
Update `golang.org/x/image` to v0.18.0 (#31541)

Result of `go get -u  golang.org/x/image && make tidy`

Fixes: https://github.com/go-gitea/gitea/security/dependabot/67
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 1 Jul 2024 00:30:50 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoFix markdown preview $$ support (#31514)
charles [Sat, 29 Jun 2024 23:23:47 +0000 (07:23 +0800)]
Fix markdown preview $$ support (#31514)

close #31481

currently `$$A + B$$ test` will ignore text after $$ block

test text

![圖片](https://github.com/go-gitea/gitea/assets/30816317/39b2974b-c0b6-48a0-87d0-5f4a13615eed)

before fix

![圖片](https://github.com/go-gitea/gitea/assets/30816317/15469e4c-474d-4128-b46f-d6cadaafbd68)

after fix

![圖片](https://github.com/go-gitea/gitea/assets/30816317/c1025eef-177f-4ade-988f-510e7039f3f9)

github display

![圖片](https://github.com/go-gitea/gitea/assets/30816317/97cd1e10-ac94-4899-86d8-8e359ef1d694)

3 months agoAdd Passkey login support (#31504)
Anbraten [Sat, 29 Jun 2024 22:50:03 +0000 (00:50 +0200)]
Add Passkey login support (#31504)

closes #22015

After adding a passkey, you can now simply login with it directly by
clicking `Sign in with a passkey`.

![Screenshot from 2024-06-26
12-18-17](https://github.com/go-gitea/gitea/assets/6918444/079013c0-ed70-481c-8497-4427344bcdfc)

Note for testing. You need to run gitea using `https` to get the full
passkeys experience.

---------

Co-authored-by: silverwind <me@silverwind.io>
3 months agoUse stable version of fabric (#31526)
silverwind [Sat, 29 Jun 2024 15:37:18 +0000 (17:37 +0200)]
Use stable version of fabric (#31526)

Fabric 6 is [now
stable](https://github.com/fabricjs/fabric.js/releases/tag/v6.0.0-rc5),
use it.

3 months agoAlways use HTML attributes for avatar size (#31509)
silverwind [Fri, 28 Jun 2024 21:29:15 +0000 (23:29 +0200)]
Always use HTML attributes for avatar size (#31509)

Many avatars were rendered in HTML with certain width/height but then
resized again in CSS. This was pointless so I removed all these cases
and made the HTML size match the previous render size.

Also did a few CSS cleanups in the tribute rendering:

<img width="648" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/cb2fafb3-5e20-46e9-814f-07df20038beb">

3 months agoAdd initial typescript config and use it for eslint,vitest,playwright (#31186)
silverwind [Fri, 28 Jun 2024 16:15:51 +0000 (18:15 +0200)]
Add initial typescript config and use it for eslint,vitest,playwright (#31186)

This enables eslint to use the typescript parser and resolver which
brings some benefits that eslint rules now have type information
available and a tsconfig.json is required for the upcoming typescript
migration as well. Notable changes done:

- Add typescript parser and resolver
- Move the vue-specific config into the root file
- Enable `vue-scoped-css/enforce-style-type` rule, there was only one
violation and I added a inline disable there.
- Fix new lint errors that were detected because of the parser change
- Update `i/no-unresolved` to remove now-unnecessary workaround for the
resolver
- Disable `i/no-named-as-default` as it seems to raise bogus issues in
the webpack config
- Change vitest config to typescript
- Change playwright config to typescript
- Add `eslint-plugin-playwright` and fix issues
- Add `tsc` linting to `make lint-js`

3 months agoSupport legacy _links LFS batch responses (#31513)
Royce Remer [Fri, 28 Jun 2024 08:42:57 +0000 (01:42 -0700)]
Support legacy _links LFS batch responses (#31513)

Support legacy _links LFS batch response.

Fixes #31512.

This is backwards-compatible change to the LFS client so that, upon
mirroring from an upstream which has a batch api, it can download
objects whether the responses contain the `_links` field or its
successor the `actions` field. When Gitea must fallback to the legacy
`_links` field a logline is emitted at INFO level which looks like this:
```
...s/lfs/http_client.go:188:performOperation() [I] <LFSPointer ee95d0a27ccdfc7c12516d4f80dcf144a5eaf10d0461d282a7206390635cdbee:160> is using a deprecated batch schema response!
```

I've only run `test-backend` with this code, but added a new test to
cover this case. Additionally I have a fork with this change deployed
which I've confirmed syncs LFS from Gitea<-Artifactory (which has legacy
`_links`) as well as from Gitea<-Gitea (which has the modern `actions`).

Signed-off-by: Royce Remer <royceremer@gmail.com>
3 months agoFix JS error with disabled attachment and easymde (#31511)
silverwind [Fri, 28 Jun 2024 05:59:22 +0000 (07:59 +0200)]
Fix JS error with disabled attachment and easymde (#31511)

Not sure if this is a regression from
https://github.com/go-gitea/gitea/pull/30513, but when attachments are
disabled, `this.dropzone` is null and the code had failed in
`initEasyMDEPaste` trying to access `dropzoneEl.dropzone`.

3 months agoFix avatar radius problem on the new issue page (#31506)
charles [Thu, 27 Jun 2024 14:04:05 +0000 (22:04 +0800)]
Fix avatar radius problem on the new issue page (#31506)

Close #31502

Related to #31419.

In this PR, the avatar width is set to 3em, but the height is not set,
so the image is not squared.

When object-fit is set to contain, it can't maintain the radius of the
image.

Result:

![圖片](https://github.com/go-gitea/gitea/assets/30816317/bceb98aa-b0f7-4753-bc8b-3b9c41dfd55a)

3 months agoMake toast support preventDuplicates (#31501)
wxiaoguang [Thu, 27 Jun 2024 13:58:38 +0000 (21:58 +0800)]
Make toast support preventDuplicates (#31501)

make preventDuplicates default to true, users get a clear UI feedback
and know that "a new message appears".

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

Co-authored-by: silverwind <me@silverwind.io>
3 months agoImprove attachment upload methods (#30513)
Tyrone Yeh [Thu, 27 Jun 2024 09:31:49 +0000 (17:31 +0800)]
Improve attachment upload methods (#30513)

* Use dropzone to handle file uploading for all cases, including pasting
and dragging
* Merge duplicate code, use consistent behavior for link generating

Close #20130

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoRefactor issue label selection (#31497)
wxiaoguang [Wed, 26 Jun 2024 23:41:59 +0000 (07:41 +0800)]
Refactor issue label selection (#31497)

Follow #26460

3 months agoRefactor dropzone (#31482)
wxiaoguang [Wed, 26 Jun 2024 17:01:20 +0000 (01:01 +0800)]
Refactor dropzone (#31482)

Refactor the legacy code and remove some jQuery calls.

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 26 Jun 2024 00:26:17 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoOptimization of labels handling in issue_search (#26460)
Chl [Tue, 25 Jun 2024 17:09:13 +0000 (19:09 +0200)]
Optimization of labels handling in issue_search (#26460)

This PR enhances the labels handling in issue_search by optimizing the
SQL query and de-duplicate the IDs when generating the query string.

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
3 months agouse correct l10n string (#31487)
CyberFlame [Tue, 25 Jun 2024 14:54:18 +0000 (02:54 +1200)]
use correct l10n string (#31487)

Uses the correct string for searching - this is what it looks like prior
to the change:

![image](https://github.com/go-gitea/gitea/assets/24910512/38519825-c347-44d6-85d4-6fa3c71ddb7c)
(observe how the top box has "Search teams" even though collaborator
would be user

3 months agoFix overflow menu flickering on mobile (#31484)
Brecht Van Lommel [Tue, 25 Jun 2024 14:24:15 +0000 (16:24 +0200)]
Fix overflow menu flickering on mobile (#31484)

The overflow menu button was incorrectly included in the measurement of
the width of the items. As a result, it could get stuck in a loop
alternating between different measurements as the button appears and
disappears.

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 25 Jun 2024 00:26:08 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoFix poor table column width due to breaking words (#31473)
Brecht Van Lommel [Mon, 24 Jun 2024 17:48:43 +0000 (19:48 +0200)]
Fix poor table column width due to breaking words (#31473)

Caused by #31091

---------

Co-authored-by: silverwind <me@silverwind.io>
3 months agobump golang deps (#31422)
techknowlogick [Mon, 24 Jun 2024 13:26:42 +0000 (09:26 -0400)]
bump golang deps (#31422)

3 months agoDisable issue/PR comment button given empty input (#31463)
Kemal Zebari [Sun, 23 Jun 2024 18:41:01 +0000 (11:41 -0700)]
Disable issue/PR comment button given empty input (#31463)

Given an empty issue/PR comment, the comment history would not be
updated if the user were to submit it. Therefore, it would make since to
just disable the comment button when the text editor is empty.

This is inline with what GitHub does when given empty text editor input.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoSimplify 404/500 page (#31409)
wxiaoguang [Sun, 23 Jun 2024 17:45:21 +0000 (01:45 +0800)]
Simplify 404/500 page (#31409)

3 months agoFix web notification icon not updated once you read all notifications (#31447)
kiatt210 [Sun, 23 Jun 2024 07:50:10 +0000 (09:50 +0200)]
Fix web notification icon not updated once you read all notifications (#31447)

Fix #29065
Remove status filtering from GetUIDsAndNotificationCounts sql.

---------

Co-authored-by: kiatt210 <kiatt210@github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoSwitch to "Write" tab when edit comment again (#31445)
wxiaoguang [Sat, 22 Jun 2024 09:25:04 +0000 (17:25 +0800)]
Switch to "Write" tab when edit comment again (#31445)

Fix #19031

3 months agoAdd simple JS init performance trace (#31459)
wxiaoguang [Sat, 22 Jun 2024 09:20:20 +0000 (17:20 +0800)]
Add simple JS init performance trace (#31459)

Related to #23461, and help some cases like #31412

For developers, they could use browser's Performance tool to collect
performance data, while this PR is also quite handy to optimize the
`index.js`.

For end users, this PR is simple enough and could figure out the slow
function quickly.

![image](https://github.com/go-gitea/gitea/assets/2114189/a557b08e-6594-474b-81a3-03d5ac2bd68e)

3 months agoRefactor image diff (#31444)
wxiaoguang [Sat, 22 Jun 2024 04:52:09 +0000 (12:52 +0800)]
Refactor image diff (#31444)

And remove some jQuery functions

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 22 Jun 2024 00:25:47 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoSupport relative paths to videos from Wiki pages (#31061)
Sergey Sharybin [Fri, 21 Jun 2024 18:23:54 +0000 (20:23 +0200)]
Support relative paths to videos from Wiki pages (#31061)

This change fixes cases when a Wiki page refers to a video stored in the
Wiki repository using relative path. It follows the similar case which
has been already implemented for images.

Test plan:
- Create repository and Wiki page
- Clone the Wiki repository
- Add video to it, say `video.mp4`
- Modify the markdown file to refer to the video using `<video
src="video.mp4">`
- Commit the Wiki page
- Observe that the video is properly displayed

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoFix deprecated Dockerfile ENV format (#31450)
silverwind [Fri, 21 Jun 2024 15:08:42 +0000 (17:08 +0200)]
Fix deprecated Dockerfile ENV format (#31450)

See
https://docs.docker.com/reference/build-checks/legacy-key-value-format/.
Fixes these warnings seen during the docker build:

```
 4 warnings found (use --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 5)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 9)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 75)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 76)
 ```

Introduced in: https://github.com/moby/buildkit/pull/4923

3 months agoREADME Badge maintenance (#31441)
silverwind [Fri, 21 Jun 2024 13:18:39 +0000 (15:18 +0200)]
README Badge maintenance (#31441)

1. Remove tickgit badge, the service [only gives
errors](https://www.tickgit.com/browse?repo=github.com/go-gitea/gitea&branch=main)
and the repo [seems
unmaintained](https://github.com/augmentable-dev/tickgit).
2. Color the gitpod badge green because grey badges look odd.

3 months agoImprove markdown textarea for indentation and lists (#31406)
wxiaoguang [Fri, 21 Jun 2024 08:14:40 +0000 (16:14 +0800)]
Improve markdown textarea for indentation and lists (#31406)

Almost works like GitHub

* use Tab/Shift-Tab to indent/unindent the selected lines
* use Enter to insert a new line with the same indentation and prefix

3 months agoSplit common-global.js into separate files (#31438)
wxiaoguang [Fri, 21 Jun 2024 07:40:33 +0000 (15:40 +0800)]
Split common-global.js into separate files (#31438)

To improve maintainability

3 months agoFix the link for .git-blame-ignore-revs bypass (#31432)
wxiaoguang [Thu, 20 Jun 2024 23:28:34 +0000 (07:28 +0800)]
Fix the link for .git-blame-ignore-revs bypass (#31432)

A quick fix for #31429

3 months agoBump htmx to 2.0.0 (#31413)
Yarden Shoham [Thu, 20 Jun 2024 20:04:09 +0000 (23:04 +0300)]
Bump htmx to 2.0.0 (#31413)

Tested Subscribe, Follow, Star, Watch, and System Status.

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
3 months agoFix the wrong line number in the diff view page when expanded twice. (#31431)
charles [Thu, 20 Jun 2024 17:43:42 +0000 (01:43 +0800)]
Fix the wrong line number in the diff view page when expanded twice. (#31431)

close #31149, regression of #29385 (incorrect `data-query=`)

3 months agoFix labels and projects menu overflow on issue page (#31435)
Brecht Van Lommel [Thu, 20 Jun 2024 16:54:19 +0000 (18:54 +0200)]
Fix labels and projects menu overflow on issue page (#31435)

It was correct only on the new issue page.

Resolves #31415

3 months ago[Fix] Account Linking UpdateMigrationsByType (#31428)
Sumit [Thu, 20 Jun 2024 13:24:53 +0000 (18:54 +0530)]
[Fix] Account Linking UpdateMigrationsByType  (#31428)

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

3 months agoFix markdown math brackets render problem (#31420)
charles [Thu, 20 Jun 2024 02:12:54 +0000 (10:12 +0800)]
Fix markdown math brackets render problem (#31420)

Close #31371, support `($ ... $)` like GitHub

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoReduce `air` verbosity (#31417)
silverwind [Wed, 19 Jun 2024 19:42:06 +0000 (21:42 +0200)]
Reduce `air` verbosity (#31417)

Make `air` log less. Uses the option added in
https://github.com/air-verse/air/pull/367.

3 months agoFix new issue/pr avatar (#31419)
silverwind [Wed, 19 Jun 2024 16:19:59 +0000 (18:19 +0200)]
Fix new issue/pr avatar (#31419)

The avatar on "New Issue" and "New Pull Request" pages was inconsistent.
Removed the extra margin and the new CSS rules now use common parent
`<form id="#new-issue">` because `.repository.new.issue` is not present
on pull request page.

3 months agoIncrease max length of org team names from 30 to 255 characters (#31410)
Tobias Balle-Petersen [Wed, 19 Jun 2024 14:36:09 +0000 (16:36 +0200)]
Increase max length of org team names from 30 to 255 characters (#31410)

This PR modifies the structs for editing and creating org teams to allow
team names to be up to 255 characters. The previous maximum length was
30 characters.

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 19 Jun 2024 00:26:25 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoRefactor names (#31405)
wxiaoguang [Tue, 18 Jun 2024 22:32:45 +0000 (06:32 +0800)]
Refactor names (#31405)

This PR only does "renaming":

* `Route` should be `Router` (and chi router is also called "router")
* `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`)
* Use lower case for private functions to avoid exposing or abusing

3 months agoUpdate JS dependencies, remove `eslint-plugin-jquery` (#31402)
silverwind [Tue, 18 Jun 2024 08:10:30 +0000 (10:10 +0200)]
Update JS dependencies, remove `eslint-plugin-jquery` (#31402)

- Result of `make update-js`
- Added 1 new eslint rule
- Autofixed 1 new eslint issue
- Remove `eslint-plugin-jquery` as `eslint-plugin-no-jquery` does all it
does and is actually the maintained fork of it.
- Tested all affected `dependencies`

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoSwitch to upstream of `gorilla/feeds` (#31400)
Yarden Shoham [Tue, 18 Jun 2024 08:05:28 +0000 (11:05 +0300)]
Switch to upstream of `gorilla/feeds` (#31400)

They merged the PR we waited for.

- Reference: https://github.com/gorilla/feeds/pull/107
- Follows: https://github.com/go-gitea/gitea/pull/28860

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoFix rendered wiki page link (#31398)
wxiaoguang [Tue, 18 Jun 2024 03:09:20 +0000 (11:09 +0800)]
Fix rendered wiki page link (#31398)

Fix #31395

3 months agoRefactor repo unit "disabled" check (#31389)
wxiaoguang [Tue, 18 Jun 2024 00:51:13 +0000 (08:51 +0800)]
Refactor repo unit "disabled" check (#31389)

1. There are already global "unit consts", no need to use context data, which is fragile
2. Remove the "String()" method from "unit", it would only cause rendering problems in templates

---------

Co-authored-by: silverwind <me@silverwind.io>
3 months agoRefactor route path normalization (#31381)
wxiaoguang [Mon, 17 Jun 2024 23:28:47 +0000 (07:28 +0800)]
Refactor route path normalization (#31381)

Refactor route path normalization and decouple it from the chi router.
Fix the TODO, fix the legacy strange path behavior.

3 months agoRefactor markup code (#31399)
wxiaoguang [Mon, 17 Jun 2024 22:56:45 +0000 (06:56 +0800)]
Refactor markup code (#31399)

1. use clearer names
2. remove deadcode
3. avoid name shadowing
4. eliminate some lint warnings

3 months agoAdd cache test for admins (#31265)
6543 [Mon, 17 Jun 2024 19:22:39 +0000 (21:22 +0200)]
Add cache test for admins (#31265)

Add a test to probe the cache similar to the email test func.

![image](https://github.com/go-gitea/gitea/assets/24977596/700e2733-586d-4091-900f-f5f71e6e94bf)

![image](https://github.com/go-gitea/gitea/assets/24977596/2a953802-18fc-4e81-a37d-24ebe1297365)

![image](https://github.com/go-gitea/gitea/assets/24977596/e00d62ad-bb60-41cc-9138-09993daee156)

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: silverwind <me@silverwind.io>
3 months agoFix double border in system status table (#31363)
silverwind [Mon, 17 Jun 2024 13:21:59 +0000 (15:21 +0200)]
Fix double border in system status table (#31363)

Fix regression from https://github.com/go-gitea/gitea/pull/30712 where
the introduction of this `<div>` caused the `.ui.attached:not(.message)
+ .ui.attached.segment:not(.top)` CSS selector to no longer work and
cause a double border.

Before:

<img width="200" alt="Screenshot 2024-06-13 at 19 06 12"
src="https://github.com/go-gitea/gitea/assets/115237/a9fa0688-adf0-4b2d-a958-6a7679a62031">

After:
<img width="232" alt="Screenshot 2024-06-13 at 19 05 57"
src="https://github.com/go-gitea/gitea/assets/115237/025b780f-f72f-4049-86de-a5d84851bd1d">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoImprove rubygems package registry (#31357)
wxiaoguang [Mon, 17 Jun 2024 08:42:46 +0000 (16:42 +0800)]
Improve rubygems package registry (#31357)

To make it work with Bundler:
https://guides.rubygems.org/rubygems-org-compact-index-api/

It only adds 2 new API endpoints and improves some tests, existing logic
is not changed.

3 months agoFix natural sort (#31384)
wxiaoguang [Mon, 17 Jun 2024 06:45:12 +0000 (14:45 +0800)]
Fix natural sort (#31384)

Fix #31374

3 months agoFix missing images in editor preview due to wrong links (#31299)
Brecht Van Lommel [Mon, 17 Jun 2024 06:16:14 +0000 (08:16 +0200)]
Fix missing images in editor preview due to wrong links (#31299)

Parse base path and tree path so that media links can be correctly
created with /media/.

Resolves #31294

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 months agoAdd a simple test for AdoptRepository (#31391)
wxiaoguang [Mon, 17 Jun 2024 01:18:35 +0000 (09:18 +0800)]
Add a simple test for AdoptRepository (#31391)

Follow #31333

3 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 17 Jun 2024 00:27:39 +0000 (00:27 +0000)]
[skip ci] Updated licenses and gitignores

4 months agoFix JS error when creating new issue (#31383)
wxiaoguang [Sun, 16 Jun 2024 02:07:21 +0000 (10:07 +0800)]
Fix JS error when creating new issue (#31383)

Fix #31336

4 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 16 Jun 2024 00:28:50 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

4 months agoRename repo_model.SearchOrderByMap to repo_model.OrderByMap (#31359)
6543 [Sat, 15 Jun 2024 06:45:02 +0000 (08:45 +0200)]
Rename repo_model.SearchOrderByMap to repo_model.OrderByMap (#31359)

https://github.com/go-gitea/gitea/pull/30876#discussion_r1637112394

4 months agorm const do inline (#31360)
6543 [Sat, 15 Jun 2024 04:48:52 +0000 (06:48 +0200)]
rm const do inline (#31360)

https://github.com/go-gitea/gitea/pull/30876/files#r1637288202

4 months agoAllow downloading attachments of draft releases (#31369)
Zettat123 [Sat, 15 Jun 2024 04:20:14 +0000 (12:20 +0800)]
Allow downloading attachments of draft releases (#31369)

Fix #31362

4 months agoFix duplicate sub-path for avatars (#31365)
wxiaoguang [Sat, 15 Jun 2024 03:43:57 +0000 (11:43 +0800)]
Fix duplicate sub-path for avatars (#31365)

Fix #31361, and add tests

And this PR introduces an undocumented & debug-purpose-only config
option: `USE_SUB_URL_PATH`. It does nothing for end users, it only helps
the development of sub-path related problems.

And also fix #31366

Co-authored-by: @ExplodingDragon
4 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 15 Jun 2024 00:26:00 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

4 months agoAdd tag protection via rest api #17862 (#31295)
mzroot [Fri, 14 Jun 2024 16:56:10 +0000 (19:56 +0300)]
Add tag protection via rest api #17862 (#31295)

Add tag protection manage via rest API.

---------

Co-authored-by: Alexander Kogay <kogay.a@citilink.ru>
Co-authored-by: Giteabot <teabot@gitea.io>
4 months agoExtract and display readme and comments for Composer packages (#30927)
KN4CK3R [Fri, 14 Jun 2024 04:45:52 +0000 (06:45 +0200)]
Extract and display readme and comments for Composer packages (#30927)

Related #30075

CC @thojo0

Example with rendered readme:

![grafik](https://github.com/go-gitea/gitea/assets/1666336/3516fef5-2631-40fd-8841-5d9894ec8904)

4 months agoHave new announcement about docs contributions (#31364)
Lunny Xiao [Fri, 14 Jun 2024 03:17:05 +0000 (11:17 +0800)]
Have new announcement about docs contributions (#31364)

According to the maintainers' discussion and voting. We decide to move
docs to https://gitea.com/gitea/docs . Add some hints on this repository
to not make contributors confusing.

4 months agoFix bug filtering issues which have no project (#31337)
Lunny Xiao [Fri, 14 Jun 2024 02:31:07 +0000 (10:31 +0800)]
Fix bug filtering issues which have no project (#31337)

Fix #31327
This is a quick patch to fix the bug.
Some parameters are using 0, some are using -1. I think it needs a
refactor to keep consistent. But that will be another PR.

4 months agoRefactor to use UnsafeStringToBytes (#31358)
Oleksandr Redko [Fri, 14 Jun 2024 01:26:33 +0000 (04:26 +0300)]
Refactor to use UnsafeStringToBytes (#31358)

The PR replaces all `goldmark/util.BytesToReadOnlyString` with
`util.UnsafeBytesToString`, `goldmark/util.StringToReadOnlyBytes` with
`util.UnsafeStringToBytes`. This removes one `TODO`.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
4 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 14 Jun 2024 00:27:38 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

4 months agoFix PullRequestList.GetIssueIDs's logic (#31352)
yp05327 [Thu, 13 Jun 2024 09:42:07 +0000 (18:42 +0900)]
Fix PullRequestList.GetIssueIDs's logic  (#31352)

fix a bug from #30490

`prs.GetIssueIDs()` will also be used in other places, e.g.
`InvalidateCodeComments`
so we should not add `if pr.Issue == nil` in it, or if `pr.Issue` is
already loaded, you will not get the issueID in the results list and
this is not an expected result.

So this will caused a bug:
before calling `InvalidateCodeComments`, all `pr.Issues` in `prs` are
loaded, so `issueIDs` in this function will always be `[]`.

![image](https://github.com/go-gitea/gitea/assets/18380374/ef94d9d2-0bf9-455a-abd6-4d5e6497db7c)

4 months ago[Refactor] Unify repo search order by logic (#30876)
6543 [Thu, 13 Jun 2024 09:13:11 +0000 (11:13 +0200)]
[Refactor] Unify repo search order by logic (#30876)

have repo OrderBy definitions defined in one place and use a single type
for OrderBy database options

4 months agoFixed incorrect localization `explorer.go` (#31348)
Kerwin Bryant [Thu, 13 Jun 2024 01:43:41 +0000 (09:43 +0800)]
Fixed incorrect localization `explorer.go` (#31348)

see: https://github.com/go-gitea/gitea/pull/29701/files#r1637325139

4 months agoImprove detecting empty files (#31332)
wxiaoguang [Thu, 13 Jun 2024 01:06:46 +0000 (09:06 +0800)]
Improve detecting empty files (#31332)

Co-authored-by: silverwind <me@silverwind.io>
4 months agoFix hash render end with colon (#31319)
Lunny Xiao [Wed, 12 Jun 2024 22:35:46 +0000 (06:35 +0800)]
Fix hash render end with colon (#31319)

Fix a hash render problem like `<hash>: xxxxx` which is usually used in
release notes.

4 months agoFix line number widths (#31341)
silverwind [Wed, 12 Jun 2024 15:23:42 +0000 (17:23 +0200)]
Fix line number widths (#31341)

Fixes regression
https://github.com/go-gitea/gitea/pull/31307#issuecomment-2162554913

Table CSS is weird. A `auto` value does not work and causes the
regression while any pixel value causes another regression in diff where
the code lines do not stretch. Partially revert that PR and clean up
some related too-deep CSS selectors.

<img width="109" alt="Screenshot 2024-06-12 at 15 07 22"
src="https://github.com/go-gitea/gitea/assets/115237/756c5dea-44b8-49f9-8a08-acef68075f62">
<img width="119" alt="Screenshot 2024-06-12 at 15 07 43"
src="https://github.com/go-gitea/gitea/assets/115237/28ae1adc-118e-4016-8d09-033b9f1c9a6f">
<img width="151" alt="Screenshot 2024-06-12 at 15 07 07"
src="https://github.com/go-gitea/gitea/assets/115237/08db7ed9-de4e-405e-874d-c7ebe3082557">
<img width="141" alt="Screenshot 2024-06-12 at 15 07 14"
src="https://github.com/go-gitea/gitea/assets/115237/c4a5492b-1bf1-4773-bc8d-64eb36d823f9">

4 months agoFix navbar `+` menu flashing on page load (#31281)
silverwind [Wed, 12 Jun 2024 14:58:03 +0000 (16:58 +0200)]
Fix navbar `+` menu flashing on page load (#31281)

Fixes
https://github.com/go-gitea/gitea/pull/31273#issuecomment-2153771331.
Same method as used in https://github.com/go-gitea/gitea/pull/30215. All
left-opening dropdowns need to use it method.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
4 months agoReduce memory usage for chunked artifact uploads to MinIO (#31325)
Rowan Bohde [Wed, 12 Jun 2024 11:34:35 +0000 (06:34 -0500)]
Reduce memory usage for chunked artifact uploads to MinIO (#31325)

When using the MinIO storage driver for Actions Artifacts, we found that
the chunked artifact required significantly more memory usage to both
upload and merge than the local storage driver. This seems to be related
to hardcoding a value of `-1` for the size to the MinIO client [which
has a warning about memory usage in the respective
docs](https://pkg.go.dev/github.com/minio/minio-go/v7#Client.PutObject).
Specifying the size in both the upload and merge case reduces memory
usage of the MinIO client.

Co-authored-by: Kyle D <kdumontnu@gmail.com>
4 months agoFix dates displaying in a wrong manner when we're close to the end of the month ...
Yarden Shoham [Wed, 12 Jun 2024 10:27:00 +0000 (13:27 +0300)]
Fix dates displaying in a wrong manner when we're close to the end of the month (#31331)

I tested and all timestamps work as before.

- Reference https://github.com/github/relative-time-element/pull/285
- Fixes https://github.com/go-gitea/gitea/issues/31197

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
4 months agoFix adopt repository has empty object name in database (#31333)
Lunny Xiao [Wed, 12 Jun 2024 10:22:01 +0000 (18:22 +0800)]
Fix adopt repository has empty object name in database (#31333)

Fix #31330
Fix #31311

A workaround to fix the old database is to update object_format_name to
`sha1` if it's empty or null.

4 months agoOptimize profile layout to enhance visual experience (#31278)
Kerwin Bryant [Wed, 12 Jun 2024 04:06:12 +0000 (12:06 +0800)]
Optimize profile layout to enhance visual experience (#31278)

Co-authored-by: silverwind <me@silverwind.io>
4 months agoFix #31185 try fix lfs download from bitbucket failed (#31201)
Zoupers Zou [Tue, 11 Jun 2024 22:22:28 +0000 (06:22 +0800)]
Fix #31185 try fix lfs download from bitbucket failed (#31201)

Fix #31185

4 months agoEnable `unparam` linter (#31277)
silverwind [Tue, 11 Jun 2024 18:47:45 +0000 (20:47 +0200)]
Enable `unparam` linter (#31277)

Enable [unparam](https://github.com/mvdan/unparam) linter.

Often I could not tell the intention why param is unused, so I put
`//nolint` for those cases like webhook request creation functions never
using `ctx`.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
4 months agoMake template `Iif` exactly match `if` (#31322)
wxiaoguang [Tue, 11 Jun 2024 14:52:12 +0000 (22:52 +0800)]
Make template `Iif` exactly match `if` (#31322)

4 months agoupdate nix flake and add gofumpt (#31320)
6543 [Tue, 11 Jun 2024 13:47:13 +0000 (15:47 +0200)]
update nix flake and add gofumpt (#31320)

nix flake maintenance

4 months agocode optimization (#31315)
Kerwin Bryant [Tue, 11 Jun 2024 13:07:10 +0000 (21:07 +0800)]
code optimization (#31315)

Simplifying complex if-else to existing Iif operations

4 months agoFix line number width in code preview (#31307)
silverwind [Tue, 11 Jun 2024 04:54:39 +0000 (06:54 +0200)]
Fix line number width in code preview (#31307)

Line numbers were using some hacky CSS `width: 1%` that did nothing to
the code rendering as far as I can tell but broken the inline preview in
markup when line numbers are greater than 2 digits. Also I removed one
duplicate `font-family` rule (it is set below in the `.lines-num,
.lines-code` selector.

4 months agoDelete legacy cookie before setting new cookie (#31306)
wxiaoguang [Tue, 11 Jun 2024 03:31:23 +0000 (11:31 +0800)]
Delete legacy cookie before setting new cookie (#31306)

Try to fix #31202

4 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 11 Jun 2024 00:26:13 +0000 (00:26 +0000)]
[skip ci] Updated translations via Crowdin

4 months agoUse `querySelector` over alternative DOM methods (#31280)
silverwind [Mon, 10 Jun 2024 20:49:33 +0000 (22:49 +0200)]
Use `querySelector` over alternative DOM methods (#31280)

As per
https://github.com/go-gitea/gitea/pull/30115#discussion_r1626060164,
prefer `querySelector` by enabling
[`unicorn/prefer-query-selector`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-query-selector.md)
and autofixing all except 10 issues.

According to
[this](https://old.reddit.com/r/learnjavascript/comments/i0f5o8/performance_of_getelementbyid_vs_queryselector/),
querySelector may be faster as well, so it's a win-win.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
4 months agoRemove jQuery `.text()` (#30506)
silverwind [Mon, 10 Jun 2024 10:12:31 +0000 (12:12 +0200)]
Remove jQuery `.text()` (#30506)

Remove and forbid [.text()](https://api.jquery.com/text/). Tested some,
but not all functionality, but I think these are pretty safe
replacements.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
4 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 10 Jun 2024 00:27:20 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

4 months agoRemove sub-path from container registry realm (#31293)
wxiaoguang [Sun, 9 Jun 2024 08:29:29 +0000 (16:29 +0800)]
Remove sub-path from container registry realm (#31293)

Container registry requires that the "/v2" must be in the root, so the
sub-path in AppURL should be removed

4 months agoFix some URLs whose sub-path is missing (#31289)
wxiaoguang [Fri, 7 Jun 2024 15:15:17 +0000 (23:15 +0800)]
Fix some URLs whose sub-path is missing (#31289)

Fix #31285