]> source.dussan.org Git - gitea.git/log
gitea.git
15 months agoSet SSH_AUTHORIZED_KEYS_BACKUP to false (#25412)
techknowlogick [Sat, 1 Jul 2023 04:07:48 +0000 (00:07 -0400)]
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.

15 months agoFix bug of branches API with tests (#25578)
Lunny Xiao [Sat, 1 Jul 2023 02:52:52 +0000 (10:52 +0800)]
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.

15 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 1 Jul 2023 00:32:07 +0000 (00:32 +0000)]
[skip ci] Updated translations via Crowdin

15 months agoApplication as a maintainer (#25614)
Denys Konovalov [Fri, 30 Jun 2023 23:54:17 +0000 (01:54 +0200)]
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

15 months agoAdding branch-name copy to clipboard branches screen. (#25596)
puni9869 [Fri, 30 Jun 2023 18:16:17 +0000 (23:46 +0530)]
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">

15 months agoUse AfterCommitId to get commit for Viewed functionality (#25529)
sebastian-sauer [Fri, 30 Jun 2023 16:08:18 +0000 (18:08 +0200)]
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

15 months agoFix branch commit message too long problem (#25588)
Lunny Xiao [Fri, 30 Jun 2023 09:03:05 +0000 (17:03 +0800)]
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?

15 months agoRestrict `[actions].DEFAULT_ACTIONS_URL` to only `github` or `self` (#25581)
Jason Song [Fri, 30 Jun 2023 07:26:36 +0000 (15:26 +0800)]
Restrict `[actions].DEFAULT_ACTIONS_URL` to only `github` or `self` (#25581)

Resolve #24789

## :warning: BREAKING :warning:

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

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

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

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

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

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

Follow-up on the runner side:

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

15 months agoAdd API for changing Avatars (#25369)
JakobDev [Thu, 29 Jun 2023 23:22:55 +0000 (01:22 +0200)]
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>
15 months agoread-only checkboxes don't appear and don't entirely act the way one might expect...
Ed Silkworth [Thu, 29 Jun 2023 22:16:53 +0000 (15:16 -0700)]
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>
15 months agoRedirect to package after version deletion (#25594)
KN4CK3R [Thu, 29 Jun 2023 17:01:14 +0000 (19:01 +0200)]
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

15 months agoUpdate emoji set to Unicode 15 (#25595)
isla w [Thu, 29 Jun 2023 16:29:48 +0000 (12:29 -0400)]
Update emoji set to Unicode 15 (#25595)

Update emoji set to Unicode 15 which was added upstream here:
https://github.com/github/gemoji/commit/cb5c514d472daf9b312c963987f4d7ee865c28fe

<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>
15 months agoFix `lint-swagger` action (#25593)
silverwind [Thu, 29 Jun 2023 14:37:41 +0000 (16:37 +0200)]
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`

15 months agoReplace fomantic divider module with our own (#25539)
silverwind [Thu, 29 Jun 2023 12:24:22 +0000 (14:24 +0200)]
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">

15 months agoAdd documentation about supported workflow trigger events (#25582)
Zettat123 [Thu, 29 Jun 2023 11:45:53 +0000 (19:45 +0800)]
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.

15 months agoSync branches into databases (#22743)
Lunny Xiao [Thu, 29 Jun 2023 10:03:20 +0000 (18:03 +0800)]
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>
15 months agoFix milestones deletion (#25583)
HesterG [Thu, 29 Jun 2023 08:17:18 +0000 (16:17 +0800)]
Fix milestones deletion (#25583)

Close #25557
Fix regression from #25315

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

15 months agoReduce table padding globally (#25568)
silverwind [Thu, 29 Jun 2023 04:40:03 +0000 (06:40 +0200)]
Reduce table padding globally (#25568)

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

## Admin repolist before and after

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

## Other tables

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

Files table is unaffected because it has custom padding already.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoUse fetch form action for lock/unlock/pin/unpin on sidebar (#25380)
HesterG [Thu, 29 Jun 2023 04:16:04 +0000 (12:16 +0800)]
Use fetch form action for lock/unlock/pin/unpin on sidebar (#25380)

Before:

<img width="364" alt="Screen Shot 2023-06-20 at 11 59 11"
src="https://github.com/go-gitea/gitea/assets/17645053/ad284b7e-8d21-43be-b178-bbcfd37cb5bd">

Might trigger many posts when keep clicking the buttons above.

<img width="448" alt="Screen Shot 2023-06-20 at 11 52 28"
src="https://github.com/go-gitea/gitea/assets/17645053/a60aa6ac-af74-45e4-b13a-512b436b81b0">
<img width="678" alt="Screen Shot 2023-06-20 at 11 52 37"
src="https://github.com/go-gitea/gitea/assets/17645053/d6662700-3643-4cc7-a2ec-64e1c0f5fbdb">

After (PR sidebar, Same for issue):

https://github.com/go-gitea/gitea/assets/17645053/9df3ad1f-e29c-439b-8bde-e6b917d63cc6

For delete, it is using `base/modal_actions_confirm` subtemplate, and we
might need another general solution for this (maybe add another
attribute to the subtemplate or something)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoSupport downloading raw task logs (#24451)
Vitaliy Filippov [Thu, 29 Jun 2023 02:58:56 +0000 (05:58 +0300)]
Support downloading raw task logs (#24451)

Hi!
This pull request adds support for downloading raw task logs for Gitea
Actions, similar to Github Actions
It looks like the following:

![image](https://user-images.githubusercontent.com/945339/235376746-405d5019-710b-468b-8113-9e82eab8e752.png)

15 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 29 Jun 2023 00:29:20 +0000 (00:29 +0000)]
[skip ci] Updated translations via Crowdin

15 months agoSplit lfs size from repository size (#22900)
a1012112796 [Wed, 28 Jun 2023 22:41:02 +0000 (06:41 +0800)]
Split lfs size from repository size (#22900)

releated to #21820

- Split `Size` in repository table as two new colunms, one is `GitSize`
for git size, the other is `LFSSize` for lfs data. still store full size
in `Size` colunm.
- Show full size on ui, but show each of them by a `title`;  example:

![image](https://user-images.githubusercontent.com/25342410/218636251-e200f085-d7e7-4a25-9ff1-b586a63e07a9.png)

- Return full size in api response.

---------

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: DmitryFrolovTri <23313323+DmitryFrolovTri@users.noreply.github.com>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoUse correct response code in push mirror creation response in v1_json.tmpl (#25476)
Georg Dangl [Wed, 28 Jun 2023 22:00:19 +0000 (00:00 +0200)]
Use correct response code in push mirror creation response in v1_json.tmpl (#25476)

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

When looking at this function:

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

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

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

But it actually returns `200 - OK`:

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

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

---------

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoDo not prepare oauth2 config if it is not enabled, do not write config in some sub...
wxiaoguang [Wed, 28 Jun 2023 21:30:06 +0000 (05:30 +0800)]
Do not prepare oauth2 config if it is not enabled, do not write config in some sub-commands (#25567)

Ref:

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

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

15 months agoFix content holes in Actions task logs file (#25560)
Jason Song [Wed, 28 Jun 2023 17:07:29 +0000 (01:07 +0800)]
Fix content holes in Actions task logs file (#25560)

Fix #25451.

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

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

---------

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoAlign language menu icon and fit the footer area (#25556)
wxiaoguang [Wed, 28 Jun 2023 14:57:50 +0000 (22:57 +0800)]
Align language menu icon and fit the footer area (#25556)

Close #25551

15 months agoFix bugs related to notification endpoints (#25548)
Zettat123 [Wed, 28 Jun 2023 14:26:56 +0000 (22:26 +0800)]
Fix bugs related to notification endpoints (#25548)

15 months agoAdd custom ansi colors and CSS variables for them (#25546)
silverwind [Wed, 28 Jun 2023 13:38:55 +0000 (15:38 +0200)]
Add custom ansi colors and CSS variables for them (#25546)

Use our existing color palette to map to the 16 basic ansi colors. This
is backwards-compatible because it aliases the existing color names.

Side note: I think the colors in `console.css` for console file
rendering are incomplete, but fixing those is out of scope here imo.

Before and after:

<img width="542" alt="Screenshot 2023-06-28 at 00 26 12"
src="https://github.com/go-gitea/gitea/assets/115237/86d41884-bc47-4e85-8aec-621eb7320f0b">

<img width="546" alt="Screenshot 2023-06-28 at 00 28 24"
src="https://github.com/go-gitea/gitea/assets/115237/39fa3b37-d49e-49b1-b6bc-390ac8ca24b2">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoUse flex instead of float for sort button and search input (#25519)
HesterG [Wed, 28 Jun 2023 12:10:36 +0000 (20:10 +0800)]
Use flex instead of float for sort button and search input (#25519)

Right now some sort buttons beside search input are unclickable because
#25338 removed `max-width` and the sort button is using float, sort
button is then covered by the `input`.

The way to fix this in this PR is changing the layout to `flex` and put
`input form` and sort `button` into `secondary menu`.

After:

<img width="1411" alt="Screen Shot 2023-06-26 at 16 40 52"
src="https://github.com/go-gitea/gitea/assets/17645053/63c12b17-793a-4ae7-bbda-f67b13b87212">

<img width="1428" alt="Screen Shot 2023-06-26 at 16 34 06"
src="https://github.com/go-gitea/gitea/assets/17645053/cb7d967e-355d-4cb0-955c-6139580fc17a">
<img width="716" alt="Screen Shot 2023-06-26 at 16 34 22"
src="https://github.com/go-gitea/gitea/assets/17645053/c74b5ef2-d46e-4487-8794-28bec984bb36">
<img width="1424" alt="Screen Shot 2023-06-26 at 16 34 32"
src="https://github.com/go-gitea/gitea/assets/17645053/8a5fdc05-a2c5-4ec4-979d-15a21501fe14">
<img width="1425" alt="Screen Shot 2023-06-26 at 16 35 21"
src="https://github.com/go-gitea/gitea/assets/17645053/eb73cd31-3914-4bc9-92ab-aba56f25128b">
<img width="1437" alt="Screen Shot 2023-06-26 at 16 36 14"
src="https://github.com/go-gitea/gitea/assets/17645053/1c3b4595-bb26-491f-aa68-60dc9ab22b84">

15 months agoFix sub-command log level (#25537)
wxiaoguang [Wed, 28 Jun 2023 06:02:06 +0000 (14:02 +0800)]
Fix sub-command log level (#25537)

More fix for #24981

* #24981

Close #22361

* #22361

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

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

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

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

----

Other changes:

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

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoUpdate JS dependencies and misc tweaks (#25540)
silverwind [Tue, 27 Jun 2023 19:44:17 +0000 (21:44 +0200)]
Update JS dependencies and misc tweaks (#25540)

- Update all JS dependencies
- Enable `declaration-property-unit-disallowed-list` to forbid `em` on
`line-height`
- Rename dependency update targets to `update-js` and `update-py` and
document them
- Remove margin on Asciicast viewer
- Tested Swagger, Katex, Asciicast

<img width="1243" alt="Screenshot 2023-06-27 at 19 51 05"
src="https://github.com/go-gitea/gitea/assets/115237/2d2722a0-2aa7-4f4c-b8bd-17e1f3637b78">

15 months agoChange `Regenerate Secret` button display (#25534)
KN4CK3R [Tue, 27 Jun 2023 15:20:52 +0000 (17:20 +0200)]
Change `Regenerate Secret` button display (#25534)

Fixes #25527

Preview:

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

15 months agoFix rerun icon on action view component (#25531)
HesterG [Tue, 27 Jun 2023 14:34:33 +0000 (22:34 +0800)]
Fix rerun icon on action view component (#25531)

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

Before (rerun svg not shown on hover):

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

After:

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

15 months agoFix admin-dl-horizontal (#25512)
wxiaoguang [Tue, 27 Jun 2023 09:14:45 +0000 (17:14 +0800)]
Fix admin-dl-horizontal (#25512)

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

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

---------

Co-authored-by: HesterG <hestergong@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
15 months agoFix input `line-height` cutting off `g` (#25334)
hiifong [Tue, 27 Jun 2023 08:45:43 +0000 (16:45 +0800)]
Fix input `line-height` cutting off `g` (#25334)

Fix the incomplete display of input text
Before:

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

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

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

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

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoAdd toasts to UI (#25449)
silverwind [Tue, 27 Jun 2023 02:45:24 +0000 (04:45 +0200)]
Add toasts to UI (#25449)

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

In some case like async success/error, it is useful to show toasts in UI.

15 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 27 Jun 2023 00:29:26 +0000 (00:29 +0000)]
[skip ci] Updated translations via Crowdin

15 months agoAdd `make poetry-update`, upgrade `djlint` (#25399)
silverwind [Mon, 26 Jun 2023 21:14:00 +0000 (23:14 +0200)]
Add `make poetry-update`, upgrade `djlint` (#25399)

[updates](https://github.com/silverwind/updates) now supports poetry as
well so we can use it for a new `make poetry-update` to update all
poetry dependencies.

15 months agoUse JSON response for "user/logout" (#25522)
wxiaoguang [Mon, 26 Jun 2023 19:36:10 +0000 (03:36 +0800)]
Use JSON response for "user/logout" (#25522)

The request sent to "user/logout" is from "link-action", it expects to
get JSON response.

15 months agoFix migrate page layout on mobile (#25507)
silverwind [Mon, 26 Jun 2023 09:57:36 +0000 (11:57 +0200)]
Fix migrate page layout on mobile (#25507)

Fixes: https://github.com/go-gitea/gitea/issues/25462
On supporting browsers, text in description is [wrapped
equally](https://caniuse.com/css-text-wrap-balance).

<img width="488" alt="Screenshot 2023-06-26 at 00 17 21"
src="https://github.com/go-gitea/gitea/assets/115237/cb8e3a50-6225-4a8c-a6c0-f35a17d2af76">

<img width="1254" alt="Screenshot 2023-06-26 at 00 14 51"
src="https://github.com/go-gitea/gitea/assets/115237/0885404e-973e-45ce-b41e-5cb265a4cd1e">

15 months agoAdd Adopt repository event and handler (#25497)
Lunny Xiao [Mon, 26 Jun 2023 06:59:15 +0000 (14:59 +0800)]
Add Adopt repository event and handler (#25497)

Fix #14304

---------

Co-authored-by: delvh <dev.lh@web.de>
15 months agoSupport `pull_request_target` event (#25229)
Zettat123 [Mon, 26 Jun 2023 06:33:18 +0000 (14:33 +0800)]
Support `pull_request_target` event (#25229)

Fix #25088

This PR adds the support for
[`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target)
workflow trigger. `pull_request_target` is similar to `pull_request`,
but the workflow triggered by the `pull_request_target` event runs in
the context of the base branch of the pull request rather than the head
branch. Since the workflow from the base is considered trusted, it can
access the secrets and doesn't need approvals to run.

15 months agoFix CLI sub-command handling (#25501)
wxiaoguang [Mon, 26 Jun 2023 05:45:27 +0000 (13:45 +0800)]
Fix CLI sub-command handling (#25501)

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

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

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

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

15 months agoDocument creating an API key from the CLI (#25504) (#25510)
techknowlogick [Mon, 26 Jun 2023 05:13:20 +0000 (01:13 -0400)]
Document creating an API key from the CLI (#25504) (#25510)

Frontport of #25504

Credit to @lonix1

Co-authored-by: lonix1 <40320097+lonix1@users.noreply.github.com>
Co-authored-by: delvh <dev.lh@web.de>
15 months agoClarify the reason why the user can't add a new email if there is a pending activatio...
wxiaoguang [Mon, 26 Jun 2023 04:52:49 +0000 (12:52 +0800)]
Clarify the reason why the user can't add a new email if there is a pending activation (#25509)

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

15 months agoAllow change line of admin-dl-horizontal dt (#25508)
HesterG [Mon, 26 Jun 2023 03:49:14 +0000 (11:49 +0800)]
Allow change line of admin-dl-horizontal dt (#25508)

Close #25389

After:

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

admin/dashboard:

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

15 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 26 Jun 2023 00:31:01 +0000 (00:31 +0000)]
[skip ci] Updated translations via Crowdin

15 months agoLink to existing PR when trying to open a new PR on the same branches (#25494)
sebastian-sauer [Sun, 25 Jun 2023 10:03:36 +0000 (12:03 +0200)]
Link to existing PR when trying to open a new PR on the same branches (#25494)

when trying to create a PR for an existing PRs branch combination link
to the PR directly and not just to the repo.

Before:

![image](https://github.com/go-gitea/gitea/assets/1135157/b6c71323-29c8-4024-afa5-420eed145e91)

After:

![image](https://github.com/go-gitea/gitea/assets/1135157/837665f5-7459-46c6-86d4-c2dbedabc262)

15 months agoFine tune "dropdown button" icon (#25442)
wxiaoguang [Sun, 25 Jun 2023 02:40:41 +0000 (10:40 +0800)]
Fine tune "dropdown button" icon (#25442)

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

----

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

15 months agoRevert "Make buttons in a modal form have proper type. (#25446)" (#25485)
wxiaoguang [Sun, 25 Jun 2023 02:03:09 +0000 (10:03 +0800)]
Revert "Make buttons in a modal form have proper type. (#25446)" (#25485)

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

This reverts commit a954c93a68072042aa7dad717b6fa002c83a58fb.

15 months agoHighlight viewed files differently in the PR filetree (#24956)
sebastian-sauer [Sun, 25 Jun 2023 00:46:30 +0000 (02:46 +0200)]
Highlight viewed files differently in the PR filetree (#24956)

![image](https://github.com/go-gitea/gitea/assets/1135157/009d8026-15a1-4d18-8548-1c3642978f57)

fixes #24566

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
15 months agoImprove loadprojects for issue list (#25468)
Lunny Xiao [Sat, 24 Jun 2023 15:31:28 +0000 (23:31 +0800)]
Improve loadprojects for issue list (#25468)

15 months agoOnly show 'Manage Account Links' when necessary (#25311)
Panagiotis "Ivory" Vasilopoulos [Sat, 24 Jun 2023 13:00:52 +0000 (13:00 +0000)]
Only show 'Manage Account Links' when necessary (#25311)

If it is not possible to add or manage an account link, the menu
will not be shown to the user.

15 months agofix tags line no margin see #25255 (#25280)
hiifong [Sat, 24 Jun 2023 12:30:46 +0000 (20:30 +0800)]
fix tags line no margin see #25255 (#25280)

This is my first pr, there are many things I don't understand very well,
I am very sorry, I rearranged the code and opened this new pr.
Now:

![image](https://github.com/go-gitea/gitea/assets/89133723/5acd9d81-2152-4966-9372-1fbf902ed073)

15 months agoUse InitWorkPathAndCfgProvider for environment-to-ini to avoid unnecessary checks...
wxiaoguang [Sat, 24 Jun 2023 09:13:35 +0000 (17:13 +0800)]
Use InitWorkPathAndCfgProvider for environment-to-ini to avoid unnecessary checks (#25480)

Fix #25481

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

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

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

15 months agoFix wrong warn messages in migration steps (#25475)
Lunny Xiao [Sat, 24 Jun 2023 08:20:08 +0000 (16:20 +0800)]
Fix wrong warn messages in migration steps (#25475)

The recent change on xorm for `Sync` is it will not warn when database
have columns which is not listed on struct. So we just need this warn
logs when `Sync` the whole database but not in the migrations Sync.

This PR will remove almost unnecessary warning logs on migrations.

Now below logs in CI will disappear.
```log
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column creator_id but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column is_closed but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column board_type but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column type but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column closed_date_unix but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column created_unix but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column updated_unix but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column card_type but struct has not related field
```

15 months agoNavbar fixes (#25402)
silverwind [Sat, 24 Jun 2023 04:31:39 +0000 (06:31 +0200)]
Navbar fixes (#25402)

Fixes: https://github.com/go-gitea/gitea/issues/25444
Followup for some regressions from
https://github.com/go-gitea/gitea/pull/25343. Before and after:

<img width="219" alt="Screenshot 2023-06-21 at 00 25 20"
src="https://github.com/go-gitea/gitea/assets/115237/08fe8e01-0a16-4cdf-ad4d-0a9048408e9e">
<img width="220" alt="Screenshot 2023-06-21 at 00 25 32"
src="https://github.com/go-gitea/gitea/assets/115237/be25ae69-6ed0-4af5-8eeb-d7b210e7c124">

Fixes mobile button background and margins:

<img width="836" alt="Screenshot 2023-06-21 at 00 39 58"
src="https://github.com/go-gitea/gitea/assets/115237/d76ac1e9-747f-477c-9a42-b73e129b72ee">

15 months agoFix default value for LocalURL (#25426)
Lunny Xiao [Sat, 24 Jun 2023 03:56:29 +0000 (11:56 +0800)]
Fix default value for LocalURL (#25426)

Fix #23769

15 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 24 Jun 2023 00:30:41 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

15 months agoDo not publish docker release images on `-dev` tags (#25471)
delvh [Fri, 23 Jun 2023 19:52:24 +0000 (21:52 +0200)]
Do not publish docker release images on `-dev` tags (#25471)

Try to prevent what happened with tag `v1.21.0-dev` as outlined in
#25193.
Unfortunately, we cannot really test if it works as intended as we would
need to release a new `dev` tag for that.
Fixes #25193 (or at least attempts to).

---------

Co-authored-by: jolheiser <john.olheiser@gmail.com>
15 months agoImprove wiki sidebar and TOC (#25460)
wxiaoguang [Fri, 23 Jun 2023 19:51:43 +0000 (03:51 +0800)]
Improve wiki sidebar and TOC (#25460)

Close #20976
Close #20975

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

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

15 months agoFix `Init` of db indexer (#25470)
Jason Song [Fri, 23 Jun 2023 14:39:52 +0000 (22:39 +0800)]
Fix `Init` of db indexer (#25470)

Fix regression of #25174.

The `Init` of the db indexer should return true to indicate that the
index was opened/existed, or the indexer will try to populate the index
(not really populate, just fill the queue, `Index` method of the db
indexer is a dummy).

15 months agoAdd `Makefile` to `files-changed` (#25463)
silverwind [Fri, 23 Jun 2023 13:56:18 +0000 (15:56 +0200)]
Add `Makefile` to `files-changed` (#25463)

When only `Makefile` changes, nothing currently runs. Add it to a few
categories.

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoFix repo search broken because of profile page added (#25455)
Lunny Xiao [Fri, 23 Jun 2023 13:11:12 +0000 (21:11 +0800)]
Fix repo search broken because of profile page added (#25455)

Fix #25433
Caused by #23260

15 months agoRefactor indexer (#25174)
Jason Song [Fri, 23 Jun 2023 12:37:56 +0000 (20:37 +0800)]
Refactor indexer (#25174)

Refactor `modules/indexer` to make it more maintainable. And it can be
easier to support more features. I'm trying to solve some of issue
searching, this is a precursor to making functional changes.

Current supported engines and the index versions:

| engines | issues | code |
| - | - | - |
| db | Just a wrapper for database queries, doesn't need version | - |
| bleve | The version of index is **2** | The version of index is **6**
|
| elasticsearch | The old index has no version, will be treated as
version **0** in this PR | The version of index is **1** |
| meilisearch | The old index has no version, will be treated as version
**0** in this PR | - |

## Changes

### Split

Splited it into mutiple packages

```text
indexer
├── internal
│   ├── bleve
│   ├── db
│   ├── elasticsearch
│   └── meilisearch
├── code
│   ├── bleve
│   ├── elasticsearch
│   └── internal
└── issues
    ├── bleve
    ├── db
    ├── elasticsearch
    ├── internal
    └── meilisearch
```

- `indexer/interanal`: Internal shared package for indexer.
- `indexer/interanal/[engine]`: Internal shared package for each engine
(bleve/db/elasticsearch/meilisearch).
- `indexer/code`: Implementations for code indexer.
- `indexer/code/internal`: Internal shared package for code indexer.
- `indexer/code/[engine]`: Implementation via each engine for code
indexer.
- `indexer/issues`: Implementations for issues indexer.

### Deduplication

- Combine `Init/Ping/Close` for code indexer and issues indexer.
- ~Combine `issues.indexerHolder` and `code.wrappedIndexer` to
`internal.IndexHolder`.~ Remove it, use dummy indexer instead when the
indexer is not ready.
- Duplicate two copies of creating ES clients.
- Duplicate two copies of `indexerID()`.

### Enhancement

- [x] Support index version for elasticsearch issues indexer, the old
index without version will be treated as version 0.
- [x] Fix spell of `elastic_search/ElasticSearch`, it should be
`Elasticsearch`.
- [x] Improve versioning of ES index. We don't need `Aliases`:
- Gitea does't need aliases for "Zero Downtime" because it never delete
old indexes.
- The old code of issues indexer uses the orignal name to create issue
index, so it's tricky to convert it to an alias.
- [x] Support index version for meilisearch issues indexer, the old
index without version will be treated as version 0.
- [x] Do "ping" only when `Ping` has been called, don't ping
periodically and cache the status.
- [x] Support the context parameter whenever possible.
- [x] Fix outdated example config.
- [x] Give up the requeue logic of issues indexer: When indexing fails,
call Ping to check if it was caused by the engine being unavailable, and
only requeue the task if the engine is unavailable.
- It is fragile and tricky, could cause data losing (It did happen when
I was doing some tests for this PR). And it works for ES only.
- Just always requeue the failed task, if it caused by bad data, it's a
bug of Gitea which should be fixed.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoStore and use seconds for timeline time comments (#25392)
6543 [Fri, 23 Jun 2023 12:12:39 +0000 (14:12 +0200)]
Store and use seconds for timeline time comments (#25392)

this will allow us to fully localize it later

PS: we can not migrate back as the old value was a one-way conversion

prepare for  #25213

---
*Sponsored by Kithara Software GmbH*

15 months agoMake buttons in a modal form have proper type. (#25446)
wxiaoguang [Fri, 23 Jun 2023 10:57:01 +0000 (18:57 +0800)]
Make buttons in a modal form have proper type. (#25446)

Fix  #25438

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

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoMake "dismiss" content shown correctly (#25461)
wxiaoguang [Fri, 23 Jun 2023 10:33:20 +0000 (18:33 +0800)]
Make "dismiss" content shown correctly (#25461)

Close #25127

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

Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoGitea version in Makefile (#25456)
John Olheiser [Fri, 23 Jun 2023 07:52:15 +0000 (02:52 -0500)]
Gitea version in Makefile (#25456)

As title, this is how it was inferred before

https://github.com/go-gitea/gitea/blob/e24f651c86a5168da8181f2c75f5f99b56561224/Makefile#L83-L84

We moved to actions, however `GITEA_VERSION` should still work to use
`VERSION`

Signed-off-by: jolheiser <john.olheiser@gmail.com>
15 months agoImport additional secrets via file uri (#25408)
techknowlogick [Fri, 23 Jun 2023 00:16:12 +0000 (20:16 -0400)]
Import additional secrets via file uri (#25408)

15 months agoRemove `deps-tools` from `backend` job (#25454)
silverwind [Thu, 22 Jun 2023 23:24:55 +0000 (01:24 +0200)]
Remove `deps-tools` from `backend` job (#25454)

15 months agoUpdate octicons and use `octicon-file-directory-symlink` (#25453)
silverwind [Thu, 22 Jun 2023 22:05:52 +0000 (00:05 +0200)]
Update octicons and use `octicon-file-directory-symlink` (#25453)

Make use of the [new
octicon](https://github.com/primer/octicons/issues/945) that indicates a
symlink to a directory:

<img width="189" alt="Screenshot 2023-06-22 at 22 50 57"
src="https://github.com/go-gitea/gitea/assets/115237/a70690ea-ebfc-48fe-af23-cdc33bcb2098">

15 months agoadd `test-frontend` back to actions (#25452)
silverwind [Thu, 22 Jun 2023 21:37:50 +0000 (23:37 +0200)]
add `test-frontend` back to actions (#25452)

Apparently we were not running `test-frontend` on actions, this adds it
back.

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

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

15 months agoFix `Permission` in API returned repository struct (#25388)
Jason Song [Thu, 22 Jun 2023 13:08:08 +0000 (21:08 +0800)]
Fix `Permission` in API returned repository struct (#25388)

The old code generates `structs.Repository.Permissions` with only
`access.Permission.AccessMode`, however, it should check the units too,
or the value could be incorrect. For example,
`structs.Repository.Permissions.Push` could be false even the doer has
write access to code unit.

Should fix
https://github.com/renovatebot/renovate/issues/14059#issuecomment-1047961128
(Not reported by it, I just found it when I was looking into this bug)

---

Review tips:

The major changes are
- `modules/structs/repo.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-870406f6857117f8b03611c43fca0ab9ed6d6e76a2d0069a7c1f17e8fa9092f7
- `services/convert/repository.go`
https://github.com/go-gitea/gitea/pull/25388/files#diff-7736f6d2ae894c9edb7729a80ab89aa183b888a26a811a0c1fdebd18726a7101

And other changes are passive.

15 months agoDiff page enhancements (#25398)
silverwind [Thu, 22 Jun 2023 11:05:22 +0000 (13:05 +0200)]
Diff page enhancements (#25398)

Two small tweaks:

1. Vertically center arrow here when editing a PR:

<img width="405" alt="Screenshot 2023-06-20 at 19 48 49"
src="https://github.com/go-gitea/gitea/assets/115237/1d63764d-9fd9-467e-8a8e-9258c06475eb">

2. Use 2-row layout on diff viewed status and show it again on mobile:

<img width="142" alt="Screenshot 2023-06-20 at 19 51 21"
src="https://github.com/go-gitea/gitea/assets/115237/3046e782-163c-4f87-910c-a22066de8f1b">

Mobile view:

<img width="370" alt="Screenshot 2023-06-20 at 19 44 40"
src="https://github.com/go-gitea/gitea/assets/115237/9cf56347-7323-4d05-99a5-17ad215ee44d">

15 months agoIntroduce shared template for search inputs (#25338)
silverwind [Thu, 22 Jun 2023 10:27:35 +0000 (12:27 +0200)]
Introduce shared template for search inputs (#25338)

- Set
[type=search](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search)
- Disable spellcheck
- Set maxLength 255 that I found in `templates/repo/issue/search.tmpl`
- Remove unnecessary `max-width`, it does nothing

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoImprove 'Privacy' section in profile settings (#25309)
Panagiotis "Ivory" Vasilopoulos [Thu, 22 Jun 2023 08:58:16 +0000 (08:58 +0000)]
Improve 'Privacy' section in profile settings (#25309)

- Improve "Hide the activity from the profile page" label
- E-Mail privacy icon in user profile now redirects to Privacy section
- E-Mail privacy settings moved to Privacy section

Previously, the user was redirected to the setting itself, however,
that is not a good design choice because the setting itself would
be at the very top of the user's browser window. This fix doesn't
fix the problem entirely, but it is definitely an improvement
compared to its previous iteration.

15 months agoChange default email domain for LDAP users (#25425)
Zettat123 [Thu, 22 Jun 2023 08:16:12 +0000 (16:16 +0800)]
Change default email domain for LDAP users (#25425)

Fixes #21169

Change `localhost` to `localhost.local`

15 months agoSwitch to ansi_up for ansi rendering in actions (#25401)
silverwind [Thu, 22 Jun 2023 02:15:19 +0000 (04:15 +0200)]
Switch to ansi_up for ansi rendering in actions (#25401)

Fixes: https://github.com/go-gitea/gitea/issues/24777
15 months agoVarious UI fixes (#25264)
silverwind [Thu, 22 Jun 2023 01:59:49 +0000 (03:59 +0200)]
Various UI fixes (#25264)

Numerous small UI fixes:

- Fix double border in collaborator list
- Fix system notice table background
- Mute links in repo and org lists
- Downsize projects edit buttons
- Improve milestones and project list rendering
- Condense milestone list entry to a single line of "metas"
- Mute ".." button in repo files list

15 months agoMove some regexp out of functions (#25430)
John Olheiser [Wed, 21 Jun 2023 19:57:18 +0000 (14:57 -0500)]
Move some regexp out of functions (#25430)

/cc @KN4CK3R
https://github.com/go-gitea/gitea/pull/25294#discussion_r1237425343

I also searched the codebase and found a few more.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
15 months agoShow outdated comments in files changed tab (#24936)
sebastian-sauer [Wed, 21 Jun 2023 16:08:12 +0000 (18:08 +0200)]
Show outdated comments in files changed tab (#24936)

If enabled show a clickable label in the comment. A click on the label
opens the Conversation tab with the comment focussed - there you're able
to view the old diff (or original diff the comment was created on).

**Screenshots**

![image](https://github.com/go-gitea/gitea/assets/1135157/63ab9571-a9ee-4900-9f02-94ab0095f9e7)

![image](https://github.com/go-gitea/gitea/assets/1135157/78f7c225-8d76-46f5-acfd-9b8aab988a6c)

When resolved and outdated:

![image](https://github.com/go-gitea/gitea/assets/1135157/6ece9ebd-c792-4aa5-9c35-628694e9d093)

Option to enable/disable this (stored in user settings - default is
disabled):

![image](https://github.com/go-gitea/gitea/assets/1135157/ed99dfe4-76dc-4c12-bd96-e7e62da50ab5)

![image](https://github.com/go-gitea/gitea/assets/1135157/e837a052-e92e-4a28-906d-9db5bacf93a6)

fixes #24913

---------

Co-authored-by: silverwind <me@silverwind.io>
15 months agoRemove "CHARSET" config option for MySQL, always use "utf8mb4" (#25413)
wxiaoguang [Wed, 21 Jun 2023 10:49:25 +0000 (18:49 +0800)]
Remove "CHARSET" config option for MySQL, always use "utf8mb4" (#25413)

In modern days, there is no reason to make users set "charset" anymore.

Close #25378

## :warning: BREAKING

The key `[database].CHARSET` was removed completely as every newer
(>10years) MySQL database supports `utf8mb4` already.
There is a (deliberately) undocumented new fallback option if anyone
still needs to use it, but we don't recommend using it as it simply
causes problems.

15 months agoFine tune project board label colors and modal content background (#25419)
HesterG [Wed, 21 Jun 2023 10:15:51 +0000 (18:15 +0800)]
Fine tune project board label colors and modal content background (#25419)

- The label text color on project board is not contrasting enough,
changed to colors that are same as places that also used
`useLightTextOnBackground` function
([util_render.go](https://github.com/go-gitea/gitea/blob/2cdf260f42d178d23a8db70db35664511aeab31e/modules/templates/util_render.go#L136-L141),
[Context
Popup](https://github.com/go-gitea/gitea/blob/2cdf260f42d178d23a8db70db35664511aeab31e/web_src/js/components/ContextPopup.vue#L81-L84))

- background of modal `content` is `#ffffff` (from fomantic) right now,
which does not look good on dark mode, so changed to `var(--color-body)`

Before:

<img width="1378" alt="Screen Shot 2023-06-21 at 14 24 13"
src="https://github.com/go-gitea/gitea/assets/17645053/1527ca28-c884-4ca9-a4be-7a72ad1a093a">

<img width="900" alt="Screen Shot 2023-06-21 at 14 25 52"
src="https://github.com/go-gitea/gitea/assets/17645053/fab82116-7376-4027-a0a4-9eedf9fb0a30">

After:

<img width="1383" alt="Screen Shot 2023-06-21 at 14 19 33"
src="https://github.com/go-gitea/gitea/assets/17645053/fe0997e7-fee6-4522-bc4e-545088ec1cc8">

<img width="797" alt="Screen Shot 2023-06-21 at 14 32 42"
src="https://github.com/go-gitea/gitea/assets/17645053/b0591af0-950c-4448-9430-34d6c7215971">

15 months agoFix missing commit message body when the message has leading newlines (#25418)
Jason Song [Wed, 21 Jun 2023 09:14:34 +0000 (17:14 +0800)]
Fix missing commit message body when the message has leading newlines (#25418)

Commit with `echo "\nmessage after a blank line\nsecond line of the
message" | git commit --cleanup=verbatim -F -` and push.

<img width="1139" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/f9a2c28c-e307-4c78-9e31-3d3ace7b9274">

15 months agoadd python/poetry to devcontainer (#25407)
techknowlogick [Wed, 21 Jun 2023 08:44:58 +0000 (04:44 -0400)]
add python/poetry to devcontainer (#25407)

with introduction of linter, this adds python/poetry to devcontainer

15 months agoRefactor path & config system (#25330)
wxiaoguang [Wed, 21 Jun 2023 05:50:26 +0000 (13:50 +0800)]
Refactor path & config system (#25330)

# The problem

There were many "path tricks":

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

# The solution

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

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

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

## ⚠️ BREAKING

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

----

Close #24818
Close #24222
Close #21606
Close #21498
Close #25107
Close #24981
Maybe close #24503

Replace #23301
Replace #22754

And maybe more

15 months agoAdd actor and status dropdowns to run list (#25118)
HesterG [Wed, 21 Jun 2023 04:25:14 +0000 (12:25 +0800)]
Add actor and status dropdowns to run list (#25118)

Part of #25042

1. Added actor and status dropdowns first in case something is offtrack
and PR is too large.

2. Also added "No results matched." and "The workflow has no runs yet.",
and "No results matched." will show if there is no filter results and
there is no workflows (with [reference to github
action](https://github.com/go-gitea/gitea/actions/workflows/files-changed.yml?query=actor%3AGiteaBot))

Demo:

https://github.com/go-gitea/gitea/assets/17645053/6e76292c-4c1f-450d-8b48-99944cfc920c

TODOs:

- [x] Get available status (same as those in `aggregateJobStatus`)
instead of getting from database
- [x] Use `JOIN` to get actors, actors order by name
- [x] Make self on top

15 months agoUse the new download domain replace the old (#25405)
Lunny Xiao [Wed, 21 Jun 2023 03:11:17 +0000 (11:11 +0800)]
Use the new download domain replace the old (#25405)

As title.

15 months agoAvoid polluting config file when "save" (#25395)
wxiaoguang [Wed, 21 Jun 2023 02:31:40 +0000 (10:31 +0800)]
Avoid polluting config file when "save" (#25395)

That's a longstanding INI package problem: the "MustXxx" calls change
the option values, and the following "Save" will save a lot of garbage
options into the user's config file.

Ideally we should refactor the INI package to a clear solution, but it's
a huge work.

A clear workaround is what this PR does: when "Save", load a clear INI
instance and save it.

Partially fix #25377, the "install" page needs more fine tunes.

15 months agoFix dropdown icon layout on diff page (#25397)
wxiaoguang [Tue, 20 Jun 2023 23:22:48 +0000 (07:22 +0800)]
Fix dropdown icon layout on diff page (#25397)

Address
https://github.com/go-gitea/gitea/pull/25163#issuecomment-1599207916

Remove the unused  "icon-button".

And fix the layout:

Without the dropdown icon:

```
{{svg "gitea-whitespace"}}
```

![image](https://github.com/go-gitea/gitea/assets/2114189/58a524ba-f289-4982-aea2-6f9f9f9cbdcf)

With the dropdown icon:

```
{{svg "gitea-whitespace" 16 "gt-mr-3"}}
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
```

![image](https://github.com/go-gitea/gitea/assets/2114189/eb99168b-5d49-40a7-8665-5296cbb4e486)

15 months agoSupport configuration variables on Gitea Actions (#24724)
sillyguodong [Tue, 20 Jun 2023 22:54:15 +0000 (06:54 +0800)]
Support configuration variables on Gitea Actions (#24724)

Co-Author: @silverwind @wxiaoguang
Replace: #24404

See:
- [defining configuration variables for multiple
workflows](https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows)
- [vars
context](https://docs.github.com/en/actions/learn-github-actions/contexts#vars-context)

Related to:
- [x] protocol: https://gitea.com/gitea/actions-proto-def/pulls/7
- [x] act_runner: https://gitea.com/gitea/act_runner/pulls/157
- [x] act: https://gitea.com/gitea/act/pulls/43

#### Screenshoot
Create Variable:

![image](https://user-images.githubusercontent.com/33891828/236758288-032b7f64-44e7-48ea-b07d-de8b8b0e3729.png)

![image](https://user-images.githubusercontent.com/33891828/236758174-5203f64c-1d0e-4737-a5b0-62061dee86f8.png)

Workflow:
```yaml
  test_vars:
    runs-on: ubuntu-latest
    steps:
      - name: Print Custom Variables
        run: echo "${{ vars.test_key }}"
      - name: Try to print a non-exist var
        run: echo "${{ vars.NON_EXIST_VAR }}"
```

Actions Log:

![image](https://user-images.githubusercontent.com/33891828/236759075-af0c5950-368d-4758-a8ac-47a96e43b6e2.png)

---
This PR just implement the org / user (depends on the owner of the
current repository) and repo level variables, The Environment level
variables have not been implemented.
Because
[Environment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#about-environments)
is a module separate from `Actions`. Maybe it would be better to create
a new PR to do it.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoSubstitute variables in path names of template repos too (#25294)
Kyle D [Tue, 20 Jun 2023 21:14:47 +0000 (17:14 -0400)]
Substitute variables in path names of template repos too (#25294)

### Summary

Extend the template variable substitution to replace file paths. This
can be helpful for setting up log files & directories that should match
the repository name.

### PR Changes

 - Move files matching glob pattern when setting up repos from template
- For security, added ~escaping~ sanitization for cross-platform support
and to prevent directory traversal (thanks @silverwind for the
reference)
 - Added unit testing for escaping function
- Fixed the integration tests for repo template generation by passing
the repo_template_id
- Updated the integration testfiles to add some variable substitution &
assert the outputs

I had to fix the existing repo template integration test and extend it
to add a check for variable substitutions.

Example:

![image](https://github.com/go-gitea/gitea/assets/12700993/621feb09-0ef3-460e-afa8-da74cd84fa4e)

15 months agoNavbar styling rework (#25343)
silverwind [Tue, 20 Jun 2023 20:35:25 +0000 (22:35 +0200)]
Navbar styling rework (#25343)

- Extract navbar CSS to own file
- Reduce height from 52px to 50px
- Give every item a hover effect of of 36px, including the logo and on
mobile
- Consistent horizontal padding of 10px left and right

<img width="549" alt="Screenshot 2023-06-18 at 13 41 16"
src="https://github.com/go-gitea/gitea/assets/115237/0b00d101-253e-4b1f-9ee2-322d60fb2e26">

<img width="98" alt="Screenshot 2023-06-18 at 14 03 43"
src="https://github.com/go-gitea/gitea/assets/115237/4ef5d98b-4d1e-45de-822e-c2c844e19876">
<img width="234" alt="Screenshot 2023-06-18 at 14 03 18"
src="https://github.com/go-gitea/gitea/assets/115237/a4d9b04b-83de-42aa-a9ce-f010a9690688">

<img width="873" alt="Screenshot 2023-06-18 at 13 58 28"
src="https://github.com/go-gitea/gitea/assets/115237/8cb8e31e-2adf-40c8-ae3f-d00d011b4d1b">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
15 months agoFix blank dir message when uploading files from web editor (#25391)
Lunny Xiao [Tue, 20 Jun 2023 19:58:03 +0000 (03:58 +0800)]
Fix blank dir message when uploading files from web editor (#25391)

Fix #7883

15 months agoAdd git-lfs support to devcontainer (#25385)
yp05327 [Tue, 20 Jun 2023 19:28:46 +0000 (04:28 +0900)]
Add git-lfs support to devcontainer (#25385)

15 months agoUse qwtel.sqlite-viewer instead of alexcvzz.vscode-sqlite (#25386)
yp05327 [Tue, 20 Jun 2023 19:06:42 +0000 (04:06 +0900)]
Use qwtel.sqlite-viewer instead of alexcvzz.vscode-sqlite (#25386)

`alexcvzz.vscode-sqlite` doesn't work well in devcontainer.

qwtel.sqlite-viewer works well, maybe we can use this one instead.

15 months agoUse Actions git context instead of dynamically created buildkit one (#25381)
techknowlogick [Tue, 20 Jun 2023 05:37:32 +0000 (01:37 -0400)]
Use Actions git context instead of dynamically created buildkit one (#25381)

The [docker/build-push-action@v2
action](https://github.com/docker/build-push-action) by default ignores
the checkout created using the actions/checkout@v2 action. When you pass
a git build context to docker build, it wouldn't include the .git
directory.

By passing `context: .` to the build step then it'll use the Actions git
context which includes the git fetch from the earlier step.

15 months agorename tributeValues to mentionValues (#25375)
silverwind [Tue, 20 Jun 2023 03:32:49 +0000 (05:32 +0200)]
rename tributeValues to mentionValues (#25375)

Very simple change, just rename this variable so it does not feature the
name of the module.