]> source.dussan.org Git - gitea.git/log
gitea.git
19 months agoFix PR view misalignment caused by long name file (#23321)
Hester Gong [Mon, 6 Mar 2023 15:44:04 +0000 (23:44 +0800)]
Fix PR view misalignment caused by long name file (#23321)

Close #23248

The UI after this PR:

https://user-images.githubusercontent.com/17645053/223009758-7f0c9f12-d346-4cb2-a605-729fddce732f.mov

19 months agoAdd ActionRunStatus component (#23259)
yp05327 [Mon, 6 Mar 2023 14:35:24 +0000 (23:35 +0900)]
Add ActionRunStatus component (#23259)

Related to:
https://github.com/go-gitea/gitea/pull/23212#discussion_r1122856231

Decrease duplication of SvgIcon when display a run status svg.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoScoped labels: don't require holding alt key to remove (#23303)
Brecht Van Lommel [Mon, 6 Mar 2023 10:20:29 +0000 (11:20 +0100)]
Scoped labels: don't require holding alt key to remove (#23303)

Alt doesn't work on all browsers, the simplest solution for v1.19 is to
just not require it and toggle the label by just clicking.

Part of #22974

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoUpdate hacking-on-gitea-zh_cn documentation (#23315)
Lunny Xiao [Mon, 6 Mar 2023 07:14:00 +0000 (15:14 +0800)]
Update hacking-on-gitea-zh_cn documentation (#23315)

This PR fix outdated hacking-on-gitea-zh_cn documentation.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
19 months agoFix broken code editor diff preview (#23307)
wxiaoguang [Mon, 6 Mar 2023 01:37:58 +0000 (09:37 +0800)]
Fix broken code editor diff preview (#23307)

Close #23265, the code editor diff preview has been broken for long
time.

* Fix the regression for `data-line-num`
    * `.code-diff` is necessary to show the line number
* Fix the regression for #12434
* The diff:
[12434](https://github.com/go-gitea/gitea/pull/12434/files?diff=unified&w=1)
    * It hides the Type(4) (aka HunkHeader)  for unexpected cases.

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

Before: see the issue #23265

After:

![image](https://user-images.githubusercontent.com/2114189/222942810-286dc9af-0b39-4e9d-8585-8c299b881241.png)

19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 6 Mar 2023 00:15:51 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoAdd context when rendering labels or emojis (#23281)
Jonathan Tran [Sun, 5 Mar 2023 21:59:05 +0000 (16:59 -0500)]
Add context when rendering labels or emojis (#23281)

This branch continues the work of #23092 and attempts to rid the
codebase of any `nil` contexts when using a `RenderContext`.

Anything that renders markdown or does post processing may call
`markup.sha1CurrentPatternProcessor()`, and this runs
`git.OpenRepository()`, which needs a context. It will panic if the
context is `nil`. This branch attempts to _always_ include a context
when creating a `RenderContext` to prevent future crashes.

Co-authored-by: Kyle D <kdumontnu@gmail.com>
19 months agoChange interactiveBorder to fix popup preview (#23169)
Hester Gong [Sun, 5 Mar 2023 15:40:50 +0000 (23:40 +0800)]
Change interactiveBorder to fix popup preview  (#23169)

Close #23073.
Used the solution as reference to the reply:
https://github.com/go-gitea/gitea/issues/23073#issuecomment-1440124609
Here made the change inside the `contextpopup.js` because this is where
the popup component is created and tippy configuration is given.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoImprove the frontend guideline (#23298)
wxiaoguang [Sun, 5 Mar 2023 14:23:42 +0000 (22:23 +0800)]
Improve the frontend guideline (#23298)

### The CustomEvent prefix

There was already `ce-quick-submit`, the `ce-` prefix seems better than
`us-`. Rename the only `us-` prefixed `us-load-context-popup` to `ce-`
prefixed.

### Styles and Attributes in Go HTML Template

https://github.com/go-gitea/gitea/pull/21855#issuecomment-1429643073

Suggest to stick to `class="c1 {{if $var}}c2{{end}}"`

The readability and maintainability should be applied to the code which
is read by developers, but not for the generated outputs.

The template code is the code for developers, while the generated HTML
are only for browsers.

The `class="c1 {{if $var}}c2{{end}}"` style is clearer for developers
and more intuitive, and the generated HTML also makes browsers happy (a
few spaces do not affect anything)

Think about a more complex case:

* `class="{{if $active}}active{{end}} menu item {{if $show}}show{{end}}
{{if $warn}}warn{{end}}"`
* --vs--
* `class="{{if $active}}active {{end}}menu item{{if $show}}
show{{end}}{{if $warn}} warn{{end}}"`

The first style make it clearer to see each CSS class name with its
`{{if}}` block.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoScoped labels: set aria-disabled on muted Exclusive option for a11y (#23306)
Brecht Van Lommel [Sun, 5 Mar 2023 13:25:25 +0000 (14:25 +0100)]
Scoped labels: set aria-disabled on muted Exclusive option for a11y (#23306)

It is convenient to be able to toggle off this option after removing /
from the name. This ensures the muted state is communicated to blind
users even when the input is not fully disabled.

Part of #22974

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAdd basic documentation for labels, including scoped labels (#23304)
Brecht Van Lommel [Sun, 5 Mar 2023 12:35:12 +0000 (13:35 +0100)]
Add basic documentation for labels, including scoped labels (#23304)

Part of #22974

---------

Co-authored-by: delvh <dev.lh@web.de>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 5 Mar 2023 00:15:41 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoRe-add accidentally removed `hacking-on-gitea.zh-cn.md` (#23297)
Lunny Xiao [Sat, 4 Mar 2023 21:34:02 +0000 (05:34 +0800)]
Re-add accidentally removed `hacking-on-gitea.zh-cn.md` (#23297)

#21627 accidentally removed the docs file `hacking-on-gitea.zh-cn.md`.
This re-adds it and merges some changes from #23289

19 months agoAdd default owner team to privated_org and limited_org in unit test (#23109)
yp05327 [Sat, 4 Mar 2023 19:23:51 +0000 (04:23 +0900)]
Add default owner team to privated_org and limited_org in unit test (#23109)

Related to https://github.com/go-gitea/gitea/pull/22705 's CI result
[here](https://drone.gitea.io/go-gitea/gitea/68043/2/16)
> IsOrganizationOwner() [E] [63f61849-7] Organization does not have
owner team: 23

19 months agoImprove sed detection in update-locales.sh (#23254)
silverwind [Sat, 4 Mar 2023 14:29:28 +0000 (15:29 +0100)]
Improve sed detection in update-locales.sh (#23254)

- ~~Make scripts work from any directory~~
- Detect sed version just like Makefile does

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months agoSupport sanitising the URL by removing extra slashes in the URL (#21333)
Sandeep Bhat [Sat, 4 Mar 2023 13:31:24 +0000 (19:01 +0530)]
Support sanitising the URL by removing extra slashes in the URL (#21333)

Changes in this PR :

Strips incoming request URL of additional slashes (/). For example an
input like

`https://git.data.coop//halfd/new-website.git` is translated to
`https://git.data.coop/halfd/new-website.git`

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

Fix #23242

---------

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoMake Ctrl+Enter submit a pending comment (starting review) instead of submitting...
wxiaoguang [Sat, 4 Mar 2023 07:13:37 +0000 (15:13 +0800)]
Make Ctrl+Enter submit a pending comment (starting review) instead of submitting a single comment (#23245)

Close #23241

Before: press Ctrl+Enter in the Code Review Form, a single comment will
be added.

After: press Ctrl+Enter in the Code Review Form, start the review with
pending comments.

The old name `is_review` is not clear, so the new code use
`pending_review` as the new name.

Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoAvoid panic caused by broken payload when creating commit status (#23216)
Jason Song [Sat, 4 Mar 2023 07:12:37 +0000 (15:12 +0800)]
Avoid panic caused by broken payload when creating commit status (#23216)

When creating commit status for Actons jobs, a payload with nil
`HeadCommit` will cause panic.

Reported at:
https://gitea.com/gitea/act_runner/issues/28#issuecomment-732166

Although the `HeadCommit` probably can not be nil after #23215,
`CreateCommitStatus` should protect itself, to avoid being broken in the
future.

In addition, it's enough to print error log instead of returning err
when `CreateCommitStatus` failed.

---------

Co-authored-by: delvh <dev.lh@web.de>
19 months agoAdd run status in action view page (#23212)
yp05327 [Sat, 4 Mar 2023 05:41:37 +0000 (14:41 +0900)]
Add run status in action view page (#23212)

Before:

![image](https://user-images.githubusercontent.com/18380374/222084932-a7643fbe-2d9f-48db-b25d-74ace49e03f4.png)

![image](https://user-images.githubusercontent.com/18380374/222084887-fde3500d-dad3-4902-9c82-c4f71f23f83b.png)

After:

![image](https://user-images.githubusercontent.com/18380374/222084565-eeef1110-9d9d-40b4-a26b-fbd5a307f14e.png)

![image](https://user-images.githubusercontent.com/18380374/222084728-6c96d7c1-a399-43d5-8369-392ad5017b7f.png)

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoupdate to mermaid v10 (#23178)
techknowlogick [Sat, 4 Mar 2023 05:39:07 +0000 (00:39 -0500)]
update to mermaid v10 (#23178)

fix #23153

---------

Co-authored-by: silverwind <me@silverwind.io>
19 months agoFix code wrap for unbroken lines (#23268)
wxiaoguang [Sat, 4 Mar 2023 04:48:59 +0000 (12:48 +0800)]
Fix code wrap for unbroken lines (#23268)

## The Problem

`overflow-wrap: break-word` doesn't work well for unbroken lines. Use
`overflow-wrap: anywhere` instead, and remove legacy alias `word-wrap`

## Before

![image](https://user-images.githubusercontent.com/2114189/222743939-5f38d9e4-18d8-4ae0-8078-4b3a59195a30.png)

## After

![image](https://user-images.githubusercontent.com/2114189/222743833-0e0cfdbb-7b2e-420d-99f9-b1b45dde521a.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
19 months agoFix stray backticks appearing in pull request timeline (#23282)
Brecht Van Lommel [Sat, 4 Mar 2023 04:48:05 +0000 (05:48 +0100)]
Fix stray backticks appearing in pull request timeline (#23282)

Caused by #23189.

19 months agoFill head commit to in payload when notifying push commits for mirroring (#23215)
Jason Song [Sat, 4 Mar 2023 04:45:53 +0000 (12:45 +0800)]
Fill head commit to in payload when notifying push commits for mirroring (#23215)

Just like what has been done when pushing manually:

https://github.com/go-gitea/gitea/blob/7a5af25592003ddc3017fcd7b822a3e02fc40ef6/services/repository/push.go#L225-L226

Before:

<img width="448" alt="image"
src="https://user-images.githubusercontent.com/9418365/222100123-cd4839d1-2d4d-45f7-b7a0-0cbc73162b44.png">

After:

<img width="448" alt="image"
src="https://user-images.githubusercontent.com/9418365/222100225-f3c5bb65-7ab9-41e2-8e39-9d84c23c352d.png">

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix various bugs for "install" page (#23194)
wxiaoguang [Sat, 4 Mar 2023 02:12:02 +0000 (10:12 +0800)]
Fix various bugs for "install" page (#23194)

## TLDR

* Fix the broken page / broken image problem when click "Install"
* Close #20089
* Fix the Password Hash Algorithm display problem for #22942
* Close #23183
* Close #23184

## Details

### The broken page / broken image problem when click "Install"
(Redirect failed after install gitea #23184)

Before: when click "install", all new requests will fail, because the
server has been restarted. Users just see a broken page with broken
images, sometimes the server is not ready but the user would have been
redirect to "/user/login" page, then the users see a new broken page
(connection refused or something wrong ...)

After: only check InstallLock=true for necessary handlers, and sleep for
a while before restarting the server, then the browser has enough time
to load the "post-install" page. And there is a script to check whether
"/user/login" is ready, the user will only be redirected to the login
page when the server is ready.

### During new instance setup make 'Gitea Base URL' filled from
window.location.origin #20089

If the "app_url" input contains `localhost` (the default value from
config), use current window's location href as the `app_url` (aka
ROOT_URL)

### Fix the Password Hash Algorithm display problem for "Provide the
ability to set password hash algorithm parameters #22942"

Before: the UI shows `pbkdf2$50000$50`

<details>

![image](https://user-images.githubusercontent.com/2114189/221917143-e1e54798-1698-4fee-a18d-00c48081fc39.png)

</details>

After: the UI shows `pbkdf2`

<details>

![image](https://user-images.githubusercontent.com/2114189/221916999-97a15be8-2ebb-4a01-bf93-dac18e354fcc.png)

</details>

### GET data: net::ERR_INVALID_URL #23183

Cause by empty `data:` in `<link rel="manifest"
href="data:{{.ManifestData}}">`

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoFix GetFilesChangedBetween if the file name may be escaped (#23272)
zeripath [Fri, 3 Mar 2023 22:28:38 +0000 (22:28 +0000)]
Fix GetFilesChangedBetween if the file name may be escaped (#23272)

The code for GetFilesChangedBetween uses `git diff --name-only
base..head` to get the names of files changed between base and head
however this forgets that git will escape certain values.

This PR simply switches to use `-z` which has the `NUL` character as the
separator.

Ref https://github.com/go-gitea/gitea/pull/22568#discussion_r1123138096

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoSupport paste treepath when creating a new file or updating the file name (#23209)
Hester Gong [Fri, 3 Mar 2023 22:28:20 +0000 (06:28 +0800)]
Support paste treepath when creating a new file or updating the file name (#23209)

Close #23204

Quick Demo:

https://user-images.githubusercontent.com/17645053/222058727-ad30a37c-f0ac-4184-9946-a71fcee473b5.mov

---------

Co-authored-by: delvh <leon@kske.dev>
19 months agoFix grammar in error message (#23273)
ChristianSch [Fri, 3 Mar 2023 20:53:46 +0000 (21:53 +0100)]
Fix grammar in error message (#23273)

Fixes the grammar in the error message in case a runner token has
already been activated

19 months agoRevert relative links to absolute links in mail templates (#23267)
wxiaoguang [Fri, 3 Mar 2023 14:43:30 +0000 (22:43 +0800)]
Revert relative links to absolute links in mail templates (#23267)

Follow #21986 , fix regression.

The mail templates should always use `AppURL` (the full absolute URL)

19 months agoFix cannot reopen after pushing commits to a closed PR (#23189)
sillyguodong [Fri, 3 Mar 2023 13:16:58 +0000 (21:16 +0800)]
Fix cannot reopen after pushing commits to a closed PR (#23189)

Close: #22784

1. On GH, we can reopen a PR which was closed before after pushing
commits. After reopening PR, we can see the commits that were pushed
after closing PR in the time line. So the case of
[issue](https://github.com/go-gitea/gitea/issues/22784) is a bug which
needs to be fixed.

2. After closing a PR and pushing commits, `headBranchSha` is not equal
to `sha`(which is the last commit ID string of reference). If the
judgement exists, the button of reopen will not display. So, skip the
judgement if the status of PR is closed.

![image](https://user-images.githubusercontent.com/33891828/222037529-651fccf9-0bba-433e-b2f0-79c17e0cc812.png)

3. Even if PR is already close, we should still insert comment record
into DB when we push commits.
So we should still call  function `CreatePushPullComment()`.

https://github.com/go-gitea/gitea/blob/067b0c2664d127c552ccdfd264257caca4907a77/services/pull/pull.go#L260-L282
So, I add a switch(`includeClosed`) to the
`GetUnmergedPullRequestsByHeadInfo` func to control whether the status
of PR must be open. In this case, by setting `includeClosed` to `true`,
we can query the closed PR.

![image](https://user-images.githubusercontent.com/33891828/222621045-bb80987c-10c5-4eac-aa0c-1fb9c6aefb51.png)

4. In the loop of comments, I use the`latestCloseCommentID` variable to
record the last occurrence of the close comment.
In the go template, if the status of PR is closed, the comments whose
type is `CommentTypePullRequestPush(29)` after `latestCloseCommentID`
won't be rendered.

![image](https://user-images.githubusercontent.com/33891828/222058913-c91cf3e3-819b-40c5-8015-654b31eeccff.png)
e.g.
1). The initial status of the PR is opened.

![image](https://user-images.githubusercontent.com/33891828/222453617-33c5093e-f712-4cd6-8489-9f87e2075869.png)
2). Then I click the button of `Close`.  PR is closed now.

![image](https://user-images.githubusercontent.com/33891828/222453694-25c588a9-c121-4897-9ae5-0b13cf33d20b.png)
3). I try to push a commit to this PR, even though its current status is
closed.

![image](https://user-images.githubusercontent.com/33891828/222453916-361678fb-7321-410d-9e37-5a26e8095638.png)
But in comments list, this commit do not display.This is as expected :)

![image](https://user-images.githubusercontent.com/33891828/222454169-7617a791-78d2-404e-be5e-77d555f93313.png)
4). Click the `Reopen` button, the commit which is pushed after closing
PR display now.

![image](https://user-images.githubusercontent.com/33891828/222454533-897893b6-b96e-4701-b5cb-b1800f382b8f.png)

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoUse correct README link to render the README (#23152)
yp05327 [Fri, 3 Mar 2023 10:01:33 +0000 (19:01 +0900)]
Use correct README link to render the README (#23152)

`renderReadmeFile` needs `readmeTreelink` as parameter but gets
`treeLink`.
The values of them look like as following:
`treeLink`:  `/{OwnerName}/{RepoName}/src/branch/{BranchName}`
`readmeTreelink`:
`/{OwnerName}/{RepoName}/src/branch/{BranchName}/{ReadmeFileName}`

`path.Dir` in

https://github.com/go-gitea/gitea/blob/8540fc45b11eff9a73753ca139f8ea5c38509bf5/routers/web/repo/view.go#L316
should convert `readmeTreelink` into
`/{OwnerName}/{RepoName}/src/branch/{BranchName}` instead of the current
`/{OwnerName}/{RepoName}/src/branch`.

Fixes #23151

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
19 months agoAdd document for `webcomponents` (#23261)
wxiaoguang [Fri, 3 Mar 2023 09:45:19 +0000 (17:45 +0800)]
Add document for `webcomponents` (#23261)

19 months agoUse async await to fix empty quote reply at first time (#23168) 23287/head
HesterG [Thu, 2 Mar 2023 19:53:22 +0000 (03:53 +0800)]
Use async await to fix empty quote reply at first time (#23168)

The reason why quote reply is empty is when quote reply is clicked, it
triggers the click function on `.comment-form-reply` button, and when
the first time this function is triggered, easyMDE for the reply has not
yet initialized, so that click handler of `.quote-reply` button in
`repo-legacy.js` got an `undefined` as easyMDE, and the following lines
which put quoted reply into the easyMDE is not executed.
The workaround in this PR is to pass the replied content to
'.comment-form-reply' button if easyMDE is not yet initialized (quote
reply first clicked) and put the replied content into it the after
easyMDE is created.
Now quote reply on first click:

https://user-images.githubusercontent.com/17645053/221452823-fc699d50-1649-4af1-952e-f04fc8d2978e.mov

<br />

Update:
The above change is not appropriate as stated in the
[comment](https://github.com/go-gitea/gitea/pull/23168#issuecomment-1445562284)
Use await instead

Close #22075.
Close #23247.

19 months agoFix switched citation format (#23250)
Blender Defender [Thu, 2 Mar 2023 19:08:02 +0000 (20:08 +0100)]
Fix switched citation format (#23250)

Due to switched input parameters, the citation texts for Bibtex and Apa
were switched.
This pull request fixes #23244

19 months agoImprove update-locales script and fix locale processing bug (#23240)
wxiaoguang [Thu, 2 Mar 2023 18:33:36 +0000 (02:33 +0800)]
Improve update-locales script and fix locale processing bug (#23240)

The locales of Gitea has been broken for long time, till now, it's still
not fully fixed.

One of the root problems is that the `ini` library is quite quirky and
the `update-locales` script doesn't work well for all cases.

This PR fixes the `update-locales` script to make it satisfy `ini`
library and the crowdin.

See the comments for more details.

The `locale_zh-CN.ini` is an example, it comes from crowdin and is
processed by the new `update-locales.sh`. Especially see the `feed_of`:
https://github.com/go-gitea/gitea/pull/23240/files#diff-321f6ca4eae1096eba230e93c4740f9903708afe8d79cf2e57f4299786c4528bR268

19 months agoRefactor `ctx` in templates (#23105)
wxiaoguang [Thu, 2 Mar 2023 17:44:06 +0000 (01:44 +0800)]
Refactor `ctx` in templates (#23105)

Before, the `dict "ctx" ...` map is used to pass data between templates.

Now, more and more templates need to use real Go context:

* #22962
* #23092

`ctx` is a Go concept for `Context`, misusing it may cause problems, and
it makes it difficult to review or refactor.

This PR contains 2 major changes:

* In the top scope of a template, the `$` is the same as the `.`, so the
old labels_sidebar's `root` is the `ctx`. So this `ctx` could just be
removed.
https://github.com/go-gitea/gitea/commit/bd7f218dce01e0fb661b23b55995f5d51b4530e8
* Rename all other `ctx` to `ctxData`, and it perfectly matches how it
comes from backend: `"ctxData": ctx.Data`.
https://github.com/go-gitea/gitea/pull/23105/commits/7c01260e1df1dcb052e1cf86ebe982bf77c4407f

From now on, there is no `ctx` in templates. There are only:

* `ctxData` for passing data
* `Context` for Go context

19 months agoImprove frontend guideline (#23252)
wxiaoguang [Thu, 2 Mar 2023 16:46:47 +0000 (00:46 +0800)]
Improve frontend guideline (#23252)

If an event listener must be `async`, the `e.preventDefault()` should be
before any `await`,
it's recommended to put it at the beginning of the function.

19 months agoClose the temp file when dumping database to make the temp file can be deleted on...
wxiaoguang [Thu, 2 Mar 2023 15:57:31 +0000 (23:57 +0800)]
Close the temp file when dumping database to make the temp file can be deleted on Windows (#23249)

There was no `dbDump.Close()` before, Windows doesn't like to delete
opened files.

19 months agoFix commit retrieval by tag (#21804)
silverwind [Thu, 2 Mar 2023 05:32:21 +0000 (06:32 +0100)]
Fix commit retrieval by tag (#21804)

It is not correct to return tag data when commit data is requested, so
remove the hacky code that overwrote parts of a commit with parts of a
tag.

This fixes commit retrieval by tag for both the latest commit in the UI
and the commit info on tag webhook events.

Fixes: https://github.com/go-gitea/gitea/issues/21687
Replaces: https://github.com/go-gitea/gitea/pull/21693

<img width="324" alt="Screenshot 2022-11-13 at 15 26 37"
src="https://user-images.githubusercontent.com/115237/201526975-736c6ea7-ad6a-467a-a823-9a63d6ecb718.png">

<img width="789" alt="image"
src="https://user-images.githubusercontent.com/115237/201526876-90a13ffc-1e5c-4d76-911b-f1ae51e8eaab.png">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix missed `.hide` class (#23208)
yp05327 [Thu, 2 Mar 2023 04:22:04 +0000 (13:22 +0900)]
Fix missed `.hide` class (#23208)

https://github.com/go-gitea/gitea/pull/22950 removed `hide` class, and
use `gt-hidden`
But there are some missed `hide`....

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 2 Mar 2023 00:23:09 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoAdd loading yaml label template files (#22976)
Lauris BH [Wed, 1 Mar 2023 23:44:23 +0000 (01:44 +0200)]
Add loading yaml label template files (#22976)

Extract from #11669 and enhancement to #22585 to support exclusive
scoped labels in label templates

* Move label template functionality to label module
* Fix handling of color codes
* Add Advanced label template

19 months agoAllow `<video>` in MarkDown (#22892)
Sybren [Wed, 1 Mar 2023 21:30:51 +0000 (22:30 +0100)]
Allow `<video>` in MarkDown (#22892)

As you can imagine, for the Blender development process it is rather
nice to be able to include videos in issues, pull requests, etc.

This PR allows the `<video>` HTML tag to be used in MarkDown, with the
`src`, `autoplay`, and `controls` attributes.

## Help Needed

To have this fully functional, personally I feel the following things
are still missing, and would appreciate some help from the Gitea team.

### Styling

Some CSS is needed, but I couldn't figure out which of the LESS files
would work. I tried `web_src/less/markup/content.less` and
`web_src/less/_base.less`, but after running `make` the changes weren't
seen in the frontend.

This I would consider a minimal set of CSS rules to be applied:

```css
video {
  max-width: 100%;
  max-height: 100vh;
}
```

### Default Attributes

It would be fantastic if Gitea could add some default attributes to the
`<video>` tag. Basically `controls` should always be there, as there is
no point in disallowing scrolling through videos, looping them, etc.

### Integration with the attachments system

Another thing that could be added, but probably should be done in a
separate PR, is the integration with the attachments system. Dragging in
a video should attach it, then generate the appropriate MarkDown/HTML.

19 months agoPull Requests: add button to compare force pushed commits (#22857)
Brecht Van Lommel [Wed, 1 Mar 2023 19:19:47 +0000 (20:19 +0100)]
Pull Requests: add button to compare force pushed commits (#22857)

To quickly see what changed without having to re-read the whole diff.

19 months agoDo not create commit graph for temporary repos (#23219)
Brecht Van Lommel [Wed, 1 Mar 2023 19:19:04 +0000 (20:19 +0100)]
Do not create commit graph for temporary repos (#23219)

When fetching remotes for conflict checking, skip unnecessary and
potentially slow writing of commit graphs.

In a test with the Blender repository, this reduces conflict checking
time for one pull request from about 2s to 0.1s.

19 months agoUse the correct selector to hide the checkmark of selected labels on clear (#23224)
wxiaoguang [Wed, 1 Mar 2023 19:18:35 +0000 (03:18 +0800)]
Use the correct selector to hide the checkmark of selected labels on clear (#23224)

Regression of #10107
(https://github.com/go-gitea/gitea/pull/10107/files#diff-a15e36f2f9c13339f7fdd38bc2887db2ff2945cb8434464318ab9105fcc846bdR460)

Fix #22222

Before: the "clear" action couldn't remove these check marks.

![image](https://user-images.githubusercontent.com/2114189/222212998-c9f33459-b71d-4e80-8588-2935f3b7050c.png)

After: the "clear" action can remove these  check marks.

![image](https://user-images.githubusercontent.com/2114189/222213048-2be98ed0-cac0-4e27-b72c-1dd0ac2637d5.png)

19 months agoOrder pull request conflict checking by recently updated, for each push (#23220)
Brecht Van Lommel [Wed, 1 Mar 2023 19:14:02 +0000 (20:14 +0100)]
Order pull request conflict checking by recently updated, for each push (#23220)

When a change is pushed to the default branch and many pull requests are
open for that branch, conflict checking can take some time.

Previously it would go from oldest to newest pull request. Now
prioritize pull requests that are likely being actively worked on or
prepared for merging.

This only changes the order within one push to one repository, but the
change is trivial and can already be quite helpful for smaller Gitea
instances where a few repositories have most pull requests. A global
order would require deeper changes to queues.

19 months agoFix incorrect checkbox behaviors in the dashboard repolist's filter (#23147)
wxiaoguang [Wed, 1 Mar 2023 02:22:14 +0000 (10:22 +0800)]
Fix incorrect checkbox behaviors in the dashboard repolist's filter (#23147)

Co-author: yp05327 , this PR is based on yp05327's #22813.

The problems of the old DashboardRepoList / repolist.tmpl:

* It mixes many different frameworks together
* It "just works", bug on bug
* It uses many anti-pattern of Vue

This PR:

* Fix bugs and close #22800
* Decouple the "checkbox" elements from Fomantic UI (only use CSS
styles)
* Simplify the HTML layout
* Simplify JS logic
* Make it easier to refactor the DashboardRepoList into a pure Vue
component in the future.

### Screenshots

#### Default

![image](https://user-images.githubusercontent.com/2114189/221355768-a3eb5b23-85b4-4e3d-b906-844d8b15539d.png)

####  Click "Archived" to make it checked

![image](https://user-images.githubusercontent.com/2114189/221355777-9a104ddf-52a7-4504-869a-43a73827d802.png)

####  Click "Archived" to make it intermediate

![image](https://user-images.githubusercontent.com/2114189/221355802-0f67a073-67ad-4e92-84a6-558c432103a5.png)

####  Click "Archived" to make it unchecked

![image](https://user-images.githubusercontent.com/2114189/221355810-acf1d9d8-ccce-47fe-a02e-70cf4e666331.png)

---------

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 1 Mar 2023 00:16:03 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoProperly flush unique queues on startup (#23154)
zeripath [Tue, 28 Feb 2023 22:55:43 +0000 (22:55 +0000)]
Properly flush unique queues on startup (#23154)

There have been a number of reports of PRs being blocked whilst being
checked which have been difficult to debug. In investigating #23050 I
have realised that whilst the Warn there is somewhat of a miscall there
was a real bug in the way that the LevelUniqueQueue was being restored
on start-up of the PersistableChannelUniqueQueue.

Next there is a conflict in the setting of the internal leveldb queue
name - This wasn't being set so it was being overridden by other unique
queues.

This PR fixes these bugs and adds a testcase.

Thanks to @brechtvl  for noticing the second issue.

Fix #23050
and others

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoUse context parameter in services/repository (#23186)
Jason Song [Tue, 28 Feb 2023 22:17:51 +0000 (06:17 +0800)]
Use context parameter in services/repository (#23186)

Use context parameter in `services/repository`.

And use `cache.WithCacheContext(ctx)` to generate push action history
feeds.

Fix #23160

19 months agoPass `--global` when calling `git config --get`, for consistency with `git config...
Philip Peterson [Tue, 28 Feb 2023 21:26:19 +0000 (16:26 -0500)]
Pass `--global` when calling `git config --get`, for consistency with `git config --set` (#23157)

This arose out of #22451; it seems we are checking using non-global
settings to see if a config value is set, in order to decide whether to
call another global(-indeed) configuration command. This PR changes it
so that both the check and the set are for global configuration.

19 months agoMake `gitea serv` respect git binary home (#23138)
wxiaoguang [Tue, 28 Feb 2023 20:33:10 +0000 (04:33 +0800)]
Make `gitea serv` respect git binary home (#23138)

Close #23137

The old code is too old (8-9 years ago)

Let's try to execute the git commands from git bin home directly.

The verb has been checked above, it could only be:
* git-upload-pack
* git-upload-archive
* git-receive-pack
* git-lfs-authenticate

19 months agoWrite Gitpod `app.ini` only once (#23192)
Yarden Shoham [Tue, 28 Feb 2023 15:30:43 +0000 (17:30 +0200)]
Write Gitpod `app.ini` only once (#23192)

Before this change, the `app.ini` would get overwritten on each
workspace start, confusing Gitea. It asked for reinstallation each time.
This makes sure the file is written only once by checking it does not
exist before creating it.

---
[Review without whitespace
diff](https://github.com/go-gitea/gitea/pull/23192/files?w=1)

---------

Co-authored-by: delvh <dev.lh@web.de>
19 months agoAvoid too long names for actions (#23162)
Jason Song [Tue, 28 Feb 2023 10:20:36 +0000 (18:20 +0800)]
Avoid too long names for actions (#23162)

The name of the job or step comes from the workflow file, while the name
of the runner comes from its registration. If the strings used for these
names are too long, they could cause db issues.

19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 28 Feb 2023 00:15:54 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoChange button text for commenting and closing an issue at the same time (#23135)
wxiaoguang [Mon, 27 Feb 2023 23:13:52 +0000 (07:13 +0800)]
Change button text for commenting and closing an issue at the same time (#23135)

Close  #10468

Without SimpleMDE/EasyMDE, using Simple Textarea, the button text could
be changed when content changes.

After introducing SimpleMDE/EasyMDE, there is no code for updating the
button text.

19 months agoDon't run unnecessary steps when only docs changed (#23103)
Lunny Xiao [Mon, 27 Feb 2023 22:20:42 +0000 (06:20 +0800)]
Don't run unnecessary steps when only docs changed (#23103)

Remove some unnecessary steps from drone when only docs changed.

ref: https://drone.gitea.io/go-gitea/gitea/68090/1/3

19 months agoAdd word-break to sidebar-item-link (#23146)
yp05327 [Mon, 27 Feb 2023 20:19:50 +0000 (05:19 +0900)]
Add word-break to sidebar-item-link (#23146)

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

![image](https://user-images.githubusercontent.com/18380374/221351117-1e4b8922-04ca-4717-8e3b-c338a61bc062.png)

Co-authored-by: delvh <leon@kske.dev>
19 months agoSpeed up HasUserStopwatch & GetActiveStopwatch (#23051)
zeripath [Mon, 27 Feb 2023 18:46:00 +0000 (18:46 +0000)]
Speed up HasUserStopwatch & GetActiveStopwatch (#23051)

GetActiveStopwatch & HasUserStopwatch is a hot piece of code that is
repeatedly called and on examination of the cpu profile for TestGit it
represents 0.44 seconds of CPU time. This PR reduces this time to 80ms.

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <leon@kske.dev>
19 months agoAdd InsecureSkipVerify to Minio Client for Storage (#23166)
Yarden Shoham [Mon, 27 Feb 2023 16:26:13 +0000 (18:26 +0200)]
Add InsecureSkipVerify to Minio Client for Storage (#23166)

Allows using Minio with untrusted certificates

Closes #23128

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
19 months agoFix Fomantic UI's `touchstart` fastclick, always use `click` for click events (#23065)
wxiaoguang [Mon, 27 Feb 2023 14:43:04 +0000 (22:43 +0800)]
Fix Fomantic UI's `touchstart` fastclick, always use `click` for click events (#23065)

Using `touchstart` for `click` events is a black magic for mobile
browsers (Google: `fastclick`).

However, it causes many UX problems if the fastclick is used without
careful design.

Fomantic UI uses this fastclick for its `dimmer` and `dropdown`, it
makes mobile users feel strange when they "touch" the dropdown menu.

This PR uses a simple patch to fix that behavior. Then the Fomantic
dropdown only uses `click` for click events.

This PR is simple enough and won't cause hidden bugs even if the patch
doesn't work. In the future, if there are more patches for Fomantic UI,
the patches could be placed in a directory like
`web_src/fomantic/patches/001-fix-click-touchstart`, etc.

![image](https://user-images.githubusercontent.com/2114189/220551915-bd28e8cc-507f-43c7-bb4a-b24f7ff3934d.png)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoRemove useless comment in #23114 (#23173)
Zettat123 [Mon, 27 Feb 2023 12:24:33 +0000 (20:24 +0800)]
Remove useless comment in #23114 (#23173)

The `isAdmin` param is no longer used so the comment should be removed.

https://github.com/go-gitea/gitea/blob/d27d36f2f4dd389050e613967ad2a5d02d250acc/routers/web/explore/repo.go#L36-L37

19 months agoRemove xin-u from maintainers (#23170)
xin-u [Mon, 27 Feb 2023 08:20:57 +0000 (16:20 +0800)]
Remove xin-u from maintainers (#23170)

19 months agoRevert "[skip ci] Updated translations via Crowdin" (#23167)
Lunny Xiao [Mon, 27 Feb 2023 00:58:38 +0000 (08:58 +0800)]
Revert "[skip ci] Updated translations via Crowdin" (#23167)

19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 27 Feb 2023 00:15:23 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoReturn 404 instead of 403 if user can not access the repo (#23155)
yp05327 [Sun, 26 Feb 2023 10:22:42 +0000 (19:22 +0900)]
Return 404 instead of 403 if user can not access the repo (#23155)

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

Before:

![image](https://user-images.githubusercontent.com/18380374/221390802-2317c6bc-d163-4def-b68b-6bb297143fe2.png)

After:

![image](https://user-images.githubusercontent.com/18380374/221390823-87490351-39c3-4a40-b1d2-11fc5b85fa24.png)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 26 Feb 2023 00:15:26 +0000 (00:15 +0000)]
[skip ci] Updated licenses and gitignores

19 months agoFix secrets overview page missing from docs sidebar (#23143)
Yarden Shoham [Sat, 25 Feb 2023 09:56:02 +0000 (11:56 +0200)]
Fix secrets overview page missing from docs sidebar (#23143)

There was a warning while building the docs: `Building sites … WARN
2023/02/25 08:56:37
"/workspace/gitea/docs/content/doc/secrets/overview.en-us.md:1:1":
duplicate menu entry with identifier "overview" in menu "sidebar"`.

### Before

![image](https://user-images.githubusercontent.com/20454870/221348741-55cef254-f2ac-4507-9a66-818b406c668f.png)

### After

![image](https://user-images.githubusercontent.com/20454870/221348757-42066303-e1b7-43fe-9c4f-e05182fbabdd.png)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
19 months agoAdd "Reviewed by you" filter for pull requests (#22927)
Brecht Van Lommel [Sat, 25 Feb 2023 02:55:50 +0000 (03:55 +0100)]
Add "Reviewed by you" filter for pull requests (#22927)

This includes pull requests that you approved, requested changes or
commented on. Currently such pull requests are not visible in any of the
filters on /pulls, while they may need further action like merging, or
prodding the author or reviewers.

Especially when working with a large team on a repository it's helpful
to get a full overview of pull requests that may need your attention,
without having to sift through the complete list.

19 months agoProjects: rename Board to Column in interface and improve consistency (#22767)
Brecht Van Lommel [Fri, 24 Feb 2023 23:10:50 +0000 (00:10 +0100)]
Projects: rename Board to Column in interface and improve consistency (#22767)

19 months agoFix DBConsistency checks on MSSQL (#23132)
zeripath [Fri, 24 Feb 2023 21:45:55 +0000 (21:45 +0000)]
Fix DBConsistency checks on MSSQL (#23132)

Unfortunately xorm's `builder.Select(...).From(...)` does not escape the
table names. This is mostly not a problem but is a problem with the
`user` table.

This PR simply escapes the user table. No other uses of `From("user")`
where found in the codebase so I think this should be all that is
needed.

Fix #23064

Signed-off-by: Andrew Thornton <art27@cantab.net>
19 months agoAdd pagination for dashboard and user activity feeds (#22937)
Brecht Van Lommel [Fri, 24 Feb 2023 21:15:10 +0000 (22:15 +0100)]
Add pagination for dashboard and user activity feeds (#22937)

Previously only the last few activities where available. This works for
all activity and for activity on a date chosen on the heatmap.

19 months agoUpdate go.mod dependencies (#23126)
zeripath [Fri, 24 Feb 2023 20:18:49 +0000 (20:18 +0000)]
Update go.mod dependencies (#23126)

This PR does a bulk update of a lot of our go deps.

I have not included nektos/act and xorm for the following reasons:
* Xorm updates can sometimes be complex and I'd rather do that in a
separate PR
* I think people more update with the actions code should double check
that the latest nektos/act library works correctly.

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoShow empty repos in Admin Repository Management page (#23114)
Zettat123 [Fri, 24 Feb 2023 19:11:31 +0000 (03:11 +0800)]
Show empty repos in Admin Repository Management page (#23114)

The **Admin Repository Management** page and the **Explore Repository**
page both use the `RenderRepoSearch` function. In this function, the
`OnlyShowRelevant` search option is `true` when querying repositories
for admin page.

https://github.com/go-gitea/gitea/blob/edf98a2dc30956c8e04b778bb7f1ce55c14ba963/routers/web/explore/repo.go#L99-L115

Refer to
[#19361](https://github.com/go-gitea/gitea/pull/19361/files#diff-8058dfb85557010e0592d586675ec62ce406af7068e6311f39c160deac37f149R497),
the repositories with `is_empty=true` will be hidden if
`OnlyShowRelevant` is `true`.

Administrators should be able to see all repositories. So
`OnlyShowRelevant` shouldn't be set to `true` .

---------

Co-authored-by: Andrew Thornton <art27@cantab.net>
19 months agoRedirect to the commit page after applying patch (#23056)
yp05327 [Fri, 24 Feb 2023 16:56:41 +0000 (01:56 +0900)]
Redirect to the commit page after applying patch (#23056)

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

19 months agoBump go.etcd.io/bbolt and blevesearch deps (#23062)
WÁNG Xuěruì [Fri, 24 Feb 2023 15:45:28 +0000 (23:45 +0800)]
Bump go.etcd.io/bbolt and blevesearch deps (#23062)

This notably brings support for GOARCH=loong64, among other fixes.

---------

Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
Co-authored-by: zeripath <art27@cantab.net>
19 months agoFix height for sticky head on large screen on PR page (#23111)
HesterG [Fri, 24 Feb 2023 14:29:49 +0000 (22:29 +0800)]
Fix height for sticky head on large screen on PR page (#23111)

Right now on the PR 'File Change' Tab, the file title header sticky to
the top on large screens has wrong height, resulting in wrong ui
behavior when scrolling down. This PR is to fix this.

Before:

<img width="964" alt="截屏2023-02-24 17 12 29"
src="https://user-images.githubusercontent.com/17645053/221140409-025c4a84-6bbe-4b5b-a13f-bd2b79063522.png">

After:
<img width="1430" alt="截屏2023-02-24 21 10 12"
src="https://user-images.githubusercontent.com/17645053/221186750-0344d652-4610-4a90-a4c0-7f6269f950d6.png">

19 months agoFix db.Find bug (#23115)
Lunny Xiao [Fri, 24 Feb 2023 13:17:09 +0000 (21:17 +0800)]
Fix db.Find bug (#23115)

Caused by #20821

Fix #23110

19 months agoAvoid warning for system setting when start up (#23054)
Lunny Xiao [Fri, 24 Feb 2023 10:23:13 +0000 (18:23 +0800)]
Avoid warning for system setting when start up (#23054)

Partially fix #23050

After #22294 merged, it always has a warning log like `cannot get
context cache` when starting up. This should not affect any real life
but it's annoying. This PR will fix the problem. That means when
starting up, getting the system settings will not try from the cache but
will read from the database directly.

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
19 months agoRequire approval to run actions for fork pull request (#22803)
Jason Song [Fri, 24 Feb 2023 07:58:49 +0000 (15:58 +0800)]
Require approval to run actions for fork pull request (#22803)

Currently, Gitea will run actions automatically which are triggered by
fork pull request. It's a security risk, people can create a PR and
modify the workflow yamls to execute a malicious script.

So we should require approval for first-time contributors, which is the
default strategy of a public repo on GitHub, see [Approving workflow
runs from public
forks](https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks).

Current strategy:

- don't need approval if it's not a fork PR;
- always need approval if the user is restricted;
- don't need approval if the user can write;
- don't need approval if the user has been approved before;
- otherwise, need approval.

https://user-images.githubusercontent.com/9418365/217207121-badf50a8-826c-4425-bef1-d82d1979bc81.mov

GitHub has an option for that, you can see that at
`/<owner>/<repo>/settings/actions`, and we can support that later.

<img width="835" alt="image"
src="https://user-images.githubusercontent.com/9418365/217199990-2967e68b-e693-4e59-8186-ab33a1314a16.png">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix nil context in RenderMarkdownToHtml (#23092)
Zettat123 [Fri, 24 Feb 2023 06:36:07 +0000 (14:36 +0800)]
Fix nil context in RenderMarkdownToHtml (#23092)

Fix #23082.

This bug is caused by a nil context in
https://github.com/go-gitea/gitea/issues/23082#issuecomment-1441276546 .

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAdd HesterG to maintainers (#23104)
HesterG [Fri, 24 Feb 2023 06:31:02 +0000 (14:31 +0800)]
Add HesterG to maintainers (#23104)

[List of mine merged
PR](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3AHesterG+is%3Amerged+)

19 months agoimprove FindProjects (#23085)
yp05327 [Fri, 24 Feb 2023 05:18:52 +0000 (14:18 +0900)]
improve FindProjects (#23085)

I found `FindAndCount` which can `Find` and `Count` in the same time
Maybe it is better to use it in `FindProjects`

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoMake issue meta dropdown support Enter, confirm before reloading (#23014)
wxiaoguang [Fri, 24 Feb 2023 01:26:27 +0000 (09:26 +0800)]
Make issue meta dropdown support Enter, confirm before reloading (#23014)

As the title. Label/assignee share the same code.

* Close #22607
* Close #20727

Also:

* partially fix for #21742, now the comment reaction and menu work with
keyboard.
* partially fix for #17705, in most cases the comment won't be lost.
* partially fix for #21539
* partially fix for #20347
* partially fix for #7329

### The `Enter` support

Before, if user presses Enter, the dropdown just disappears and nothing
happens or the window reloads.

After, Enter can be used to select/deselect labels, and press Esc to
hide the dropdown to update the labels (still no way to cancel ....
maybe you can do a Cmd+R or F5 to refresh the window to discard the
changes .....)

This is only a quick patch, the UX is still not perfect, but it's much
better than before.

### The `confirm` before reloading

And more fixes for the `reload` problem, the new behaviors:

* If nothing changes (just show/hide the dropdown), then the page won't
be reloaded.
* If there are draft comments, show a confirm dialog before reloading,
to avoid losing comments.

That's the best effect can be done at the moment, unless completely
refactor these dropdown related code.

Screenshot of the confirm dialog:

<details>

![image](https://user-images.githubusercontent.com/2114189/220538288-e2da8459-6a4e-43cb-8596-74057f8a03a2.png)

</details>

---------

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix SyncOnCommit always return false in API of push_mirrors (#23088)
sillyguodong [Thu, 23 Feb 2023 21:50:33 +0000 (05:50 +0800)]
Fix SyncOnCommit always return false in API of push_mirrors (#23088)

Fix: #22990

---
Before, the return value of the api is always false,regrardless of
whether the entry of `sync_on_commit` is true or false.
I have confirmed that the value of `sync_on_commit` dropped into the
database is correct.
So, I think it is enough to make some small changes.

19 months agoFix commit name in Apply Patch page (#23086)
yp05327 [Thu, 23 Feb 2023 21:14:07 +0000 (06:14 +0900)]
Fix commit name in Apply Patch page (#23086)

Fixes
https://github.com/go-gitea/gitea/issues/22621#issuecomment-1439309200

19 months agoAdd wrapper to author to avoid long name ui problem (#23030)
HesterG [Thu, 23 Feb 2023 20:28:18 +0000 (04:28 +0800)]
Add wrapper to author to avoid long name ui problem (#23030)

This PR is a possible solution for issue #22866. Main change is to add a
`author-wrapper` class around author name, like the wrapper added to
message. The `max-width` is set to 200px on PC, and 100px on mobile
device for now.

19 months agoAvoid Hugo from adding quote to actions url (#23097)
Sven [Thu, 23 Feb 2023 17:19:52 +0000 (18:19 +0100)]
Avoid Hugo from adding quote to actions url (#23097)

19 months agoRemove all package data after tests (#22984)
KN4CK3R [Thu, 23 Feb 2023 14:11:56 +0000 (15:11 +0100)]
Remove all package data after tests (#22984)

Fixes #21020

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
19 months agoChange style to improve whitespaces trimming inside inline markdown code (#23093)
HesterG [Thu, 23 Feb 2023 12:57:03 +0000 (20:57 +0800)]
Change style to improve whitespaces trimming inside inline markdown code  (#23093)

Given mardown source
```
x ` a` y
x `a ` y
x ` a ` y
```

Render

<img width="1421" alt="2023-02-23 15 33 14"
src="https://user-images.githubusercontent.com/17645053/220844280-a304c788-ac79-4a26-a55a-0db00f2fb3f3.png">

Fixes #23080.

19 months agoNest metadata in refactoring docs (#23087)
techknowlogick [Thu, 23 Feb 2023 08:25:18 +0000 (03:25 -0500)]
Nest metadata in refactoring docs (#23087)

Whitespace was missing from refactoring docs metadata.

backport label applied so it is included in versioned docs.

19 months agoImprove reverse proxies documentation (#23068)
Joakim Pettersen [Thu, 23 Feb 2023 07:34:09 +0000 (08:34 +0100)]
Improve reverse proxies documentation (#23068)

Add "Traefik with a sub-path" documentation

closes #23047

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoImprove accessibility for issue comments (#22612)
Andre Polykanine [Thu, 23 Feb 2023 02:24:24 +0000 (03:24 +0100)]
Improve accessibility for issue comments (#22612)

Currently in Gitea issue comments are not marked up with headings. I'm
trying to fix this by adding an appropriate
[ARIA](https://www.w3.org/WAI/standards-guidelines/aria/) role for
comment header and also by enclosing the comment itself in a semantical
article element.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months agoWrap unless-check in docker manifests (#23079)
John Olheiser [Wed, 22 Feb 2023 22:33:31 +0000 (16:33 -0600)]
Wrap unless-check in docker manifests (#23079)

Should fix the following:
> failed to render template: Evaluation error: Helper 'unless' called
with wrong number of arguments, needed 2 but got 3

Signed-off-by: jolheiser <john.olheiser@gmail.com>
19 months agoAdd accessibility to the menu on the navbar (#23059)
HesterG [Wed, 22 Feb 2023 21:58:07 +0000 (05:58 +0800)]
Add accessibility to the menu on the navbar (#23059)

This PR is trying to add accessibility to the menu as mentioned in
#23053 so the menu can be accessed using keyboard (A quick demo is added
below), with a reference to
[PR2612](https://github.com/go-gitea/gitea/pull/22612). The goal is to
make the menu accessible merely using keyboard like shown below. And
this PR might need confirmation from developers using screen readers.

19 months agoUse minio/sha256-simd for accelerated SHA256 (#23052)
zeripath [Wed, 22 Feb 2023 19:21:46 +0000 (19:21 +0000)]
Use minio/sha256-simd for accelerated SHA256 (#23052)

minio/sha256-simd provides additional acceleration for SHA256 using
AVX512, SHA Extensions for x86 and ARM64 for ARM.

It provides a drop-in replacement for crypto/sha256 and if the
extensions are not available it falls back to standard crypto/sha256.

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months agoFix some more hidden problems (#23074)
wxiaoguang [Wed, 22 Feb 2023 15:26:02 +0000 (23:26 +0800)]
Fix some more hidden problems (#23074)

Follows #22950

19 months agoAdd sillyguodong to maintainers (#23067) v1.19.0-rc0 v1.20.0-dev
sillyguodong [Wed, 22 Feb 2023 10:32:00 +0000 (18:32 +0800)]
Add sillyguodong to maintainers (#23067)

[List of mine merged
PR](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3Asillyguodong+is%3Amerged+)

19 months agoImproving CONTRIBUTING.md for backport details (#23057)
wxiaoguang [Wed, 22 Feb 2023 03:49:52 +0000 (11:49 +0800)]
Improving CONTRIBUTING.md for backport details (#23057)

See the changes.

Two key points:
* Necessary enhancements could be backported.
* The backports shouldn't break downgrade  between minor releases.

19 months agoChangelog 1.18.5 (#23045) (#23049)
John Olheiser [Tue, 21 Feb 2023 19:36:19 +0000 (13:36 -0600)]
Changelog 1.18.5 (#23045) (#23049)

Frontport #23045