]> source.dussan.org Git - gitea.git/log
gitea.git
19 months agoUse arm image for arm runner (#23503)
techknowlogick [Wed, 15 Mar 2023 20:56:02 +0000 (16:56 -0400)]
Use arm image for arm runner (#23503)

19 months agoAdd login name and source id for admin user searching API (#23376)
Lunny Xiao [Wed, 15 Mar 2023 11:53:01 +0000 (19:53 +0800)]
Add login name and source id for admin user searching API (#23376)

As title.

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoFix missed migration in #22235 (#23482)
Lunny Xiao [Wed, 15 Mar 2023 09:33:10 +0000 (17:33 +0800)]
Fix missed migration in #22235 (#23482)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
19 months agoDisable sending email after push a commit to a closed PR (#23462)
sillyguodong [Wed, 15 Mar 2023 06:42:21 +0000 (14:42 +0800)]
Disable sending email after push a commit to a closed PR (#23462)

Close #23440
Cause by #23189
In #23189, we should insert a comment record into db when pushing a
commit to the PR, even if the PR is closed.
But should skip sending any notification in this case.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoBump webpack from 5.75.0 to 5.76.0 (#23484)
dependabot[bot] [Wed, 15 Mar 2023 03:37:59 +0000 (23:37 -0400)]
Bump webpack from 5.75.0 to 5.76.0 (#23484)

Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to
5.76.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/webpack/webpack/releases">webpack's
releases</a>.</em></p>
<blockquote>
<h2>v5.76.0</h2>
<h2>Bugfixes</h2>
<ul>
<li>Avoid cross-realm object access by <a
href="https://github.com/Jack-Works"><code>@​Jack-Works</code></a> in <a
href="https://redirect.github.com/webpack/webpack/pull/16500">webpack/webpack#16500</a></li>
<li>Improve hash performance via conditional initialization by <a
href="https://github.com/lvivski"><code>@​lvivski</code></a> in <a
href="https://redirect.github.com/webpack/webpack/pull/16491">webpack/webpack#16491</a></li>
<li>Serialize <code>generatedCode</code> info to fix bug in asset module
cache restoration by <a
href="https://github.com/ryanwilsonperkin"><code>@​ryanwilsonperkin</code></a>
in <a
href="https://redirect.github.com/webpack/webpack/pull/16703">webpack/webpack#16703</a></li>
<li>Improve performance of <code>hashRegExp</code> lookup by <a
href="https://github.com/ryanwilsonperkin"><code>@​ryanwilsonperkin</code></a>
in <a
href="https://redirect.github.com/webpack/webpack/pull/16759">webpack/webpack#16759</a></li>
</ul>
<h2>Features</h2>
<ul>
<li>add <code>target</code> to <code>LoaderContext</code> type by <a
href="https://github.com/askoufis"><code>@​askoufis</code></a> in <a
href="https://redirect.github.com/webpack/webpack/pull/16781">webpack/webpack#16781</a></li>
</ul>
<h2>Security</h2>
<ul>
<li><a
href="https://github.com/advisories/GHSA-3rfm-jhwj-7488">CVE-2022-37603</a>
fixed by <a
href="https://github.com/akhilgkrishnan"><code>@​akhilgkrishnan</code></a>
in <a
href="https://redirect.github.com/webpack/webpack/pull/16446">webpack/webpack#16446</a></li>
</ul>
<h2>Repo Changes</h2>
<ul>
<li>Fix HTML5 logo in README by <a
href="https://github.com/jakebailey"><code>@​jakebailey</code></a> in <a
href="https://redirect.github.com/webpack/webpack/pull/16614">webpack/webpack#16614</a></li>
<li>Replace TypeScript logo in README by <a
href="https://github.com/jakebailey"><code>@​jakebailey</code></a> in <a
href="https://redirect.github.com/webpack/webpack/pull/16613">webpack/webpack#16613</a></li>
<li>Update actions/cache dependencies by <a
href="https://github.com/piwysocki"><code>@​piwysocki</code></a> in <a
href="https://redirect.github.com/webpack/webpack/pull/16493">webpack/webpack#16493</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/Jack-Works"><code>@​Jack-Works</code></a> made
their first contribution in <a
href="https://redirect.github.com/webpack/webpack/pull/16500">webpack/webpack#16500</a></li>
<li><a href="https://github.com/lvivski"><code>@​lvivski</code></a> made
their first contribution in <a
href="https://redirect.github.com/webpack/webpack/pull/16491">webpack/webpack#16491</a></li>
<li><a
href="https://github.com/jakebailey"><code>@​jakebailey</code></a> made
their first contribution in <a
href="https://redirect.github.com/webpack/webpack/pull/16614">webpack/webpack#16614</a></li>
<li><a
href="https://github.com/akhilgkrishnan"><code>@​akhilgkrishnan</code></a>
made their first contribution in <a
href="https://redirect.github.com/webpack/webpack/pull/16446">webpack/webpack#16446</a></li>
<li><a
href="https://github.com/ryanwilsonperkin"><code>@​ryanwilsonperkin</code></a>
made their first contribution in <a
href="https://redirect.github.com/webpack/webpack/pull/16703">webpack/webpack#16703</a></li>
<li><a href="https://github.com/piwysocki"><code>@​piwysocki</code></a>
made their first contribution in <a
href="https://redirect.github.com/webpack/webpack/pull/16493">webpack/webpack#16493</a></li>
<li><a href="https://github.com/askoufis"><code>@​askoufis</code></a>
made their first contribution in <a
href="https://redirect.github.com/webpack/webpack/pull/16781">webpack/webpack#16781</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0">https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/webpack/webpack/commit/97b1718720c33f1b17302a74c5284b01e02ec001"><code>97b1718</code></a>
Merge pull request <a
href="https://redirect.github.com/webpack/webpack/issues/16781">#16781</a>
from askoufis/loader-context-target-type</li>
<li><a
href="https://github.com/webpack/webpack/commit/b84efe6224b276bf72e4c5e2f4e76acddfaeef07"><code>b84efe6</code></a>
Merge pull request <a
href="https://redirect.github.com/webpack/webpack/issues/16759">#16759</a>
from ryanwilsonperkin/real-content-hash-regex-perf</li>
<li><a
href="https://github.com/webpack/webpack/commit/c98e9e001441b165c7ed4845700839730b505833"><code>c98e9e0</code></a>
Merge pull request <a
href="https://redirect.github.com/webpack/webpack/issues/16493">#16493</a>
from piwysocki/patch-1</li>
<li><a
href="https://github.com/webpack/webpack/commit/5f34acfbc074da6cc09f48944d7f2b4273ffb3f8"><code>5f34acf</code></a>
feat: Add <code>target</code> to <code>LoaderContext</code> type</li>
<li><a
href="https://github.com/webpack/webpack/commit/b7fc4d876deb958d7ee81ecc00a312e39a354a44"><code>b7fc4d8</code></a>
Merge pull request <a
href="https://redirect.github.com/webpack/webpack/issues/16703">#16703</a>
from ryanwilsonperkin/ryanwilsonperkin/fix-16160</li>
<li><a
href="https://github.com/webpack/webpack/commit/63ea82da4d4e4242b6a6285fc937f0684f264fe8"><code>63ea82d</code></a>
Merge branch 'webpack:main' into patch-1</li>
<li><a
href="https://github.com/webpack/webpack/commit/4ba225225b1348c8776ca5b5fe53468519413bc0"><code>4ba2252</code></a>
Merge pull request <a
href="https://redirect.github.com/webpack/webpack/issues/16446">#16446</a>
from akhilgkrishnan/patch-1</li>
<li><a
href="https://github.com/webpack/webpack/commit/1acd6350be3d74d4ac70b64cbbc60f27724b618b"><code>1acd635</code></a>
Merge pull request <a
href="https://redirect.github.com/webpack/webpack/issues/16613">#16613</a>
from jakebailey/ts-logo</li>
<li><a
href="https://github.com/webpack/webpack/commit/302eb37fe19ed7ca60eaf895aca4f9da9dfd7931"><code>302eb37</code></a>
Merge pull request <a
href="https://redirect.github.com/webpack/webpack/issues/16614">#16614</a>
from jakebailey/html5-logo</li>
<li><a
href="https://github.com/webpack/webpack/commit/cfdb1dfe59b33bf7441b8a8e4fc58d75e4f54cee"><code>cfdb1df</code></a>
Improve performance of hashRegExp lookup</li>
<li>Additional commits viewable in <a
href="https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a
href="https://www.npmjs.com/~evilebottnawi">evilebottnawi</a>, a new
releaser for webpack since your current version.</p>
</details>
<br />

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=webpack&package-manager=npm_and_yarn&previous-version=5.75.0&new-version=5.76.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)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the
default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as
the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as
the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the
default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/go-gitea/gitea/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
19 months agoReplace Less with CSS (#23481)
silverwind [Wed, 15 Mar 2023 02:20:19 +0000 (03:20 +0100)]
Replace Less with CSS (#23481)

Ran most of the Less files through the Less compiler and Prettier and
then followed up with a round of manual fixes.

The Less compiler had unfortunately stripped all `//` style comments
that I had to restore (It did preserve `/* */` comments). Other fixes
include duplicate selector removal which were revealed after the
transpilation and which weren't caught by stylelint before but now are.

Fixes: https://github.com/go-gitea/gitea/issues/15565
19 months agoFix 'View File' button in code search (#23478)
silverwind [Wed, 15 Mar 2023 02:19:27 +0000 (03:19 +0100)]
Fix 'View File' button in code search (#23478)

- Right-align 'View File' button
- Add 'role' attribute to button link

Before:
<img width="1148" alt="Screenshot 2023-03-14 at 22 02 16"
src="https://user-images.githubusercontent.com/115237/225135954-f06153ec-c222-441e-98ba-0177afff3a7a.png">

After:
<img width="1150" alt="Screenshot 2023-03-14 at 22 02 33"
src="https://user-images.githubusercontent.com/115237/225135966-323cb695-05ef-4b83-a8ef-05f2b1887090.png">

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoUse `gitea/test_env` image instead of `golang` (#23455)
silverwind [Wed, 15 Mar 2023 01:53:14 +0000 (02:53 +0100)]
Use `gitea/test_env` image instead of `golang` (#23455)

The `safe.directory` setting was not executed for pull requests, which
made subsequent `deps-backend` target fail at `go mod download`. To fix
it, split thep and perform the git config unconditionally.

Example: https://drone.gitea.io/go-gitea/gitea/69477/4/3

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoSkip DB tests duplicate runs on push to branches (#23476)
techknowlogick [Wed, 15 Mar 2023 01:46:13 +0000 (21:46 -0400)]
Skip DB tests duplicate runs on push to branches (#23476)

This skips all testing-* pipelines on push to main or release/*
branches. This decreases the total build time on those, as in theory
they should already be run for PRs before merging.

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

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoUpdate app.example.ini (#23480)
Jordan Cech [Wed, 15 Mar 2023 00:39:36 +0000 (18:39 -0600)]
Update app.example.ini (#23480)

19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 15 Mar 2023 00:17:03 +0000 (00:17 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoFix due date being wrong on issue list (#23475)
Yarden Shoham [Tue, 14 Mar 2023 20:55:49 +0000 (22:55 +0200)]
Fix due date being wrong on issue list (#23475)

Exactly like #22302 but in the issue list page

19 months agotest_env: hardcode major go version in use (#23464)
techknowlogick [Tue, 14 Mar 2023 20:09:01 +0000 (16:09 -0400)]
test_env: hardcode major go version in use (#23464)

hardcode the version of test_env we use in docker, so that we can use
different major versions of golang between versions of Gitea

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
19 months agoPush option bonus for PTC docs (#23473)
John Olheiser [Tue, 14 Mar 2023 17:12:27 +0000 (12:12 -0500)]
Push option bonus for PTC docs (#23473)

Follow-up for #23458

I could have suggested this on the original PR, but I thought there
would be more to add. Hadn't noticed the push options docs already had
nearly the same shell command. 😅

Signed-off-by: jolheiser <john.olheiser@gmail.com>
19 months agoLint Markdown pass
techknowlogick [Tue, 14 Mar 2023 16:53:02 +0000 (12:53 -0400)]
Lint Markdown pass

19 months agoPush to create docs (#23458)
techknowlogick [Tue, 14 Mar 2023 16:37:11 +0000 (12:37 -0400)]
Push to create docs (#23458)

This PR adds user friendly documentation on how to use push to create
feature

19 months agoConvert GitHub event on actions and fix some pull_request events. (#23037)
Lunny Xiao [Tue, 14 Mar 2023 12:50:51 +0000 (20:50 +0800)]
Convert GitHub event on actions and fix some pull_request events. (#23037)

Follow #22680

Partially Fix #22958, on pull_request, `opened`, `reopened`,
`synchronize` supported, `edited` hasn't been supported yet because
Gitea doesn't trigger that events.

---------

Co-authored-by: yp05327 <576951401@qq.com>
19 months agoRemove wrongly added column on migration test fixtures (#23456)
Lunny Xiao [Tue, 14 Mar 2023 11:49:59 +0000 (19:49 +0800)]
Remove wrongly added column on migration test fixtures (#23456)

Fix https://drone.gitea.io/go-gitea/gitea/69418/3/8
Migration fixtures are in `models/migrations/fixtures`, every folder
will be used only by the test with the same name.
For `Test_DeleteOrphanedIssueLabels`, the fixture should keep consistent
as the database structure at that time. So the newly added `exclusive`
is not right. Just revert the change in
https://github.com/go-gitea/gitea/pull/22585/files#diff-f8db9cbbaa10bf7b27eb726884454db821a4b4f8cb9a0d50435555908761bbcb

19 months agoRefactor branch/tag selector to Vue SFC (#23421)
wxiaoguang [Tue, 14 Mar 2023 09:51:20 +0000 (17:51 +0800)]
Refactor branch/tag selector to Vue SFC (#23421)

Follow #23394

There were many bad smells in old code. This PR only moves the code into
Vue SFC, doesn't touch the unrelated logic.

update: after
https://github.com/go-gitea/gitea/pull/23421/commits/5f23218c851e12132f538a404c946bbf6ff38e62
, there should be no usage of the vue-rumtime-compiler anymore
(hopefully), so I think this PR could close #19851

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoadd admin API email endpoints (#22792)
techknowlogick [Tue, 14 Mar 2023 07:54:40 +0000 (03:54 -0400)]
add admin API email endpoints (#22792)

add email endpoint to admin API to ensure API parity with admin
dashboard.

19 months agoadd user rename endpoint to admin api (#22789)
techknowlogick [Tue, 14 Mar 2023 07:45:21 +0000 (03:45 -0400)]
add user rename endpoint to admin api (#22789)

this is a simple endpoint that adds the ability to rename users to the
admin API.

Note: this is not in a mergeable state. It would be better if this was
handled by a PATCH/POST to the /api/v1/admin/users/{username} endpoint
and the username is modified.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
19 months agoAdd workflow error notification in ui (#23404)
yp05327 [Tue, 14 Mar 2023 07:27:03 +0000 (16:27 +0900)]
Add workflow error notification in ui (#23404)

![image](https://user-images.githubusercontent.com/18380374/224237847-07a30029-32d4-4af7-a36e-e55f0ed899aa.png)

![image](https://user-images.githubusercontent.com/18380374/224239309-a96120e1-5eec-41c0-89aa-9cf63d1df30c.png)

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoMake branches list page operations remember current page (#23420)
wxiaoguang [Tue, 14 Mar 2023 05:11:38 +0000 (13:11 +0800)]
Make branches list page operations remember current page (#23420)

Close #23411

Always pass "page" query parameter to backend, and make backend respect
it.

The `ctx.FormInt("limit")` is never used, so removed.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agofix markdown lint issue (#23457)
techknowlogick [Tue, 14 Mar 2023 04:10:01 +0000 (00:10 -0400)]
fix markdown lint issue (#23457)

CI is failing with the following:
```
docs/content/doc/features/localization.zh-cn.md:16 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "# 本地化"]
docs/content/doc/features/localization.zh-cn.md:23 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## 支持的语言"]
```

This fixes that error

19 months agoRefactor dashboard repo list to Vue SFC (#23405)
wxiaoguang [Tue, 14 Mar 2023 04:09:06 +0000 (12:09 +0800)]
Refactor dashboard repo list to Vue SFC (#23405)

Similar to #23394

The dashboard repo list mixes jQuery/Fomantic UI/Vue together, it's very
diffcult to maintain and causes unfixable a11y problems.

This PR uses two steps to refactor the repo list:

1. move `data-` attributes to JS object and use Vue data as much as
possible
https://github.com/go-gitea/gitea/pull/23405/commits/d3adc0dcacf7de87b9819277e6598ac3993bbfa3
2. move the code into a Vue SFC
https://github.com/go-gitea/gitea/pull/23405/commits/7ebe55df6e67adfd272a4bf0a96ad6688edf661f

Total: +516 −585

Screenshots:

<details>

![image](https://user-images.githubusercontent.com/2114189/224271457-a23e05be-d7d3-4247-a803-f0ee30c36f44.png)

![image](https://user-images.githubusercontent.com/2114189/224271504-76fbd3da-4d7a-4725-b0d1-fbff83caac63.png)

![image](https://user-images.githubusercontent.com/2114189/224271845-f007cadf-6c49-46bd-a65c-a3fc75bdba3b.png)

</details>

---------

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months agoUpdate localization.zh-cn.md (#23448)
LeenHawk [Tue, 14 Mar 2023 03:38:20 +0000 (11:38 +0800)]
Update localization.zh-cn.md (#23448)

As title.

19 months agoConvert `<div class="button">` to `<button class="button">` (#23337)
delvh [Tue, 14 Mar 2023 03:34:09 +0000 (04:34 +0100)]
Convert `<div class="button">` to `<button class="button">` (#23337)

This improves a lot of accessibility shortcomings.
Every possible instance of `<div class="button">` matching the command
`ag '<[^ab].*?class=.*?[" ]button[ "]' templates/ | grep -v 'dropdown'`
has been converted when possible.
divs with the `dropdown` class and their children were omitted as
1. more analysis must be conducted whether the dropdowns still work as
intended when they are a `button` instead of a `div`.
2. most dropdowns have `div`s as children. The HTML standard disallows
`div`s inside `button`s.
3. When a dropdown child that's part of the displayed text content is
converted to a `button`, the dropdown can be focused twice

Further changes include that all "gitea-managed" buttons with JS code
received an `e.preventDefault()` so that they don't accidentally submit
an underlying form, which would execute instead of cancel the action.
Lastly, some minor issues were fixed as well during the refactoring.

## Future improvements

As mentioned in
https://github.com/go-gitea/gitea/pull/23337#discussion_r1127277391,
`<a>`s without `href` attribute are not focusable.
They should later on be converted to `<button>`s.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 14 Mar 2023 00:16:09 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoAdd package registry architecture overview (#23445)
KN4CK3R [Mon, 13 Mar 2023 22:15:09 +0000 (23:15 +0100)]
Add package registry architecture overview (#23445)

As announced in #22810 I added a readme file to help understanding how
the package registry archictecture works and how the go packages are
related.

19 months agoHandle missing `README` in create repos API (#23387)
Zettat123 [Mon, 13 Mar 2023 21:55:30 +0000 (05:55 +0800)]
Handle missing `README` in create repos API (#23387)

Close #22934

In `/user/repos` API (and other APIs related to creating repos), user
can specify a readme template for auto init. At present, if the
specified template does not exist, a `500` will be returned . This PR
improved the logic and will return a `400` instead of `500`.

19 months agoFix missing commit status in PR which from forked repo (#23351)
sillyguodong [Mon, 13 Mar 2023 21:05:19 +0000 (05:05 +0800)]
Fix missing commit status in PR which from forked repo (#23351)

close: #23347

### Reference and Inference
According to Github REST API
[doc](https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#list-commit-statuses-for-a-reference):
1. The `Drone CI` that can create some commit status by
[API](https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28#create-a-commit-status)
is enabled in `go-gitea/gitea`. So I tried to call the API to get a
commit status list of a PR which is commited to upstream
repo(`go-gitea/gitea`). As a result, the API returned a array of commit
status.

![image](https://user-images.githubusercontent.com/33891828/223913371-313d047a-5e2e-484c-b13e-dcd38748703e.png)
2. Then I tried to call the API to get commit status list of the
reference which of the `SHA` is the same as step 1 in the repo which is
forked from `go-gitea/gitea`. But I got a empty array.

![image](https://user-images.githubusercontent.com/33891828/223930827-17a64d3c-f466-4980-897c-77fe386c4d3b.png)

So, I believe it that:
1. The commit status is not shared between upstream repo and forked
repo.
2. The coomit status is bound to a repo that performs actions. (Gitea's
logic is the same)

### Cause
During debugging, I found it that commit status are not stored in the DB
as expected.
So, I located the following code:

https://github.com/go-gitea/gitea/blob/8cadd51bf295e6ff36ac36efed68cc5de34c9382/services/actions/commit_status.go#L18-L26
When I create a PR, the type of `event` is `pull request`, not `push`.
So the code return function directly.

### Screenshot

![image](https://user-images.githubusercontent.com/33891828/223939339-dadf539c-1fdd-40c4-96e9-2e4fa733f531.png)

![image](https://user-images.githubusercontent.com/33891828/223939519-edb02bf0-2478-4ea5-9366-be85468f02db.png)

![image](https://user-images.githubusercontent.com/33891828/223939557-ec6f1375-5536-400e-8987-fb7d2fd452fa.png)

### Other
In this PR, I also fix the problem of missing icon which represents
running in PRs list.

![image](https://user-images.githubusercontent.com/33891828/223939898-2a0339e4-713f-4c7b-9d99-2250a43f3457.png)

![image](https://user-images.githubusercontent.com/33891828/223939979-037a975f-5ced-480c-bac7-0ee00ebfff4b.png)

19 months agoAdd Swift package registry (#22404)
KN4CK3R [Mon, 13 Mar 2023 20:28:39 +0000 (21:28 +0100)]
Add Swift package registry (#22404)

This PR adds a [Swift](https://www.swift.org/) package registry.

![grafik](https://user-images.githubusercontent.com/1666336/211842523-07521cbd-8fb6-400f-820c-ee8048b05ae8.png)

19 months agoPurge API comment (#23451)
John Olheiser [Mon, 13 Mar 2023 19:41:38 +0000 (14:41 -0500)]
Purge API comment (#23451)

This PR just adds the `purge` query parameter to the swagger docs for
admin user delete.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
19 months agoUse context for `RepositoryList.LoadAttributes` (#23435)
yp05327 [Mon, 13 Mar 2023 11:31:41 +0000 (20:31 +0900)]
Use context for `RepositoryList.LoadAttributes` (#23435)

19 months agoadd path prefix to ObjectStorage.Iterator (#23332)
FuXiaoHei [Mon, 13 Mar 2023 10:23:51 +0000 (18:23 +0800)]
add path prefix to ObjectStorage.Iterator (#23332)

Support to iterator subdirectory in ObjectStorage for
ObjectStorage.Iterator method.

It's required for https://github.com/go-gitea/gitea/pull/22738 to make
artifact files cleanable.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoSupport reflogs (#22451)
Philip Peterson [Mon, 13 Mar 2023 07:51:07 +0000 (00:51 -0700)]
Support reflogs (#22451)

This PR adds support for reflogs on all repositories. It does this by
adding a global configuration entry.

Implements #14865

---------

Signed-off-by: Philip Peterson <philip.c.peterson@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix actions frontend bugs (pagination, long name alignment) and small simplify (...
Hester Gong [Mon, 13 Mar 2023 05:31:06 +0000 (13:31 +0800)]
Fix actions frontend bugs (pagination, long name alignment) and small simplify (#23370)

1 Right now on actions page, the action list will not be aligned if
commit message is long. In this PR, the changes are:
- The branch tag is moved to bottom row
- Width percentage is given to make them aligned
- Show "..." if commit is longer than two lines.
- Align the status icon with the commit message with baseline

 Before:
<img width="1068" alt="截屏2023-03-08 12 23 22"
src="https://user-images.githubusercontent.com/17645053/223628534-6b9472cb-29f5-40a3-9714-c5152553049e.png">

 After:
<img width="756" alt="截屏2023-03-08 13 34 28"
src="https://user-images.githubusercontent.com/17645053/223628571-da94698b-0e0a-43e3-ae82-34d8c780e5ba.png">

2 Right now the actions list's pagination is not working properly
because Param is not passed to pagination template, in this PR Param
Strings are passed to the pager

Before:
<img width="1176" alt="截屏2023-03-08 12 23 50"
src="https://user-images.githubusercontent.com/17645053/223629207-8b67ce74-2342-4259-bc81-036e37752716.png">

After:
<img width="1343" alt="截屏2023-03-08 13 11 54"
src="https://user-images.githubusercontent.com/17645053/223629321-4f538f8a-45dc-4d6f-ae60-2c82680ae3e7.png">

3 A small simplify in `RepoActionView.vue` .

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoScoped label display and documentation tweaks (#23430)
Brecht Van Lommel [Mon, 13 Mar 2023 00:46:13 +0000 (01:46 +0100)]
Scoped label display and documentation tweaks (#23430)

* Fix scoped label left and right part breaking across lines.
* Remove slanted divider in scoped label display, make it straight.
After using this for a while, this feels more visually noisy than
helpful.
* Reduce contrast between scope and item to reduce probability of
unreadable text on background.
* Change documentation to remove mention of non-exclusive scoped labels.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoDeduplicate template code for label selection menu (#23431)
Brecht Van Lommel [Sun, 12 Mar 2023 20:39:56 +0000 (21:39 +0100)]
Deduplicate template code for label selection menu (#23431)

19 months agoShow edit/close/delete button on organization wide repositories (#23388)
yp05327 [Sun, 12 Mar 2023 13:36:47 +0000 (22:36 +0900)]
Show edit/close/delete button on organization wide repositories (#23388)

A part of https://github.com/go-gitea/gitea/pull/22865

19 months agoSync the class change of Edit Column Button to JS code (#23400)
yp05327 [Sun, 12 Mar 2023 11:09:20 +0000 (20:09 +0900)]
Sync the class change of Edit Column Button to JS code (#23400)

In #22767, we changed the class of `Edit Column` button from `red` to
`primary`
But `red` is used to find this button in js.....

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
19 months agoPreserve file size when creating attachments (#23406)
Peter [Sun, 12 Mar 2023 07:48:07 +0000 (08:48 +0100)]
Preserve file size when creating attachments (#23406)

When creating attachments (issue, release, repo) the file size (being
part of the multipart file header) is passed through the chain of
creating an attachment to ensure the MinIO client can stream the file
directly instead of having to read it to memory completely at first.

Fixes #23393

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 12 Mar 2023 00:16:02 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoUse buildkit for docker builds (#23415)
techknowlogick [Sat, 11 Mar 2023 21:08:56 +0000 (16:08 -0500)]
Use buildkit for docker builds (#23415)

This switches Docker builds to use build kit which is less prone to
error than legacy docker-in-docker building. It also switches back to
using the upstream docker image again now that it has been updated to a
version that supports alpine 3.14+

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months agoRefactor branch/tag selector dropdown (first step) (#23394)
wxiaoguang [Sat, 11 Mar 2023 10:47:09 +0000 (18:47 +0800)]
Refactor branch/tag selector dropdown (first step) (#23394)

Follow:
* #23345

The branch/tag selector dropdown mixes jQuery/Fomantic UI/Vue together,
it's very diffcult to maintain and causes unfixable a11y problems. It
also causes problems like #19851 #21314 #21952

This PR is the first step for the refactoring, move `data-` attributes
to JS object and use Vue data as much as possible.

The old selector `'.choose.reference .dropdown'` was also wrong, it hits
`<div class="choose reference"><svg class="dropdown icon">` and would
cause undefined behaviors.

I have done some quick tests and it works. After this PR gets merged, I
will move the code into a Vue SFC in next PR.

![image](https://user-images.githubusercontent.com/2114189/224099638-378a8a86-0865-47d1-bcba-f972506374c7.png)

![image](https://user-images.githubusercontent.com/2114189/224099690-70276cf5-b1e4-404a-b0c6-582448abf40e.png)

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 11 Mar 2023 00:15:59 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoHide target selector if tag exists when creating new release (#23171)
Zettat123 [Fri, 10 Mar 2023 16:42:38 +0000 (00:42 +0800)]
Hide target selector if tag exists when creating new release (#23171)

Close #22649.

|status|screenshot|
|-|-|
|empty tag name|<img
src="https://user-images.githubusercontent.com/15528715/221490165-fd3abd2e-6dc5-4562-bece-d1d6a305479e.png"
width="300px"/>|
|new tag|<img
src="https://user-images.githubusercontent.com/15528715/221490450-49b2a48e-b206-49f4-bd79-34b1ea64156f.png"
width="300px"/>|
|existing tag|<img
src="https://user-images.githubusercontent.com/15528715/221490301-4d1879dd-4947-4abc-9b9a-e77be1806981.png"
width="300px"/>|

19 months agoParse external request id from request headers, and print it in access log (#22906)
sillyguodong [Fri, 10 Mar 2023 15:54:32 +0000 (23:54 +0800)]
Parse external request id from request headers, and print it in access log (#22906)

Close: #22890.

---
### Configure in .ini file:
```ini
[log]
REQUEST_ID_HEADERS = X-Request-ID, X-Trace-Id
```

### Params in Request Header
```
X-Trace-ID: trace-id-1q2w3e4r
```

![image](https://user-images.githubusercontent.com/33891828/218665296-8fd19a0f-ada6-4236-8bdb-f99201c703e8.png)

### Log output:

![image](https://user-images.githubusercontent.com/33891828/218665225-cc242a57-4ffc-449a-a1f6-f45ded0ead60.png)

19 months agoAdd missing tabs to org projects page (#22705)
yp05327 [Fri, 10 Mar 2023 15:18:20 +0000 (00:18 +0900)]
Add missing tabs to org projects page (#22705)

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

Context Data `IsOrganizationMember` and `IsOrganizationOwner` is used to
control the visibility of `people` and `team` tab.

https://github.com/go-gitea/gitea/blob/2871ea08096cba15546f357d0ec473734ee9d8be/templates/org/menu.tmpl#L19-L40

And because of the reuse of user projects page, User Context is changed
to Organization Context. But the value of `IsOrganizationMember` and
`IsOrganizationOwner` are not being given.

I reused func `HandleOrgAssignment` to add them to the ctx, but may have
some unnecessary variables, idk whether it is ok.

I found there is a missing `PageIsViewProjects` at create project page.

19 months agoAdd user webhooks (#21563)
KN4CK3R [Fri, 10 Mar 2023 14:28:32 +0000 (15:28 +0100)]
Add user webhooks (#21563)

Currently we can add webhooks for organizations but not for users. This
PR adds the latter. You can access it from the current users settings.

![grafik](https://user-images.githubusercontent.com/1666336/197391408-15dfdc23-b476-4d0c-82f7-9bc9b065988f.png)

19 months agoHandle OpenID discovery URL errors a little nicer when creating/editing sources ...
zeripath [Fri, 10 Mar 2023 06:14:43 +0000 (06:14 +0000)]
Handle OpenID discovery URL errors a little nicer when creating/editing sources (#23397)

When there is an error creating a new openIDConnect authentication
source try to handle the error a little better.

Close #23283

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoSplit CI pipelines (#23385)
John Olheiser [Fri, 10 Mar 2023 06:13:17 +0000 (00:13 -0600)]
Split CI pipelines (#23385)

- This PR attempts to split our various DB tests into separate
pipelines.
- It splits up some of the extra feature-related tests rather than
having most of them in the MySQL test.
- It disables the race detector for some of the pipelines as well, as it
can cause slower runs and is mostly redundant when the pipelines just
swap DBs.
- It builds without SQLite support for any of the non-SQLite pipelines.
- It moves the e2e test to using SQLite rather than PG (partially
because I moved the minio tests to PG and that mucked up the test
config, and partially because it avoids another running service)
- It splits up the `go mod download` task in the Makefile from the tool
installation, as the tools are only needed in the compliance pipeline.
(Arguably even some of the tools aren't needed there, but that could be
a follow-up PR)
- SQLite is now the only arm64 pipeline, moving PG back to amd64 which
can leverage autoscaler

Should resolve #22010 - one thing that wasn't changed here but is
mentioned in that issue, unit tests are needed in the same pipeline as
an integration test in order to form a complete coverage report (at
least as far as I could tell), so for now it remains in a pipeline with
a DB integration test.

Please let me know if I've inadvertently changed something that was how
it was on purpose.

---

I will say sometimes it's hard to pin down the average time, as a
pipeline could be waiting for a runner for X minutes and that brings the
total up by X minutes as well, but overall this does seem to be faster
on average.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoImprove squash merge commit author and co-author with private emails (#22977)
Brecht Van Lommel [Fri, 10 Mar 2023 03:17:04 +0000 (04:17 +0100)]
Improve squash merge commit author and co-author with private emails (#22977)

When emails addresses are private, squash merges always use
`@noreply.localhost` for the author of the squash commit. And the author
is redundantly added as a co-author in the commit message.

Also without private mails, the redundant co-author is possible when
committing with a signature that's different than the user full name and
primary email.

Now try to find a commit by the same user in the list of commits, and
prefer the signature from that over one constructed from the account
settings.

19 months agoFix broken Chroma CSS styles (#23174)
wxiaoguang [Fri, 10 Mar 2023 03:16:16 +0000 (11:16 +0800)]
Fix broken Chroma CSS styles (#23174)

The CSS styles in Gitea themes are out-of-sync of Chroma's styles.

This PR introduces a `chroma-style-diff.go` tool to compare the diff.
The missing CSS styles have been added manually. They are left as empty
to reduce arguments because there was no color for them before.

And this PR fixes #22348, with just 2 lines changed: `.chroma .kt & .n`,
these colors are taken from GitHub.

It's good enough for #22348

![image](https://user-images.githubusercontent.com/2114189/221551941-0d27d11d-e71e-498f-8e88-92b558fe4a18.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
19 months agoAdd gradle samples in maven doc of packages (#23374)
InsanusMokrassar [Fri, 10 Mar 2023 03:14:59 +0000 (09:14 +0600)]
Add gradle samples in maven doc of packages (#23374)

Samples for gitea.io docs to help to use maven packages with
gradle-oriented projects

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
19 months agoFix and move "Use this template" button (#23398)
silverwind [Fri, 10 Mar 2023 03:14:45 +0000 (04:14 +0100)]
Fix and move "Use this template" button (#23398)

Before:
<img width="1157" alt="Screenshot 2023-03-09 at 23 21 25"
src="https://user-images.githubusercontent.com/115237/224174168-869966cc-fa59-4231-b449-23bd9db12862.png">

After:
<img width="1145" alt="Screenshot 2023-03-09 at 23 24 34"
src="https://user-images.githubusercontent.com/115237/224174173-7f5b9c22-44c4-4eed-990c-da49d749eb0e.png">

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 10 Mar 2023 00:15:59 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoAdd init file for Ubuntu (#23362)
Lycolia Rizzim [Thu, 9 Mar 2023 22:54:37 +0000 (07:54 +0900)]
Add init file for Ubuntu (#23362)

Created an init file for Ubuntu that will be useful when running it on
WSL.

19 months agoRename `canWriteUnit` to `canWriteProjects` (#23386)
yp05327 [Thu, 9 Mar 2023 19:57:20 +0000 (04:57 +0900)]
Rename `canWriteUnit` to `canWriteProjects` (#23386)

A part of https://github.com/go-gitea/gitea/pull/22865

19 months agoFix pull request update showing too many commits with multiple branches (#22856)
Brecht Van Lommel [Thu, 9 Mar 2023 18:14:22 +0000 (19:14 +0100)]
Fix pull request update showing too many commits with multiple branches (#22856)

When the base repository contains multiple branches with the same
commits as the base branch, pull requests can show a long list of
commits already in the base branch as having been added.

What this is supposed to do is exclude commits already in the base
branch. But the mechansim to do so assumed a commit only exists in a
single branch. Now use `git rev-list A B --not branchName` instead of
filtering commits afterwards.

The logic to detect if there was a force push also was wrong for
multiple branches. If the old commit existed in any branch in the base
repository it would assume there was no force push. Instead check if the
old commit is an ancestor of the new commit.

19 months agoFix incorrect NotFound conditions in org/projects.go (#23384)
yp05327 [Thu, 9 Mar 2023 16:59:50 +0000 (01:59 +0900)]
Fix incorrect NotFound conditions in org/projects.go (#23384)

A part of https://github.com/go-gitea/gitea/pull/22865

user/org project's `RepoID` is always 0, we need to check `OwnerID`

19 months agoRefactor merge/update git command calls (#23366)
wxiaoguang [Thu, 9 Mar 2023 15:48:52 +0000 (23:48 +0800)]
Refactor merge/update git command calls (#23366)

Follow #22568

* Remove unnecessary ToTrustedCmdArgs calls
    * the FAQ in  #22678
* Quote: When using ToTrustedCmdArgs, the code will be very complex (see
the changes for examples). Then developers and reviewers can know that
something might be unreasonable.
* The `signArg` couldn't be empty, it's either `-S{keyID}` or
`--no-gpg-sign`.
* Use `signKeyID` instead, add comment "empty for no-sign, non-empty to
sign"
* 5-line code could be extracted to a common `NewGitCommandCommit()` to
handle the `signKeyID`, but I think it's not a must, current code is
clear enough.

19 months agoRedirect to project again after editing it (#23326)
yp05327 [Thu, 9 Mar 2023 14:38:29 +0000 (23:38 +0900)]
Redirect to project again after editing it (#23326)

A part of https://github.com/go-gitea/gitea/pull/22865

We have edit buttons in projects list page and project view page.
But after user edit a project, it will always redirect to the projects
list page.

19 months agoAdd Gitea Community Code of Conduct (#23188)
Jason Song [Thu, 9 Mar 2023 02:49:34 +0000 (10:49 +0800)]
Add Gitea Community Code of Conduct (#23188)

The Gitea Community Code of Conduct.

Authored by lunny. Slightly modified from [Go
CoC](https://go.dev/conduct)

---

CC all TOCs:

@go-gitea/technical-oversight-committee

And we welcome suggestions from everyone.

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Nick <nick@kousu.ca>
Co-authored-by: Lauris BH <lauris@nix.lv>
19 months agoTest renderReadmeFile (#23185)
Nick [Thu, 9 Mar 2023 01:24:23 +0000 (20:24 -0500)]
Test renderReadmeFile (#23185)

Add test coverage to the important features of
[`routers.web.repo.renderReadmeFile`](https://github.com/go-gitea/gitea/blob/067b0c2664d127c552ccdfd264257caca4907a77/routers/web/repo/view.go#L273);
namely that:

- it can handle looking in docs/, .gitea/, and .github/
- it can handle choosing between multiple competing READMEs
- it prefers the localized README to the markdown README to the
plaintext README
- it can handle broken symlinks when processing all the options
- it uses the name of the symlink, not the name of the target of the
symlink

19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 9 Mar 2023 00:15:57 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoSet `X-Gitea-Debug` header once (#23361)
Yarden Shoham [Wed, 8 Mar 2023 20:40:04 +0000 (22:40 +0200)]
Set `X-Gitea-Debug` header once (#23361)

Instead of adding it

# Before
On the raw commit page:

![image](https://user-images.githubusercontent.com/20454870/223470744-cdf11898-e023-4198-8c8b-c294e5d78b73.png)

# After

![image](https://user-images.githubusercontent.com/20454870/223470596-af898d66-bd5b-4ddb-b220-ceb1f149bfec.png)

Fixes #23308

---------

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
19 months agoImprove cache context (#23330)
Jason Song [Wed, 8 Mar 2023 17:57:05 +0000 (01:57 +0800)]
Improve cache context (#23330)

Related to: #22294 #23186 #23054

Replace: #23218

Some discussion is in the comments of #23218.

Highlights:
- Add Expiration for cache context. If a cache context has been used for
more than 10s, the cache data will be ignored, and warning logs will be
printed.
- Add `discard` field to `cacheContext`, a `cacheContext` with `discard`
true will drop all cached data and won't store any new one.
- Introduce `WithNoCacheContext`, if one wants to run long-life tasks,
but the parent context is a cache context,
`WithNoCacheContext(perentCtx)` will discard the cache data, so it will
be safe to keep the context for a long time.
- It will be fine to treat an original context as a cache context, like
`GetContextData(context.Backgraud())`, no warning logs will be printed.

Some cases about nesting:

When:
- *A*, *B* or *C* means a cache context.
- ~*A*~, ~*B*~ or ~*C*~ means a discard cache context.
- `ctx` means `context.Backgrand()`
- *A(ctx)* means a cache context with `ctx` as the parent context.
- *B(A(ctx))* means a cache context with `A(ctx)` as the parent context.
- `With` means `WithCacheContext`
- `WithNo` means `WithNoCacheContext`

So:
- `With(ctx)` -> *A(ctx)*
- `With(With(ctx))` -> *A(ctx)*, not *B(A(ctx))*
- `With(With(With(ctx)))` -> *A(ctx)*, not *C(B(A(ctx)))*
- `WithNo(ctx)` -> *ctx*, not *~A~(ctx)*
- `WithNo(With(ctx))` -> *~A~(ctx)*
- `WithNo(WithNo(With(ctx)))` -> *~A~(ctx)*, not *~B~(~A~(ctx))*
- `With(WithNo(With(ctx)))` -> *B(~A~(ctx))*
- `WithNo(With(WithNo(With(ctx))))` -> *~B~(~A~(ctx))*
- `With(WithNo(With(WithNo(With(ctx)))))` -> *C(~B~(~A~(ctx)))*

19 months agoadd user visibility in dashboard navbar (#22747)
yp05327 [Wed, 8 Mar 2023 15:18:10 +0000 (00:18 +0900)]
add user visibility in dashboard navbar (#22747)

Add private/limited tag to dashboard user/org list dropdown menu

![image](https://user-images.githubusercontent.com/18380374/216752207-5beb5281-1b0b-4e2b-adfc-b39c192c5032.png)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix panic when getting notes by ref (#23372)
Zettat123 [Wed, 8 Mar 2023 12:21:23 +0000 (20:21 +0800)]
Fix panic when getting notes by ref (#23372)

Fix #23357 .

Now the `/repos/{owner}/{repo}/git/notes/{sha}` API supports getting
notes by a ref or sha
(https://try.gitea.io/api/swagger#/repository/repoGetNote). But the
`GetNote` func can only accept commit ID.

https://github.com/go-gitea/gitea/blob/a12f5757372f751d25f9e5ca1f168f6920ded894/modules/git/notes_nogogit.go#L18

So we need to convert the query parameter to commit ID before calling
`GetNote`.

19 months agoUse CleanPath instead of path.Clean (#23371)
Lunny Xiao [Wed, 8 Mar 2023 12:17:39 +0000 (20:17 +0800)]
Use CleanPath instead of path.Clean (#23371)

As title.

19 months agoReduce duplicate and useless code in options (#23369)
Jason Song [Wed, 8 Mar 2023 09:31:27 +0000 (17:31 +0800)]
Reduce duplicate and useless code in options (#23369)

Avoid maintaining two copies of code, some functions can be used with
both `bindata` and `no bindata`.

And removed `GetRepoInitFile`, it's useless now.
`Readme`/`Gitignore`/`License`/`Labels` will clean the name and use
custom files when available.

19 months agoClean Path in Options (#23006)
JakobDev [Wed, 8 Mar 2023 07:07:58 +0000 (08:07 +0100)]
Clean Path in Options (#23006)

At the Moment it is possible to read files in another Directory as
supposed using the Options functions. e.g.
`options.Gitignore("../label/Default) `. This was discovered while
working on #22783, which exposes `options.Gitignore()` through the
public API. At the moment, this is not a security problem, as this
function is only used internal, but I thought it would be a good idea to
make a PR to fix this for all types of Options files, not only
Gitignore, to make it safe for the further. This PR should be merged
before the linked PR.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
19 months agoDo not recognize text files as audio (#23355)
wxiaoguang [Wed, 8 Mar 2023 03:40:41 +0000 (11:40 +0800)]
Do not recognize text files as audio (#23355)

Close #17108

This PR uses a trick (removing the ID3 tag) to detect the content again
to to see whether the content is text type.

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix incorrect display for comment context menu (#23343)
wxiaoguang [Wed, 8 Mar 2023 03:26:37 +0000 (11:26 +0800)]
Fix incorrect display for comment context menu  (#23343)

Replace #23342

Fix a regression of #23014: the `a` couldn't be used here because
Fomantic UI has style conflicts: `.ui.comments .comment .actions a {
display: inline-block; }`

And complete one more of my TODOs: "in the future there could be a
special CSS class for it"

19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 8 Mar 2023 00:15:50 +0000 (00:15 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoPass context to avatar for projects view (#23359)
delvh [Tue, 7 Mar 2023 23:17:35 +0000 (00:17 +0100)]
Pass context to avatar for projects view (#23359)

Previously, a 500 response was returned when
- an issue had assignees
- the issue was assigned to a project
- you tried to view this project

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoRefactor and tidy-up the merge/update branch code (#22568)
zeripath [Tue, 7 Mar 2023 20:07:35 +0000 (20:07 +0000)]
Refactor and tidy-up the merge/update branch code (#22568)

The merge and update branch code was previously a little tangled and had
some very long functions. The functions were not very clear in their
reasoning and there were deficiencies in their logging and at least one
bug in the handling of LFS for update by rebase.

This PR substantially refactors this code and splits things out to into
separate functions. It also attempts to tidy up the calls by wrapping
things in "context"s. There are also attempts to improve logging when
there are errors.

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: delvh <dev.lh@web.de>
19 months agoFix adding of empty class name (#23352)
Hester Gong [Tue, 7 Mar 2023 15:08:22 +0000 (23:08 +0800)]
Fix adding of empty class name (#23352)

This PR is to fix the error shown below. The reason is because
[`class-name`
prop](https://github.com/go-gitea/gitea/blob/main/web_src/js/components/ActionRunStatus.vue#L6)
given to `svg` component has a space, and classList cannot add empty
string.

https://user-images.githubusercontent.com/17645053/223346720-c7f9de43-5e69-4ecf-93c0-90bf04090693.mov

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix various ImageDiff/SVG bugs (#23312)
wxiaoguang [Tue, 7 Mar 2023 12:11:24 +0000 (20:11 +0800)]
Fix various ImageDiff/SVG bugs (#23312)

Replace #23310, Close #19733

And fix various UI problems, including regressions from #22959 #22950
and more.

## SVG Detection

The old regexp may mismatch non-SVG files. This PR adds new tests for
those cases.

## UI Changes

### Before

![image](https://user-images.githubusercontent.com/2114189/222967716-f6ad8721-f46a-4a3f-9eb0-a89e488d3436.png)

![image](https://user-images.githubusercontent.com/2114189/222967780-8af8981a-e69d-4304-9dc4-0235582fa4f4.png)

### After

![image](https://user-images.githubusercontent.com/2114189/222967575-c21c23d4-0200-4e09-aac3-57895e853000.png)

![image](https://user-images.githubusercontent.com/2114189/222967585-8b8da262-bc96-441a-9851-8d3845f2659d.png)

![image](https://user-images.githubusercontent.com/2114189/222967595-58d9bea5-6df4-41fa-bf8a-86704117959d.png)

![image](https://user-images.githubusercontent.com/2114189/222967608-38757c1a-b8bd-4ebf-b7a8-3b30edb7f303.png)

![image](https://user-images.githubusercontent.com/2114189/222967623-9849a339-6fae-4484-8fa5-939e2fdacbf5.png)

![image](https://user-images.githubusercontent.com/2114189/222967633-4383d7dd-62ba-47a3-8c10-86f7ca7757ae.png)

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoRefactor `setting.Database.UseXXX` to methods (#23354)
Jason Song [Tue, 7 Mar 2023 10:51:06 +0000 (18:51 +0800)]
Refactor `setting.Database.UseXXX` to methods (#23354)

Replace #23350.

Refactor `setting.Database.UseMySQL` to
`setting.Database.Type.IsMySQL()`.

To avoid mismatching between `Type` and `UseXXX`.

This refactor can fix the bug mentioned in #23350, so it should be
backported.

19 months agoUpdate documentation for the new YAML label file format (#23020)
JonRB [Mon, 6 Mar 2023 23:39:07 +0000 (23:39 +0000)]
Update documentation for the new YAML label file format  (#23020)

update documentation to include an overview of the yaml label template that is part of PR #22976

Signed-off-by: Jon Roadley-Battin <jon.roadleybattin@gmail.com>
---------

Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
19 months agoRemove unnecessary space on link (#23334)
Lunny Xiao [Mon, 6 Mar 2023 19:12:10 +0000 (03:12 +0800)]
Remove unnecessary space on link (#23334)

The action run title has a blank. This PR removes it.

19 months agoFix incorrect redirect link of delete org project (#23327)
yp05327 [Mon, 6 Mar 2023 18:05:26 +0000 (03:05 +0900)]
Fix incorrect redirect link of delete org project (#23327)

A part of https://github.com/go-gitea/gitea/pull/22865/commits

The old code will cause 500 error.

19 months agoFix incorrect project links and use symlink icon for org-wide projects (#23325)
yp05327 [Mon, 6 Mar 2023 16:32:56 +0000 (01:32 +0900)]
Fix incorrect project links and use symlink icon for org-wide projects (#23325)

Fix displaying same projects icons between user/repo projects.
And fix incorrect projects links.
A part of https://github.com/go-gitea/gitea/pull/22865.

![image](https://user-images.githubusercontent.com/18380374/223044279-7b620ff1-d88a-4146-97e6-531bbf269761.png)

![image](https://user-images.githubusercontent.com/18380374/223044390-42911e3f-1f6b-439f-8441-4f3ebf99ea13.png)

![image](https://user-images.githubusercontent.com/18380374/223044437-5cad5391-0f95-4c8b-b0a3-32e263e2854f.png)

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>