]> source.dussan.org Git - gitea.git/log
gitea.git
19 months agoChange interactiveBorder to fix popup preview (#23169) (#23314)
Giteabot [Mon, 6 Mar 2023 08:45:43 +0000 (03:45 -0500)]
Change interactiveBorder to fix popup preview  (#23169) (#23314)

Backport #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: Hester Gong <hestergong@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoScoped labels: set aria-disabled on muted Exclusive option for a11y (#23306) (#23311)
Giteabot [Sun, 5 Mar 2023 15:05:11 +0000 (10:05 -0500)]
Scoped labels: set aria-disabled on muted Exclusive option for a11y (#23306) (#23311)

Backport #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: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAdd basic documentation for labels, including scoped labels (#23304) (#23309)
Giteabot [Sun, 5 Mar 2023 12:38:46 +0000 (07:38 -0500)]
Add basic documentation for labels, including scoped labels (#23304) (#23309)

Backport #23304

Part of #22974

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: delvh <dev.lh@web.de>
19 months agoFix various bugs for "install" page (#23194) (#23286) v1.19.0-rc1
Giteabot [Sun, 5 Mar 2023 10:59:58 +0000 (05:59 -0500)]
Fix various bugs for "install" page (#23194) (#23286)

Backport #23194

## TLDR

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

## Details

### The broken page / broken image problem when clicking on "Install"
(Redirect failed after install - #23184)

Before: when clicking on "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 fill 'Gitea Base URL' with
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: wxiaoguang <wxiaoguang@gmail.com>
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 agoSupport sanitising the URL by removing extra slashes in the URL (#21333) (#23300)
Giteabot [Sun, 5 Mar 2023 07:14:12 +0000 (02:14 -0500)]
Support sanitising the URL by removing extra slashes in the URL (#21333) (#23300)

Backport #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: Sandeep Bhat <sandyethadka@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <leon@kske.dev>
19 months agoupdate to mermaid v10 (#23178) (#23299)
Giteabot [Sun, 5 Mar 2023 07:13:50 +0000 (02:13 -0500)]
update to mermaid v10 (#23178) (#23299)

Backport #23178

fix #23153

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <leon@kske.dev>
19 months agoRe-add accidentally removed `hacking-on-gitea.zh-cn.md` (#23297) (#23305)
Giteabot [Sun, 5 Mar 2023 01:09:58 +0000 (20:09 -0500)]
Re-add accidentally removed `hacking-on-gitea.zh-cn.md` (#23297) (#23305)

19 months agoFix code wrap for unbroken lines (#23268) (#23293)
Giteabot [Sat, 4 Mar 2023 19:55:12 +0000 (14:55 -0500)]
Fix code wrap for unbroken lines (#23268) (#23293)

Backport #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/2114189222743939-5f38d9e4-18d8-4ae0-8078-4b3a59195a30.png)

## After

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

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
19 months agoFill head commit to in payload when notifying push commits for mirroring (#23215...
Giteabot [Sat, 4 Mar 2023 18:02:50 +0000 (13:02 -0500)]
Fill head commit to in payload when notifying push commits for mirroring (#23215) (#23292)

Backport #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-7a0-0cbc73162b44.png">

After:

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

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAvoid panic caused by broken payload when creating commit status (#23216) (#23294)
Giteabot [Sat, 4 Mar 2023 14:23:49 +0000 (09:23 -0500)]
Avoid panic caused by broken payload when creating commit status (#23216) (#23294)

Backport #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: Jason Song <i@wolfogre.com>
Co-authored-by: delvh <dev.lh@web.de>
19 months agoFix GetFilesChangedBetween if the file name may be escaped (#23272) (#23279)
Giteabot [Sat, 4 Mar 2023 05:38:31 +0000 (00:38 -0500)]
Fix GetFilesChangedBetween if the file name may be escaped (#23272) (#23279)

Backport #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: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoUse correct README link to render the README (#23152) (#23264)
Giteabot [Sat, 4 Mar 2023 05:38:11 +0000 (00:38 -0500)]
Use correct README link to render the README (#23152) (#23264)

Backport #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: yp05327 <576951401@qq.com>
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 agoFix commit retrieval by tag (#21804) (#23266)
Giteabot [Fri, 3 Mar 2023 19:42:46 +0000 (14:42 -0500)]
Fix commit retrieval by tag (#21804) (#23266)

Backport #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: silverwind <me@silverwind.io>
19 months agoRevert relative links to absolute links in mail templates (#23267) (#23269)
Giteabot [Fri, 3 Mar 2023 17:41:00 +0000 (12:41 -0500)]
Revert relative links to absolute links in mail templates (#23267) (#23269)

Backport #23267

Follow #21986 , fix regression.

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

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
19 months agoUse async await to fix empty quote reply at first time (#23168) (#23256)
Giteabot [Thu, 2 Mar 2023 22:36:21 +0000 (17:36 -0500)]
Use async await to fix empty quote reply at first time (#23168) (#23256)

Backport #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.

Co-authored-by: HesterG <hestergong@gmail.com>
19 months agoFix switched citation format (#23250) (#23253)
Giteabot [Thu, 2 Mar 2023 20:05:10 +0000 (15:05 -0500)]
Fix switched citation format (#23250) (#23253)

Backport #23250

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

Co-authored-by: Blender Defender <contact.blenderdefender@gmail.com>
19 months agoFix missed `.hide` class (#23208) (#23237)
Giteabot [Thu, 2 Mar 2023 17:45:42 +0000 (12:45 -0500)]
Fix missed `.hide` class (#23208) (#23237)

Backport #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: yp05327 <576951401@qq.com>
19 months agoAllow `<video>` in MarkDown (#22892) (#23236)
Giteabot [Thu, 2 Mar 2023 16:49:05 +0000 (11:49 -0500)]
Allow `<video>` in MarkDown (#22892) (#23236)

Backport #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.

Co-authored-by: Sybren <122987084+drsybren@users.noreply.github.com>
19 months agoClose the temp file when dumping database to make the temp file can be deleted on...
Giteabot [Thu, 2 Mar 2023 16:47:07 +0000 (11:47 -0500)]
Close the temp file when dumping database to make the temp file can be deleted on Windows (#23249) (#23251)

Backport #23249

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

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
19 months agoFix incorrect checkbox behaviors in the dashboard repolist's filter (#23147) (#23205)
Giteabot [Thu, 2 Mar 2023 07:12:33 +0000 (02:12 -0500)]
Fix incorrect checkbox behaviors in the dashboard repolist's filter (#23147) (#23205)

Backport #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: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoOrder pull request conflict checking by recently updated, for each push (#23220)...
Giteabot [Thu, 2 Mar 2023 05:12:41 +0000 (00:12 -0500)]
Order pull request conflict checking by recently updated, for each push (#23220) (#23225)

Backport #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.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAdd loading yaml label template files (#22976) (#23232)
Giteabot [Thu, 2 Mar 2023 02:57:34 +0000 (21:57 -0500)]
Add loading yaml label template files (#22976) (#23232)

Backport #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

Co-authored-by: Lauris BH <lauris@nix.lv>
19 months agoDo not create commit graph for temporary repos (#23219) (#23229)
Giteabot [Wed, 1 Mar 2023 23:53:41 +0000 (18:53 -0500)]
Do not create commit graph for temporary repos (#23219) (#23229)

Backport #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.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
19 months agoUse the correct selector to hide the checkmark of selected labels on clear (#23224...
Giteabot [Wed, 1 Mar 2023 20:59:36 +0000 (15:59 -0500)]
Use the correct selector to hide the checkmark of selected labels on clear (#23224) (#23228)

Backport #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)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
19 months agoChange button text for commenting and closing an issue at the same time (#23135)...
Yarden Shoham [Tue, 28 Feb 2023 22:54:24 +0000 (00:54 +0200)]
Change button text for commenting and closing an issue at the same time (#23135) (#23182)

Backport #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.

![image](https://user-images.githubusercontent.com/2114189/221334034-8d556cd5-1136-4ba0-8faa-a65ffadd7fb7.png)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
19 months agoFix Fomantic UI's `touchstart` fastclick, always use `click` for click events (#23065...
wxiaoguang [Tue, 28 Feb 2023 22:53:45 +0000 (06:53 +0800)]
Fix Fomantic UI's `touchstart` fastclick, always use `click` for click events (#23065) (#23195)

Backport #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.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoPass `--global` when calling `git config --get`, for consistency with `git config...
Giteabot [Tue, 28 Feb 2023 22:53:15 +0000 (17:53 -0500)]
Pass `--global` when calling `git config --get`, for consistency with `git config --set` (#23157) (#23199)

Backport #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.

Co-authored-by: Philip Peterson <philip-peterson@users.noreply.github.com>
19 months agoMake `gitea serv` respect git binary home (#23138) (#23197)
Giteabot [Tue, 28 Feb 2023 22:46:23 +0000 (17:46 -0500)]
Make `gitea serv` respect git binary home (#23138) (#23197)

Backport #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

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
19 months agoAvoid too long names for actions (#23162) (#23190)
Yarden Shoham [Tue, 28 Feb 2023 12:42:40 +0000 (14:42 +0200)]
Avoid too long names for actions (#23162) (#23190)

Backport #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.

Co-authored-by: Jason Song <i@wolfogre.com>
19 months agoAdd InsecureSkipVerify to Minio Client for Storage (#23166) (#23177)
Yarden Shoham [Mon, 27 Feb 2023 22:29:17 +0000 (00:29 +0200)]
Add InsecureSkipVerify to Minio Client for Storage (#23166) (#23177)

Backport #23166

Allows using Minio with untrusted certificates

Closes #23128

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoAdd word-break to sidebar-item-link (#23146) (#23180)
Yarden Shoham [Mon, 27 Feb 2023 20:59:36 +0000 (22:59 +0200)]
Add word-break to sidebar-item-link (#23146) (#23180)

Backport #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: yp05327 <576951401@qq.com>
Co-authored-by: delvh <leon@kske.dev>
19 months agoRemove useless comment in #23114 (#23173) (#23175)
Yarden Shoham [Mon, 27 Feb 2023 14:43:15 +0000 (16:43 +0200)]
Remove useless comment in #23114 (#23173) (#23175)

Backport #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

Co-authored-by: Zettat123 <zettat123@gmail.com>
19 months agoReturn 404 instead of 403 if user can not access the repo (#23155) (#23158)
Yarden Shoham [Sun, 26 Feb 2023 12:20:44 +0000 (14:20 +0200)]
Return 404 instead of 403 if user can not access the repo (#23155) (#23158)

Backport #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: yp05327 <576951401@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix DBConsistency checks on MSSQL (#23132) (#23134)
Yarden Shoham [Sat, 25 Feb 2023 15:25:58 +0000 (17:25 +0200)]
Fix DBConsistency checks on MSSQL (#23132) (#23134)

Backport #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>
Co-authored-by: zeripath <art27@cantab.net>
19 months agoFix secrets overview page missing from docs sidebar (#23143) (#23145)
Yarden Shoham [Sat, 25 Feb 2023 11:30:32 +0000 (13:30 +0200)]
Fix secrets overview page missing from docs sidebar (#23143) (#23145)

Backport #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 agoRedirect to the commit page after applying patch (#23056) (#23127)
Yarden Shoham [Sat, 25 Feb 2023 03:43:26 +0000 (05:43 +0200)]
Redirect to the commit page after applying patch (#23056) (#23127)

Backport #23056

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

Co-authored-by: yp05327 <576951401@qq.com>
19 months agoAvoid warning for system setting when start up (#23054) (#23116)
Yarden Shoham [Fri, 24 Feb 2023 21:46:11 +0000 (23:46 +0200)]
Avoid warning for system setting when start up (#23054) (#23116)

Backport #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: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
19 months agoShow empty repos in Admin Repository Management page (#23114) (#23130)
Yarden Shoham [Fri, 24 Feb 2023 20:17:21 +0000 (22:17 +0200)]
Show empty repos in Admin Repository Management page (#23114) (#23130)

Backport #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: Zettat123 <zettat123@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
19 months agoChange style to improve whitespaces trimming inside inline markdown code (#23093...
silverwind [Fri, 24 Feb 2023 17:05:36 +0000 (18:05 +0100)]
Change style to improve whitespaces trimming inside inline markdown code (#23093) (#23120)

Backport #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.

Co-authored-by: HesterG <hestergong@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix height for sticky head on large screen on PR page (#23111) (#23123)
Yarden Shoham [Fri, 24 Feb 2023 14:47:48 +0000 (16:47 +0200)]
Fix height for sticky head on large screen on PR page (#23111) (#23123)

Backport #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">

Co-authored-by: HesterG <hestergong@gmail.com>
19 months agoFix db.Find bug (#23115) (#23119)
Yarden Shoham [Fri, 24 Feb 2023 14:05:36 +0000 (16:05 +0200)]
Fix db.Find bug (#23115) (#23119)

Backport #23115

Caused by #20821

Fix #23110

19 months agoFix nil context in RenderMarkdownToHtml (#23092) (#23108)
Yarden Shoham [Fri, 24 Feb 2023 13:17:03 +0000 (15:17 +0200)]
Fix nil context in RenderMarkdownToHtml (#23092) (#23108)

Backport #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: Zettat123 <zettat123@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoMake issue meta dropdown support Enter, confirm before reloading (#23014) (#23102)
Yarden Shoham [Fri, 24 Feb 2023 09:40:36 +0000 (11:40 +0200)]
Make issue meta dropdown support Enter, confirm before reloading (#23014) (#23102)

Backport #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: wxiaoguang <wxiaoguang@gmail.com>
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) (#23100)
Yarden Shoham [Fri, 24 Feb 2023 06:36:25 +0000 (08:36 +0200)]
Fix SyncOnCommit always return false in API of push_mirrors (#23088) (#23100)

Backport #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.

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAdd wrapper to author to avoid long name ui problem (#23030) (#23098)
Yarden Shoham [Fri, 24 Feb 2023 02:45:18 +0000 (04:45 +0200)]
Add wrapper to author to avoid long name ui problem (#23030) (#23098)

Backport #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. Which will work like below:

<img width="1183" alt="2023-02-21 11 57 53"
src="https://user-images.githubusercontent.com/17645053/220244146-3d47c512-33b6-4ed8-938e-de0a8bc26ffb.png">

<img width="417" alt="2023-02-21 11 58 43"
src="https://user-images.githubusercontent.com/17645053/220244154-1ea0476b-9d1c-473a-9917-d3216860f9a9.png">

And `title` is added to the wrapper like it did in message wrapper. So
the full author name will show on hover.

Co-authored-by: HesterG <hestergong@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix commit name in Apply Patch page (#23086) (#23099)
Yarden Shoham [Fri, 24 Feb 2023 00:47:35 +0000 (02:47 +0200)]
Fix commit name in Apply Patch page (#23086) (#23099)

Backport #23086

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

Co-authored-by: yp05327 <576951401@qq.com>
19 months agoAdd accessibility to the menu on the navbar (#23059) (#23095)
HesterG [Thu, 23 Feb 2023 12:56:03 +0000 (20:56 +0800)]
Add accessibility to the menu on the navbar (#23059) (#23095)

Backport #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 agoNest metadata in refactoring docs (#23087) (#23091)
Yarden Shoham [Thu, 23 Feb 2023 08:39:30 +0000 (10:39 +0200)]
Nest metadata in refactoring docs (#23087) (#23091)

Backport #23087

Whitespace was missing from refactoring docs metadata.

backport label applied so it is included in versioned docs.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoImprove accessibility for issue comments (#22612) (#23083)
Yarden Shoham [Thu, 23 Feb 2023 08:32:15 +0000 (10:32 +0200)]
Improve accessibility for issue comments (#22612) (#23083)

Backport #22612

### Preamble

Gitea is an extremely great and smart solution perfectly suitable for
smaller systems and self-hosted Git-powered setups. However, there is a
group of people who have indredible difficulties in using Gitea,
rendering it useless in many cases. Those people are blind developers
using [screen readers](https://en.wikipedia.org/wiki/Screen_reader).
Unfortunately, the frontend framework is super convoluted, and Go
templates don’t allow accessibility improvements in a straightforward
way. As a blind developer myself, I'm trying to start fixing smaller
accessibility quirks with intention to go deeper and eventually, alone
or not, make Gitea at least mostly accessible for screen reader users.

### What This Fix Does

My blind fellows and me navigate webpages not very similarly to how a
sighted person does it. For instance, we love semantic HTML markup like
headings, lists, tables etc. because our screen readers allow us to jump
by those landmarks with a single keypress.
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: Andre Polykanine <ap@oire.me>
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) (#23081)
Yarden Shoham [Thu, 23 Feb 2023 00:34:47 +0000 (02:34 +0200)]
Wrap unless-check in docker manifests (#23079) (#23081)

Backport #23079

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

https://go.dev/play/p/h7bt7MWKTcv

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months ago Fix some more hidden problems (#23074) (#23075)
wxiaoguang [Wed, 22 Feb 2023 15:26:48 +0000 (23:26 +0800)]
 Fix some more hidden problems (#23074) (#23075)

Backport #23074

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

19 months agoAdd Bash and Zsh completion scripts (#22646)
zeripath [Tue, 21 Feb 2023 17:32:24 +0000 (17:32 +0000)]
Add Bash and Zsh completion scripts (#22646)

This PR adds contrib scripts for bash and zsh completion.

Simply call:

```bash
source contrib/autocompletion/bash_autocomplete
```

or for Zsh:

```bash
source contrib/autocompletion/zsh_autocomplete
```

Signed-off-by: Andrew Thornton <art27@cantab.net>
---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoReturn empty url for submodule tree entries (#23043)
Zettat123 [Tue, 21 Feb 2023 17:31:17 +0000 (01:31 +0800)]
Return empty url for submodule tree entries (#23043)

Close #22614.

Refer to [Github's
API](https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree),
if a tree entry is a submodule, its url will be an empty string.

---------

Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months agoFix the show/hide methods for string selector (#23042)
wxiaoguang [Tue, 21 Feb 2023 17:09:03 +0000 (01:09 +0800)]
Fix the show/hide methods for string selector (#23042)

At that moment I made a mistake (failed to detect a JS variable type
correctly)

Close #23040

19 months agodisplay attachments of review comment when comment content is blank (#23035)
sillyguodong [Tue, 21 Feb 2023 16:08:20 +0000 (00:08 +0800)]
display attachments of review comment when comment content is blank (#23035)

fix: #22647

19 months agoUpgrade to stylelint 15 (#22944)
silverwind [Tue, 21 Feb 2023 15:23:45 +0000 (16:23 +0100)]
Upgrade to stylelint 15 (#22944)

- Upgrade stylelint and plugin
- Change ruleset to a explicit one, with all deprecated rules removed
- Fix new issues detected by value validation

For `overflow: overlay` see
https://github.com/stylelint/stylelint/issues/6667

19 months agoAdd force_merge to merge request and fix checking mergable (#23010)
Jason Song [Tue, 21 Feb 2023 14:42:07 +0000 (22:42 +0800)]
Add force_merge to merge request and fix checking mergable (#23010)

Fix #23000.

19 months agoImprove PR Review Box UI (#22986)
wxiaoguang [Tue, 21 Feb 2023 13:36:53 +0000 (21:36 +0800)]
Improve PR Review Box UI (#22986)

This PR follows:
* #22950

### Before

The Review Box has many problems:

* It doesn't work for small screens.
* It has an anonying animation which makes the UI laggy.
* It uses "custom dropdown menu" which is very difficult to fine tune.
* `$().toggle('visible')` is not a correct call
* jQuery just accepts any invalid `duration` argument:
`$().toggle('anyting')`
* The button is not a button.

<details>

![image](https://user-images.githubusercontent.com/2114189/219948865-6da3f39c-6fde-4c86-9e42-da5020f3d0c3.png)

</details>

### After

These problems are fixed, and eliminate many `!important` games.

<details>

![image](https://user-images.githubusercontent.com/2114189/219952744-8862fe1a-7ef1-49e4-bf92-2d0c1f104ee4.png)

![image](https://user-images.githubusercontent.com/2114189/219952771-be169a76-45fd-47a8-8f9c-b447d064f4ca.png)

![image](https://user-images.githubusercontent.com/2114189/219952784-3f52e9b7-64ce-4ad1-9553-64c33fb83042.png)

</details>

And most dropdown icons still looks good:

<details>

![image](https://user-images.githubusercontent.com/2114189/219952942-52866a00-e0f9-4af7-8fb5-eb1a8cad1ff3.png)

![image](https://user-images.githubusercontent.com/2114189/219948909-b3bfb844-f84e-4b79-ab1f-382ec66dec31.png)

</details>

Co-authored-by: delvh <leon@kske.dev>
19 months agoRemove dashes between organization member avatars on hover (#23034)
HesterG [Tue, 21 Feb 2023 11:28:31 +0000 (19:28 +0800)]
Remove dashes between organization member avatars on hover (#23034)

On the home page of an organization, there are unexpected dashes between
the avatars of the members when hovering over the avatars, as shown in
below:

![hover including title](https://user-images.githubusercontent.com/17645053/220271470-4f49e16f-87eb-4ffa-b38e-23feae1ff92d.png)

![hover without title](https://user-images.githubusercontent.com/17645053/220271512-e4a67685-6b72-4742-a34f-e01ed248c1de.png)

This is because in `fomantic/build/semantic.css` there is a
rule `text-decoration: underline;` when hovering over the `<a>` tag.
Here, the `<a>` tag has width and height because of the avatar image inside,
leading to the unexpected underlines.

This PR overrides the `a:hover` rule so the underline does not exist anymore.

Co-authored-by: delvh <leon@kske.dev>
19 months agoFix the Manually Merged form (#23015)
wxiaoguang [Tue, 21 Feb 2023 10:03:41 +0000 (18:03 +0800)]
Fix the Manually Merged form (#23015)

Regression bug of #19650

Close #20983
Close #21912

### The "Manually Merged" form

![image](https://user-images.githubusercontent.com/2114189/220170503-32638994-b509-4251-8aa1-d8393dda7184.png)

### Mark a PR as Manually Merged and close it

![image](https://user-images.githubusercontent.com/2114189/220170537-25c91b2c-7a9a-44d1-9e6a-ebe3f1dfc26a.png)

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoRemove delete button for review comment (#23036)
Zettat123 [Tue, 21 Feb 2023 08:25:47 +0000 (16:25 +0800)]
Remove delete button for review comment (#23036)

Fix #23031.

Currently, only comments with type `CommentTypeComment` or
`CommentTypeCode` can be deleted. If user create a review comment, the
type of the comment will be `CommentTypeReview` so the comment cannot be
deleted.

https://github.com/go-gitea/gitea/blob/e7be610d5773e69abbfb98d19e23112dfad6dfcc/routers/web/repo/issue.go#L2860-L2868

And in Github, user also cannot delete a review comment. There isn't a
delete button in the menu.

<img
src="https://user-images.githubusercontent.com/15528715/220275166-5ae2dc10-4003-4857-b14e-d7b02644345f.png"
width="640px" />

So we should remove the delete button from the menu when the comment's
type is `CommentTypeReview`.

19 months agoImprove frontend guidelines (#23007)
wxiaoguang [Tue, 21 Feb 2023 06:13:37 +0000 (14:13 +0800)]
Improve frontend guidelines (#23007)

Some were out-dated, some are added.

19 months agoUse `--message=%s` for git commit message (#23028)
wxiaoguang [Tue, 21 Feb 2023 06:12:57 +0000 (14:12 +0800)]
Use `--message=%s` for git commit message (#23028)

Close  #23027

`git commit` message option _only_ supports 4 formats (well, only ....):
* `"commit", "-m", msg`
* `"commit", "-m{msg}"`  (no space)
* `"commit", "--message", msg`
* `"commit", "--message={msg}"`

The long format with `=` is the best choice, and it's documented in `man
git-commit`:

`-m <msg>, --message=<msg> ...`

ps: I would suggest always use long format option for git command, as
much as possible.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoadd margin top to the top of branches (#23002)
HesterG [Tue, 21 Feb 2023 05:03:44 +0000 (13:03 +0800)]
add margin top to the top of branches (#23002)

add margin top as mentioned in #22973

---------

Co-authored-by: jidi <jidi@jidideMacBook-Pro.local>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAdd me to maintainers (#23026)
yp05327 [Tue, 21 Feb 2023 02:56:13 +0000 (11:56 +0900)]
Add me to maintainers (#23026)

Add me to maintainers.

[My PRs
list](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3Ayp05327+is%3Amerged+)

19 months agoRender access log template as text instead of HTML (#23013)
Lunny Xiao [Tue, 21 Feb 2023 02:22:13 +0000 (10:22 +0800)]
Render access log template as text instead of HTML (#23013)

Fix https://github.com/go-gitea/gitea/pull/22906#discussion_r1112106675

19 months agoUse `gt-relative` class instead of the ambiguous `gt-pr` class (#23008)
wxiaoguang [Tue, 21 Feb 2023 00:16:56 +0000 (08:16 +0800)]
Use `gt-relative` class instead of the ambiguous `gt-pr` class  (#23008)

`.gt-relative` is also `position: relative !important;`

There are `gt-pr-?` styles below (line 140) for `padding-right`, which
makes `.gt-pr` ambiguous

Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoFix intermittent panic in notify issue change content (#23019)
zeripath [Tue, 21 Feb 2023 00:15:49 +0000 (00:15 +0000)]
Fix intermittent panic in notify issue change content (#23019)

Ensure that issue pullrequests are loaded before trying to set the
self-reference.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoImprove pull_request_template.md (#22888)
Jason Song [Tue, 21 Feb 2023 00:14:02 +0000 (08:14 +0800)]
Improve pull_request_template.md (#22888)

Update `pull_request_template.md` because:

- It's a kind idea to hide the tips. However, it's easier to include
them in the commit message by mistake when you cannot see them. Check
`git log | grep 'Please check the following:'`. So don't hide it, expose
it and help fix it.
- "for backports" is much clearer than "for bug fixes". I saw someone
post a PR to a release branch because they believed it was the right way
for a bugfix.
- "Allow edits by maintainers", or we have to ask the contributor to
update the branch and they could be confused.
- Remind the contributor that the words could be included in the commit
message, to avoid some words like "Hello", "Sorry". If they really need
them, they can separate them with a line, like:

```markdown
Close #xxxx
Because ... Then ... Finally ...
---
Hello, this is my first time opening a pull request. Sorry for any mistakes.
```
And the merger should be careful, check and delete the extra content
before merging.

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoHide 2FA status from other members in organization members list (#22999)
Brecht Van Lommel [Mon, 20 Feb 2023 23:16:29 +0000 (00:16 +0100)]
Hide 2FA status from other members in organization members list (#22999)

This is rather private information that should not be given to all
members in the same organization. Only show it to organization owners.

19 months agohandle deprecated settings (#22992)
Lunny Xiao [Mon, 20 Feb 2023 22:18:26 +0000 (06:18 +0800)]
handle deprecated settings (#22992)

Fix #22736

19 months agoAdd scopes to API to create token and display them (#22989)
zeripath [Mon, 20 Feb 2023 21:28:44 +0000 (21:28 +0000)]
Add scopes to API to create token and display them (#22989)

The API to create tokens is missing the ability to set the required
scopes for tokens, and to show them on the API and on the UI.

This PR adds this functionality.

Signed-off-by: Andrew Thornton <art27@cantab.net>
19 months agoRemove unnecessary and incorrect `find('.menu').toggle()` (#22987)
wxiaoguang [Mon, 20 Feb 2023 20:44:32 +0000 (04:44 +0800)]
Remove unnecessary and incorrect `find('.menu').toggle()` (#22987)

Follows:
* #22950

The dropdown menu works well without these codes.

The reason is that the event bubbling still works for the dropdown menu,
the Fomantic UI dropdown menu module will hide the menu correctly if an
item is clicked.

19 months agoImprove issues.LoadProject (#22982)
yp05327 [Mon, 20 Feb 2023 19:21:56 +0000 (04:21 +0900)]
Improve issues.LoadProject (#22982)

issues.LoadProject() is no use
change `issues.loadProject(ctx)` to issues.LoadProject(ctx)

19 months agoAdd 1.18.4 changelog (#22991) (#22995)
Lunny Xiao [Mon, 20 Feb 2023 18:09:02 +0000 (02:09 +0800)]
Add 1.18.4 changelog (#22991) (#22995)

Frontport from #22991

19 months agoFix pull request branch selector visible without clicking Edit (#23012)
Brecht Van Lommel [Mon, 20 Feb 2023 16:08:32 +0000 (17:08 +0100)]
Fix pull request branch selector visible without clicking Edit (#23012)

Caused by #22950

19 months agoBump golang.org/x/net from 0.4.0 to 0.7.0 (#22980)
dependabot[bot] [Mon, 20 Feb 2023 15:52:21 +0000 (23:52 +0800)]
Bump golang.org/x/net from 0.4.0 to 0.7.0 (#22980)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.4.0 to
0.7.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/golang/net/commit/8e2b117aee74f6b86c207a808b0255de45c0a18a"><code>8e2b117</code></a>
http2/hpack: avoid quadratic complexity in hpack decoding</li>
<li><a
href="https://github.com/golang/net/commit/547e7edf3873d6f3a9c093d3785f9e2289e00746"><code>547e7ed</code></a>
http2: avoid referencing ResponseWrite.Write parameter after
returning</li>
<li><a
href="https://github.com/golang/net/commit/39940adcaaa73e661124cb80fb8dd57ea929dbaf"><code>39940ad</code></a>
html: parse comments per HTML spec</li>
<li><a
href="https://github.com/golang/net/commit/87ce33ecb484cbb6bcfc8e506ce0330ef72e0847"><code>87ce33e</code></a>
go.mod: update golang.org/x dependencies</li>
<li><a
href="https://github.com/golang/net/commit/415cb6d518e71d202e2dc2f44c475cbff84eee72"><code>415cb6d</code></a>
all: fix some comments</li>
<li><a
href="https://github.com/golang/net/commit/7e3c19ca52e202ae203b1914fc00c8e47a4d72fa"><code>7e3c19c</code></a>
all: correct typos in comments</li>
<li><a
href="https://github.com/golang/net/commit/296f09aa3817abc1ddff7703799bf9babb7bbd16"><code>296f09a</code></a>
http2: case insensitive handling for 100-continue</li>
<li><a
href="https://github.com/golang/net/commit/f8411da775a685be247bbedcb3ed2c998f895cd2"><code>f8411da</code></a>
nettest: fix tests on dragonfly and js/wasm</li>
<li><a
href="https://github.com/golang/net/commit/8e0e7d8d38f2b6d21d742845570dde2902d06a1d"><code>8e0e7d8</code></a>
go.mod: update golang.org/x dependencies</li>
<li><a
href="https://github.com/golang/net/commit/7805fdc37dc2b54b28b9d621030e14dcf1dab67c"><code>7805fdc</code></a>
http2: rewrite inbound flow control tracking</li>
<li>Additional commits viewable in <a
href="https://github.com/golang/net/compare/v0.4.0...v0.7.0">compare
view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=golang.org/x/net&package-manager=go_modules&previous-version=0.4.0&new-version=0.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: delvh <leon@kske.dev>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix panic when call api (/repos/{owner}/{repo}/pulls/{index}/files) (#22921)
sillyguodong [Mon, 20 Feb 2023 14:22:34 +0000 (22:22 +0800)]
Fix panic when call api (/repos/{owner}/{repo}/pulls/{index}/files) (#22921)

Close: #22910

---
I'm confused about that why does the api (`GET
/repos/{owner}/{repo}/pulls/{index}/files`) require caller to pass the
parameters `limit` and `page`.
In my case, the caller only needs to pass a `skip-to` to paging. This is
consistent with the api `GET /{owner}/{repo}/pulls/{index}/files`
So, I deleted the code related to `listOptions`

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoonly trigger docs build and publish when docs changed (#22968)
Lunny Xiao [Mon, 20 Feb 2023 13:08:41 +0000 (21:08 +0800)]
only trigger docs build and publish when docs changed (#22968)

Since drone plugin
https://github.com/meltwater/drone-convert-pathschanged/ enabled, we can
filter event with path in drone.

Building docs will now only be triggered when documentations changed.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
19 months agoGet rules by id when editing branch protection rule (#22932)
Zettat123 [Mon, 20 Feb 2023 11:30:41 +0000 (19:30 +0800)]
Get rules by id when editing branch protection rule (#22932)

When users rename an existing branch protection rule, a new rule with
the new name will be created and the old rule will still exist.

![image](https://user-images.githubusercontent.com/15528715/219276442-d3c001ad-e693-44ec-9ad2-b33f2666b49b.png)

---

![image](https://user-images.githubusercontent.com/15528715/219276478-547c3b93-b3f1-4292-a1ef-c1b7747fe1bb.png)

The reason is that the `SettingsProtectedBranchPost` function only get
branch protection rule by name before updating or creating a rule. When
the rule name changes, the function cannot find the existing rule so it
will create a new rule rather than update the existing rule. To fix the
bug, the function should get rule by id first.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix hidden commit status on multiple checks (#22889)
oliverpool [Mon, 20 Feb 2023 08:43:04 +0000 (09:43 +0100)]
Fix hidden commit status on multiple checks (#22889)

Since #22632, when a commit status has multiple checks, no check is
shown at all (hence no way to see the other checks).

This PR fixes this by always adding a tag with the
`.commit-statuses-trigger` to the DOM (the `.vm` is for vertical
alignment).

![2023-02-13-120528](https://user-images.githubusercontent.com/3864879/218441846-1a79c169-2efd-46bb-9e75-d8b45d7cc8e3.png)

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoAdd me to maintainers (#22998)
Zettat123 [Mon, 20 Feb 2023 08:42:02 +0000 (16:42 +0800)]
Add me to maintainers (#22998)

Add me to maintainers.

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

Co-authored-by: Jason Song <i@wolfogre.com>
19 months agoAdd all units to the units permission list in org team members sidebar (#22971)
yp05327 [Mon, 20 Feb 2023 07:08:33 +0000 (16:08 +0900)]
Add all units to the units permission list in org team members sidebar (#22971)

Add all units to the units permission list in org team members sidebar.

Before:

![BQF448EIHEYKY62XGG(5101](https://user-images.githubusercontent.com/18380374/219877772-b57df8fb-2b82-4b1a-85c8-3809f8751cab.png)
After:

![image](https://user-images.githubusercontent.com/18380374/219877762-f69482b8-abf9-4333-978e-6a3f52039a16.png)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoMake CI use a dummy password hasher for all tests (#22983)
zeripath [Mon, 20 Feb 2023 05:20:30 +0000 (05:20 +0000)]
Make CI use a dummy password hasher for all tests (#22983)

During the recent hash algorithm change it became clear that the choice
of password hash algorithm plays a role in the time taken for CI to run.

Therefore as attempt to improve CI we should consider using a dummy
hashing algorithm instead of a real hashing algorithm.

This PR creates a dummy algorithm which is then set as the default
hashing algorithm during tests that use the fixtures. This hopefully
will cause a reduction in the time it takes for CI to run.

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoUse beforeCommit instead of baseCommit (#22949)
Kyle D [Mon, 20 Feb 2023 03:56:07 +0000 (20:56 -0700)]
Use beforeCommit instead of baseCommit (#22949)

Replaces: https://github.com/go-gitea/gitea/pull/22947
Fixes https://github.com/go-gitea/gitea/issues/22946
Probably related to https://github.com/go-gitea/gitea/issues/19530

Basically, many of the diffs were broken because they were comparing to
the base commit, where a 3-dot diff should be comparing to the [last
common
ancestor](https://matthew-brett.github.io/pydagogue/git_diff_dots.html).

This should have an integration test so that we don’t run into this
issue again.

---------

Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
19 months agoAdd comment marking the end of database migrations in `1.19.0` (#22975)
Yarden Shoham [Mon, 20 Feb 2023 02:30:36 +0000 (04:30 +0200)]
Add comment marking the end of database migrations in `1.19.0` (#22975)

There will be no more migrations in `1.19.0`

---------

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
19 months agoFix broken pull request files (#22962)
Lunny Xiao [Mon, 20 Feb 2023 01:57:16 +0000 (09:57 +0800)]
Fix broken pull request files (#22962)

Fix #22961

19 months agoFix avatar misalignment (#22955)
Zettat123 [Sun, 19 Feb 2023 23:07:46 +0000 (07:07 +0800)]
Fix avatar misalignment (#22955)

Fix #22818.

|  Before   | After  |
|  ----  | ----  |
| <img
src="https://user-images.githubusercontent.com/15528715/219617504-d86e7a90-d4ac-4a92-bd8a-100dddc693d5.png"
width="200px" /> | <img
src="https://user-images.githubusercontent.com/15528715/219618645-a4045f65-bda6-49ce-a676-f03a9817bb70.png"
width="200px" />|
| <img
src="https://user-images.githubusercontent.com/15528715/219618013-844ef208-853b-44bd-a67c-36e360f0ffa7.png"
width="200px" /> | <img
src="https://user-images.githubusercontent.com/15528715/219618361-cb13c369-852e-47bf-ae30-e429d348823d.png"
width="200px" /> |

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoRefactor the setting to make unit test easier (#22405)
Lunny Xiao [Sun, 19 Feb 2023 16:12:01 +0000 (00:12 +0800)]
Refactor the setting to make unit test easier (#22405)

Some bugs caused by less unit tests in fundamental packages. This PR
refactor `setting` package so that create a unit test will be easier
than before.

- All `LoadFromXXX` files has been splited as two functions, one is
`InitProviderFromXXX` and `LoadCommonSettings`. The first functions will
only include the code to create or new a ini file. The second function
will load common settings.
- It also renames all functions in setting from `newXXXService` to
`loadXXXSetting` or `loadXXXFrom` to make the function name less
confusing.
- Move `XORMLog` to `SQLLog` because it's a better name for that.

Maybe we should finally move these `loadXXXSetting` into the `XXXInit`
function? Any idea?

---------

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: delvh <dev.lh@web.de>
19 months agoMigration v244.go should be v243.go (#22988)
zeripath [Sun, 19 Feb 2023 14:24:23 +0000 (14:24 +0000)]
Migration v244.go should be v243.go (#22988)

19 months agoAdjust manifest to prevent tagging latest on rcs (#22811)
zeripath [Sun, 19 Feb 2023 14:24:08 +0000 (14:24 +0000)]
Adjust manifest to prevent tagging latest on rcs (#22811)

19 months agoAdd some guidelines for refactoring (#22880)
wxiaoguang [Sun, 19 Feb 2023 13:25:23 +0000 (21:25 +0800)]
Add some guidelines for refactoring (#22880)

Just some brief ideas.

Feel free to complete these guidelines, feel free to edit on this PR
directly.

19 months agoRename `GetUnits` to `LoadUnits` (#22970)
yp05327 [Sun, 19 Feb 2023 08:31:39 +0000 (17:31 +0900)]
Rename `GetUnits` to `LoadUnits` (#22970)

Same as https://github.com/go-gitea/gitea/pull/22967

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoProvide the ability to set password hash algorithm parameters (#22942)
zeripath [Sun, 19 Feb 2023 07:35:20 +0000 (07:35 +0000)]
Provide the ability to set password hash algorithm parameters (#22942)

This PR refactors and improves the password hashing code within gitea
and makes it possible for server administrators to set the password
hashing parameters

In addition it takes the opportunity to adjust the settings for `pbkdf2`
in order to make the hashing a little stronger.

The majority of this work was inspired by PR #14751 and I would like to
thank @boppy for their work on this.

Thanks to @gusted for the suggestion to adjust the `pbkdf2` hashing
parameters.

Close #14751

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix no user listed in org teams page (#22979)
yp05327 [Sun, 19 Feb 2023 04:57:49 +0000 (13:57 +0900)]
Fix no user listed in org teams page (#22979)

https://github.com/go-gitea/gitea/pull/22294 introduced this bug.
Before:

![picture](https://user-images.githubusercontent.com/18380374/219916000-5b28db1a-22b5-481a-807b-49c14ac1cd35.png)
After:

![picture](https://user-images.githubusercontent.com/18380374/219916260-6b94efbb-836a-4551-b6a8-3f9cb37d822a.png)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoRefactor hiding-methods, remove jQuery show/hide, remove `.hide` class, remove inline...
wxiaoguang [Sun, 19 Feb 2023 04:06:14 +0000 (12:06 +0800)]
Refactor hiding-methods, remove jQuery show/hide, remove `.hide` class, remove inline style=display:none (#22950)

Close #22847

This PR:

* introduce Gitea's own `showElem` and related functions
* remove jQuery show/hide
* remove .hide class
* remove inline style=display:none

From now on:

do not use:
* "[hidden]" attribute: it's too weak, can not be applied to an element
with "display: flex"
* ".hidden" class: it has been polluted by Fomantic UI in many cases
* inline style="display: none": it's difficult to tweak
* jQuery's show/hide/toggle: it can not show/hide elements with
"display: xxx !important"

only use:
* this ".gt-hidden" class
* showElem/hideElem/toggleElem functions in "utils/dom.js"

cc: @silverwind , this is the all-in-one PR

19 months agoScoped labels (#22585)
Brecht Van Lommel [Sat, 18 Feb 2023 19:17:39 +0000 (20:17 +0100)]
Scoped labels (#22585)

Add a new "exclusive" option per label. This makes it so that when the
label is named `scope/name`, no other label with the same `scope/`
prefix can be set on an issue.

The scope is determined by the last occurence of `/`, so for example
`scope/alpha/name` and `scope/beta/name` are considered to be in
different scopes and can coexist.

Exclusive scopes are not enforced by any database rules, however they
are enforced when editing labels at the models level, automatically
removing any existing labels in the same scope when either attaching a
new label or replacing all labels.

In menus use a circle instead of checkbox to indicate they function as
radio buttons per scope. Issue filtering by label ensures that only a
single scoped label is selected at a time. Clicking with alt key can be
used to remove a scoped label, both when editing individual issues and
batch editing.

Label rendering refactor for consistency and code simplification:

* Labels now consistently have the same shape, emojis and tooltips
everywhere. This includes the label list and label assignment menus.
* In label list, show description below label same as label menus.
* Don't use exactly black/white text colors to look a bit nicer.
* Simplify text color computation. There is no point computing luminance
in linear color space, as this is a perceptual problem and sRGB is
closer to perceptually linear.
* Increase height of label assignment menus to show more labels. Showing
only 3-4 labels at a time leads to a lot of scrolling.
* Render all labels with a new RenderLabel template helper function.

Label creation and editing in multiline modal menu:

* Change label creation to open a modal menu like label editing.
* Change menu layout to place name, description and colors on separate
lines.
* Don't color cancel button red in label editing modal menu.
* Align text to the left in model menu for better readability and
consistent with settings layout elsewhere.

Custom exclusive scoped label rendering:

* Display scoped label prefix and suffix with slightly darker and
lighter background color respectively, and a slanted edge between them
similar to the `/` symbol.
* In menus exclusive labels are grouped with a divider line.

---------

Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>