Commit graph

16047 commits

Author SHA1 Message Date
6543 c0edb9b78b
Changelog for v1.19.4 (#25667) (#25709)
frontport  #25667
2023-07-05 20:25:13 +02:00
Lunny Xiao c930512f49
Remove feature label from feature request issue template (#25696)
We need a feature request process, so when a user submit a feature
proposal, it should not be marked as feature before it has been accept.
2023-07-05 16:58:56 +08:00
Lunny Xiao 90b3b3dbf8
Fix tags header and pretty format numbers (#25624)
This caused by #23465
2023-07-05 04:11:42 +00:00
silverwind e7495735d5
Fix position of org follow button (#25688)
This has recently regressed it seems. Put it back into same position as
https://github.com/go-gitea/gitea/pull/24345.
2023-07-04 23:41:46 -04:00
GiteaBot 3dbcbf7a1b [skip ci] Updated translations via Crowdin 2023-07-05 00:31:02 +00:00
silverwind 88f835192d
Replace interface{} with any (#25686)
Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`.

Basically the same [as golang did](2580d0e08d).
2023-07-04 18:36:08 +00:00
Denys Konovalov 00dbba7f42
Several fixes for mobile UI (#25634)
Resolves #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>
2023-07-04 17:45:45 +00:00
Lunny Xiao f35ea2b09a
Add elapsed time on debug for slow git commands (#25642)
To record which command is slow, this PR adds a debug log for slow git
operations.

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: delvh <dev.lh@web.de>
2023-07-04 16:22:37 +00:00
6543 934124c641
some less naked returns (#25682)
fix upcoming lint issues
2023-07-04 15:52:33 +00:00
delvh f4c1f43644
Prevent duplicate image loading (#25675)
Regression of #25672.
2023-07-04 14:43:02 +00:00
Earl Warren 43c9a84ae5
Add unit test for HashAvatar (#25662)
- Add 100% unit test for this function.

---------

Co-authored-by: Gusted <postmaster@gusted.xyz>
2023-07-04 12:43:38 +00:00
Zettat123 ff140d4050
Fix the nil pointer when assigning issues to projects (#25665)
Fixes #25649
Caused by #25468
2023-07-04 10:26:24 +00:00
silverwind 0006169f38
Actions list enhancements (#25601)
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>
2023-07-04 09:59:47 +00:00
Jason Song 9958642502
Fix issues indexer document mapping (#25619)
Fix regression of #5363 (so long ago).

The old code definded a document mapping for `issueIndexerDocType`, and
assigned it to `BleveIndexerData` as its type. (`BleveIndexerData` has
been renamed to `IndexerData` in #25174, but nothing more.) But the old
code never used `BleveIndexerData`, it wrote the index with an anonymous
struct type. Nonetheless, bleve would use the default auto-mapping for
struct it didn't know, so the indexer still worked. This means the
custom document mapping was always dead code.

The custom document mapping is not useless, it can reduce index storage,
this PR brings it back and disable default mapping to prevent it from
happening again. Since `IndexerData`(`BleveIndexerData`) has JSON tags,
and bleve uses them first, so we should use `repo_id` as the field name
instead of `RepoID`.

I did a test to compare the storage size before and after this, with
about 3k real comments that were migrated from some public repos.

Before:

```text
[ 160]  .
├── [  42]  index_meta.json
├── [  13]  rupture_meta.json
└── [ 128]  store
    ├── [6.9M]  00000000005d.zap
    └── [256K]  root.bolt
```

After:

```text
[ 160]  .
├── [  42]  index_meta.json
├── [  13]  rupture_meta.json
└── [ 128]  store
    ├── [3.5M]  000000000065.zap
    └── [256K]  root.bolt
```

It saves about half the storage space.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-07-04 09:05:28 +00:00
HesterG dae022ab2a
Fix show more for image on diff page (#25672)
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
2023-07-04 10:36:27 +02:00
silverwind 1195d66c15
Prevent SVG shrinking (#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.
2023-07-04 02:15:06 +00:00
Lunny Xiao 0403bd989f
Log the real reason when authentication fails (but don't show the user) (#25414) 2023-07-03 18:39:38 -04:00
Earl Warren ad57be04b8
Add unit test for repository collaboration (#25640)
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).


Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/825
Co-authored-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-07-03 21:41:14 +00:00
wxiaoguang eea58a5d55
Fix UI misalignment on user setting page (#25629)
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>
2023-07-03 20:38:06 +00:00
GiteaBot deb007ca2b [skip ci] Updated translations via Crowdin 2023-07-03 20:02:34 +00:00
Lunny Xiao 63622f8fb6
Correct translation wrong format (#25643)
partially fix #25291

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
2023-07-03 19:33:45 +00:00
KN4CK3R c890454769
Add direct serving of package content (#25543)
Fixes #24723

Direct serving of content aka HTTP redirect is not mentioned in any of
the package registry specs but lots of official registries do that so it
should be supported by the usual clients.
2023-07-03 15:33:28 +02:00
Lunny Xiao f1cb461c1f
Fix bug when change user name (#25637)
Fix #25621

Co-authored-by: Giteabot <teabot@gitea.io>
2023-07-03 12:05:59 +02:00
wxiaoguang 45bc180a15
Make "cancel" buttons have proper type in modal forms (#25618)
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.
2023-07-03 14:04:50 +08:00
wxiaoguang 2aa6a785cf
Make FindBranches have stable result (#25631)
See the comment
2023-07-03 04:11:32 +00:00
Lunny Xiao 7735da1c66
Display branch commit status (#25608)
Fix #10388

This PR adds a status icon for every branch which has a status check for
the latest commit on branch list page.

<img width="1313" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/727cd540-d03a-40c6-a7dd-e87c118af0ac">
2023-07-03 03:32:21 +00:00
derelm 5b79eeabd1
use css on labels (#25626)
Changes html to use CSS label class similar to
`templates/shared/actions/runner_list.tmpl`
2023-07-03 02:33:28 +00:00
Lunny Xiao 807c9712ef
Get latest commit statuses from database instead of git data on dashboard for repositories (#25605)
related #24638
2023-07-03 01:53:05 +00:00
HesterG 640a88fa09
Add log line anchor for action logs (#25532)
Close #24593

Some behavior:

- If log step line in hash exists, expand the step and scroll to the log
line.
- If step exists but line not exists, the step will be expanded.
- If step not exists, stays on the job's page.

Some Notes:

- Changed mounted to async because need to await for first `loadJob` so
`currentJobStepsStates` can be initialized and used in
`hashChangeListener `.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-07-03 01:08:49 +00:00
hiifong 36f1fa7792
Support displaying diff stats in PR tab bar (#25387)
Fix #25326

---------

Co-authored-by: silverwind <me@silverwind.io>
2023-07-03 01:00:28 +00:00
GiteaBot eab011db58 [skip ci] Updated licenses and gitignores 2023-07-03 00:30:17 +00:00
Lunny Xiao aab7cb6750
Move some files under repo/setting (#25585)
There are too many files under `routers/web/repo` and the file
`routers/web/repo/setting.go` is too big.
This PR move all setting related routers' body functions under
`routers/web/repo/setting` and also split `routers/web/repo/setting.go`
2023-07-02 08:59:32 +08:00
wxiaoguang cea9401634
Following-up improvments for various PRs (#25620)
For:

* #22743
* #25408
* #25412
* #25588
2023-07-01 14:00:10 -04:00
techknowlogick 469d89b95a
Set SSH_AUTHORIZED_KEYS_BACKUP to false (#25412)
This prevents the disk from overflowing with auth keys file

Fixes #17117

## ⚠️ BREAKING

This changes the default option for creating a backup of the authorized
key file when an update is made to default to false.
2023-07-01 04:07:48 +00:00
Lunny Xiao de981c39e6
Fix bug of branches API with tests (#25578)
Fix #25558
Extract from #22743

This PR added a repository's check when creating/deleting branches via
API. Mirror repository and archive repository cannot do that.
2023-07-01 10:52:52 +08:00
GiteaBot 1704c64a15 [skip ci] Updated translations via Crowdin 2023-07-01 00:32:07 +00:00
Denys Konovalov e7f281e1ae
Application as a maintainer (#25614)
Hi everyone,
as discussed in `#develop` I would like to apply as a maintainer.
I don't have that much in-depth knowledge of the codebase, but I would
like to help to review at least smaller PRs for the beginning.
Here is my PR list:
https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3Adenyskon+is%3Amerged
2023-07-01 07:54:17 +08:00
puni9869 4583cbd615
Adding branch-name copy to clipboard branches screen. (#25596)
Adding  branch-name copy  to clipboard and button in branches screen

Replaces #25569
Fixes #25120


New mocks:
<img width="876" alt="Screenshot 2023-06-30 at 12 01 41 AM"
src="https://github.com/go-gitea/gitea/assets/80308335/a34ab00f-5625-4529-ba17-f2bf7af58e2a">
<img width="822" alt="Screenshot 2023-06-30 at 12 03 59 AM"
src="https://github.com/go-gitea/gitea/assets/80308335/3a32dffc-52cd-49e1-a437-6d11d58d0939">

<img width="476" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/85e8f361-5cb7-45d4-aced-ad2523d54ab0">
2023-06-30 18:16:17 +00:00
sebastian-sauer ed8a8af99f
Use AfterCommitId to get commit for Viewed functionality (#25529)
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
2023-07-01 00:08:18 +08:00
Lunny Xiao 65acd1e9ef
Fix branch commit message too long problem (#25588)
When branch's commit CommitMessage is too long, the column maybe too
short.(TEXT 16K for mysql).
This PR will fix it to only store the summary because these message will
only show on branch list or possible future search?
2023-06-30 17:03:05 +08:00
Jason Song 67bd9d4f1e
Restrict [actions].DEFAULT_ACTIONS_URL to only github or self (#25581)
Resolve #24789

## ⚠️ BREAKING ⚠️

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
2023-06-30 07:26:36 +00:00
JakobDev 254a82842a
Add API for changing Avatars (#25369)
This adds an API for uploading and Deleting Avatars for of Users, Repos
and Organisations. I'm not sure, if this should also be added to the
Admin API.

Resolves #25344

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-29 23:22:55 +00:00
Ed Silkworth 9fd63aaad1
read-only checkboxes don't appear and don't entirely act the way one might expect (#25573)
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: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-06-30 00:16:53 +02:00
KN4CK3R cf2356062f
Redirect to package after version deletion (#25594)
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
2023-06-29 17:01:14 +00:00
isla w e882398c5a
Update emoji set to Unicode 15 (#25595)
Update emoji set to Unicode 15 which was added upstream here:
cb5c514d47

<img width="854" alt="Screenshot 2023-06-29 at 11 02 56 AM"
src="https://github.com/go-gitea/gitea/assets/1669571/7bfb663d-0804-4d23-a62d-f585a6783ca6">

---------

Co-authored-by: silverwind <me@silverwind.io>
2023-06-29 16:29:48 +00:00
silverwind fdf71460f9
Fix lint-swagger action (#25593)
- Add detection for swagger changes and run `lint-swagger` on it
- Remove `lint-swagger` from `lint-frontend`
- Remove `lint-md` from `lint-frontend`
2023-06-29 10:37:41 -04:00
silverwind 64f2d70262
Replace fomantic divider module with our own (#25539)
Should look exactly like before for normal dividers. "Horizontal" ones
look better because they no longer use image backgrounds.

<img width="917" alt="Screenshot 2023-06-27 at 19 07 56"
src="https://github.com/go-gitea/gitea/assets/115237/d97d8dec-6859-44a8-85ba-e4549b4dd9df">

<img width="914" alt="Screenshot 2023-06-27 at 19 05 58"
src="https://github.com/go-gitea/gitea/assets/115237/8bf98544-2d82-4ebf-ac68-d6dc237bd6b2">

<img width="1246" alt="Screenshot 2023-06-27 at 19 00 42"
src="https://github.com/go-gitea/gitea/assets/115237/36a6bb21-6029-4f53-8bee-535f55c66fed">

<img width="344" alt="Screenshot 2023-06-27 at 18 58 15"
src="https://github.com/go-gitea/gitea/assets/115237/a9e70aee-8e6b-4ea1-9e93-19c9f96aec6e">
<img width="823" alt="Screenshot 2023-06-27 at 18 56 22"
src="https://github.com/go-gitea/gitea/assets/115237/e7a497cd-f262-4683-8872-23c3c8cce32f">

<img width="330" alt="Screenshot 2023-06-27 at 19 21 11"
src="https://github.com/go-gitea/gitea/assets/115237/42f24149-a655-4c7e-bd26-8ab52db6446b">
2023-06-29 20:24:22 +08:00
Zettat123 72b3af74be
Add documentation about supported workflow trigger events (#25582)
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.
2023-06-29 19:45:53 +08:00
Lunny Xiao 6e19484f4d
Sync branches into databases (#22743)
Related #14180
Related #25233 
Related #22639
Close #19786
Related #12763 

This PR will change all the branches retrieve method from reading git
data to read database to reduce git read operations.

- [x] Sync git branches information into database when push git data
- [x] Create a new table `Branch`, merge some columns of `DeletedBranch`
into `Branch` table and drop the table `DeletedBranch`.
- [x] Read `Branch` table when visit `code` -> `branch` page
- [x] Read `Branch` table when list branch names in `code` page dropdown
- [x] Read `Branch` table when list git ref compare page
- [x] Provide a button in admin page to manually sync all branches.
- [x] Sync branches if repository is not empty but database branches are
empty when visiting pages with branches list
- [x] Use `commit_time desc` as the default FindBranch order by to keep
consistent as before and deleted branches will be always at the end.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
2023-06-29 10:03:20 +00:00
HesterG 5a871932f0
Fix milestones deletion (#25583)
Close #25557 
Fix regression from #25315

`data-id` is still needed for deleting milestone.
2023-06-29 10:17:18 +02:00