]> source.dussan.org Git - gitea.git/log
gitea.git
12 months agoUpdate JS and Poetry dependencies and eslint (#27200) (#27201)
Giteabot [Fri, 22 Sep 2023 21:26:42 +0000 (05:26 +0800)]
Update JS and Poetry dependencies and eslint (#27200) (#27201)

Backport #27200 by @silverwind

- Update all JS and Poetry dependencies
- Remove deprecated `eslint-plugin-custom-elements` and replace it with
rules from `eslint-plugin-wc`
- Add a convenience `make update` to update both js and py dependencies
- Tested markdown toolbar, swagger and citation

Co-authored-by: silverwind <me@silverwind.io>
12 months agoFix release URL in webhooks (#27182) (#27185)
Giteabot [Thu, 21 Sep 2023 23:22:14 +0000 (07:22 +0800)]
Fix release URL in webhooks (#27182) (#27185)

Backport #27182 by @jolheiser

Resolves #27180

`URL` points to the API URL, `HTMLURL` points to the web page.

Notably, however, for PRs they are the same URL. I switched them to use
HTMLURL to match the rest of the codebase terminology.

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
12 months agoFix review request number and add more tests (#27104) (#27168)
Giteabot [Thu, 21 Sep 2023 17:01:37 +0000 (01:01 +0800)]
Fix review request number and add more tests (#27104) (#27168)

Backport #27104 by @lng2020

fix #27019
## testfixture yml
1. add issue20(a pr issue) in repo 23, org 17
2. add user15 to team 9
3. add four reviews about issue20
## test case
add two tests that are described with code comments
the code before pr #26784 failed the first test
<img width="479" alt="image"
src="https://github.com/go-gitea/gitea/assets/70063547/1d9b5787-11b4-4c4d-931f-6a9869547f35">
current code failed the second test(as mentioned in #27019)
<img width="484" alt="image"
src="https://github.com/go-gitea/gitea/assets/70063547/05608055-7587-43d1-bae1-92c688270819">
Any advice is appreciated.

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
12 months agoFix dropdown icon position (#27175) (#27177)
Giteabot [Thu, 21 Sep 2023 16:24:07 +0000 (00:24 +0800)]
Fix dropdown icon position (#27175) (#27177)

Backport #27175 by @wxiaoguang

According to https://fomantic-ui.com/modules/dropdown.html and our
"devtest" page, many dropdown elements has incorrect "icon" position.

This PR fixes all of them. Fix #27173

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
12 months agoFix repo sub menu (#27169) (#27170)
Giteabot [Thu, 21 Sep 2023 13:22:38 +0000 (21:22 +0800)]
Fix repo sub menu (#27169) (#27170)

Backport #27169 by @wxiaoguang

Fix #27166

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
12 months agoFix the variable regexp pattern on web page (#27161) (#27164)
Giteabot [Thu, 21 Sep 2023 12:09:44 +0000 (20:09 +0800)]
Fix the variable regexp pattern on web page (#27161) (#27164)

Backport #27161 by @lng2020

same as (https://github.com/go-gitea/gitea/pull/26910)

Co-authored-by: Nanguan Lin <70063547+lng2020@users.noreply.github.com>
12 months agoFix organization field being null in POST /orgs/{orgid}/teams (#27150) (#27163)
Giteabot [Thu, 21 Sep 2023 10:15:20 +0000 (18:15 +0800)]
Fix organization field being null in POST /orgs/{orgid}/teams (#27150) (#27163)

Backport #27150 by @memphis88

Similarly to the fix in https://github.com/go-gitea/gitea/pull/24694,
this addresses the team creation not returning the organization
information in the response.

This fix is connected to the
[issue](https://gitea.com/gitea/terraform-provider-gitea/issues/27)
discovered in the terraform provider.
Moreover, the
[documentation](https://docs.gitea.com/api/1.20/#tag/organization/operation/orgCreateTeam)
suggests that the response body should include the `organization` field
(currently being `null`).

Co-authored-by: Dionysios Kakouris <1369451+memphis88@users.noreply.github.com>
12 months agoAdd index to `issue_user.issue_id` (#27154) (#27158)
Giteabot [Thu, 21 Sep 2023 03:42:34 +0000 (11:42 +0800)]
Add index to `issue_user.issue_id` (#27154) (#27158)

Backport #27154 by @JakobDev

This fixes a performance bottleneck. It was discovered by Codeberg.
Every where query on that table (which has grown big over time) uses
this column, but there is no index on it.

See this part of the log which was posted on Matrix:
```
2023/09/10 00:52:01 ...rs/web/repo/issue.go:1446:ViewIssue() [W] [Slow SQL Query] UPDATE `issue_user` SET is_read=? WHERE uid=? AND issue_id=? [true x y] - 51.395434887s
2023/09/10 00:52:01 ...rs/web/repo/issue.go:1447:ViewIssue() [E] ReadBy: Error 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
2023/09/10 00:52:01 ...eb/routing/logger.go:102:func1() [I] router: completed GET /Codeberg/Community/issues/1201 for [::ffff:xxx]:0, 500 Internal Server Error in 52384.2ms @ repo/issue.go:1256(repo.ViewIssue)
```

Co-authored-by: JakobDev <jakobdev@gmx.de>
12 months agoFix successful return value for `SyncAndGetUserSpecificDiff` (#27152) v1.21.0-rc0
delvh [Wed, 20 Sep 2023 20:28:17 +0000 (22:28 +0200)]
Fix successful return value for `SyncAndGetUserSpecificDiff` (#27152)

A function should not return an error when it is successful.
Otherwise, things like https://discord.com/channels/322538954119184384/322538954119184384/1153705341620600833 happen…

12 months agoImprove actions docs related to `pull_request` event (#27126)
Zettat123 [Wed, 20 Sep 2023 06:28:35 +0000 (14:28 +0800)]
Improve actions docs related to `pull_request` event (#27126)

Related to #27039

The `ref` property in Gitea Actions is different from GitHub Actions.
This PR improves the documentation to explain the difference.

12 months agoRemove outdated paragraphs when comparing Gitea Actions to GitHub Actions (#27119)
delvh [Wed, 20 Sep 2023 03:02:58 +0000 (05:02 +0200)]
Remove outdated paragraphs when comparing Gitea Actions to GitHub Actions (#27119)

No backport needed as this new state only applies to 1.21+

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
12 months agoFix: treat tab "overview" as "repositories" in user profiles without readme (#27124)
hazy [Wed, 20 Sep 2023 01:48:44 +0000 (20:48 -0500)]
Fix: treat tab "overview" as "repositories" in user profiles without readme (#27124)

Beginning since 2af30f715e64dbb0a3900168e3768ffb36c06392, Gitea has a
500 error when visiting a user profile with `?tab=overview` in the URL
when the user doesn't have a `.profile/README.md`, because the backend
code assumes that if the tab is overview a profile repository must
exist, and checks that the repository is nil aren't done.

In this PR I treat `?tab=overview` the same as if no tab is set in the
URL, which corrects this behaviour- Now, when visiting `?tab=overview`,
if `.profile/README.md` exists on that user's profile it'll show that as
it should, otherwise it'll show the repositories tab.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
12 months agoFix incorrect test code for error handling (#27139)
wxiaoguang [Wed, 20 Sep 2023 00:51:36 +0000 (08:51 +0800)]
Fix incorrect test code for error handling (#27139)

If `assert.NoError` fails, it should return. Otherwise the code could
still execute even if the error occurs.

12 months agoIncrease auth provider icon size on login page (#27122)
silverwind [Tue, 19 Sep 2023 21:47:13 +0000 (23:47 +0200)]
Increase auth provider icon size on login page (#27122)

Before, 20px:
<img width="474" alt="Screenshot 2023-09-19 at 00 10 05"
src="https://github.com/go-gitea/gitea/assets/115237/4bed4edb-219d-4844-9d3c-0d747033b09f">

After, 28px:
<img width="576" alt="Screenshot 2023-09-19 at 00 20 40"
src="https://github.com/go-gitea/gitea/assets/115237/f482ac09-38ae-4c84-80d9-0bd39b7f9772">

Dropdown in account settings is unchanged at 20px:
<img width="157" alt="Screenshot 2023-09-19 at 00 09 11"
src="https://github.com/go-gitea/gitea/assets/115237/9c998cdf-eeed-4118-9262-664faaa56092">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
12 months agofix pagination for followers and following (#27127)
Earl Warren [Tue, 19 Sep 2023 15:24:54 +0000 (17:24 +0200)]
fix pagination for followers and following (#27127)

- Use the correct total amount for pagination. Thereby correctly show
the pagination bare when there's more than one page of
followers/followings.

Refs: https://codeberg.org/forgejo/forgejo/pulls/1477

(cherry picked from commit c1a136318be3bf72511bed108f2d67f2cf34e1b8)

Co-authored-by: Gusted <postmaster@gusted.xyz>
12 months agoservices/wiki: Close() after error handling (#27129)
Earl Warren [Tue, 19 Sep 2023 14:45:44 +0000 (16:45 +0200)]
services/wiki: Close() after error handling (#27129)

Refs: https://codeberg.org/forgejo/forgejo/pulls/1385

Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
(cherry picked from commit 589e7d346f51de4a0e2c461b220c8cad34133b2f)

Co-authored-by: Lars Lehtonen <lars.lehtonen@gmail.com>
12 months agoUse fetch helpers instead of fetch (#27026)
silverwind [Tue, 19 Sep 2023 00:50:30 +0000 (02:50 +0200)]
Use fetch helpers instead of fetch (#27026)

WIP because:

- [x] Some calls set a `content-type` but send no body, can likely
remove the header
- [x] Need to check whether `charset=utf-8` has any significance on the
webauthn calls, I assume not as it is the default for json content.
- [x] Maybe `no-restricted-globals` is better for eslint, but will
require a lot of duplication in the yaml or moving eslint config to a
`.js` extension.
- [x] Maybe export `request` as `fetch`, shadowing the global.

12 months agoChange green buttons to primary color (#27099)
silverwind [Mon, 18 Sep 2023 22:05:31 +0000 (00:05 +0200)]
Change green buttons to primary color (#27099)

I think it's better if the primary actions have primary color instead of
green which fits better into the overall single-color UI design. This PR
currently replaces every green button with primary:

<img width="141" alt="Screenshot 2023-09-16 at 14 07 59"
src="https://github.com/go-gitea/gitea/assets/115237/843c1e50-4fb2-4ec6-84ba-0efb9472dcbe">
<img width="161" alt="Screenshot 2023-09-16 at 14 07 51"
src="https://github.com/go-gitea/gitea/assets/115237/9442195a-a3b2-4a42-b262-8377d6f5c0d1">

Modal actions now use uncolored/primary instead of previous green/red
colors. I also removed the box-shadow on all basic buttons:

<img width="259" alt="Screenshot 2023-09-16 at 14 16 39"
src="https://github.com/go-gitea/gitea/assets/115237/5beea529-127a-44b0-8d4c-afa7b034a490">
<img width="261" alt="Screenshot 2023-09-16 at 14 17 42"
src="https://github.com/go-gitea/gitea/assets/115237/4757f7b2-4d46-49bc-a797-38bb28437b88">

The change currently includes the "Merge PR" button, for which we might
want to make an exception to match the icon color there:

<img width="442" alt="Screenshot 2023-09-16 at 14 33 53"
src="https://github.com/go-gitea/gitea/assets/115237/993ac1a5-c94d-4895-b76c-0d872181a70b">

12 months agoFix wrong xorm get usage on migration (#27111)
Lunny Xiao [Mon, 18 Sep 2023 19:59:19 +0000 (03:59 +0800)]
Fix wrong xorm get usage on migration (#27111)

Fix the bug on try.gitea.io

```log
2023/09/18 01:48:41 ...ations/migrations.go:635:Migrate() [I] Migration[276]: Add RemoteAddress to mirrors
2023/09/18 01:48:41 routers/common/db.go:34:InitDBEngine() [E] ORM engine initialization attempt #7/10 failed. Error: migrate: migration[276]: Add RemoteAddress to mirrors failed: exit status 128 - fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
 - fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
```

Caused by #26952

---------

Co-authored-by: Jason Song <i@wolfogre.com>
12 months agoFix the incorrect route path in the user edit page. (#27007)
CaiCandong [Mon, 18 Sep 2023 12:08:09 +0000 (20:08 +0800)]
Fix the incorrect route path in the user edit page. (#27007)

Regression of #26713

After #26713 , the base path of user edit has been changed to
`/admin/users/{userid}/edit`
## Before

https://github.com/go-gitea/gitea/assets/50507092/5f4a3f64-fe2b-4499-b110-e01c9d87ea19

12 months agoRefactor lfs requests (#26783)
Chongyi Zheng [Mon, 18 Sep 2023 08:40:50 +0000 (04:40 -0400)]
Refactor lfs requests (#26783)

- Refactor lfs request code
- The original code uses `performRequest` function to create the
request, uses a callback to modify the request, and then send the
request.
- Now it's replaced with `createRequest` that only creates request and
`performRequest` that only sends the request.
- Reuse `createRequest` and `performRequest` in `http_client.go` and
`transferadapter.go`

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
12 months agoDisplay archived labels specially when listing labels (#26820)
puni9869 [Mon, 18 Sep 2023 04:54:05 +0000 (10:24 +0530)]
Display archived labels specially when listing labels (#26820)

Follow up https://github.com/go-gitea/gitea/pull/26741

Changes:
Added archived label for org labels and added into issue filter list.

Part of https://github.com/go-gitea/gitea/issues/25237

---------

Signed-off-by: puni9869 <punitinani1@hotmail.com>
Co-authored-by: silverwind <me@silverwind.io>
12 months agoRemove a `gt-float-right` and some unnecessary helpers (#27110)
wxiaoguang [Mon, 18 Sep 2023 04:25:36 +0000 (12:25 +0800)]
Remove a `gt-float-right` and some unnecessary helpers (#27110)

Follow  Remove polluted .ui.right #26825

Remove more `gt-float-right`, remove unnecessary helpers, remove
negative margin tricks.

![image](https://github.com/go-gitea/gitea/assets/2114189/2785c6e6-7823-4699-a4f3-184eef50ceda)

12 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 18 Sep 2023 00:23:39 +0000 (00:23 +0000)]
[skip ci] Updated licenses and gitignores

12 months agoFix token endpoints ignore specified account (#27080)
CaiCandong [Mon, 18 Sep 2023 00:21:15 +0000 (08:21 +0800)]
Fix token endpoints ignore specified account (#27080)

Fix #26234
close #26323
close #27040

---------

Co-authored-by: silverwind <me@silverwind.io>
12 months agoMake SSPI auth mockable (#27036)
wxiaoguang [Sun, 17 Sep 2023 23:32:56 +0000 (07:32 +0800)]
Make SSPI auth mockable (#27036)

Before, the SSPI auth is only complied for Windows, it's difficult to
test and it breaks a lot.

Now, make the SSPI auth mockable and testable.

13 months agoSearch branches (#27055)
Lunny Xiao [Sun, 17 Sep 2023 08:24:40 +0000 (16:24 +0800)]
Search branches (#27055)

Resolve #25233

<img width="1315" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/3ba59b58-471a-4e1b-985c-87edac2268c0">

<img width="1297" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/b6caa12f-323b-4f70-9c44-ef91cb71a26c">

13 months agoFix wrong migration for email address (#27106)
Lunny Xiao [Sun, 17 Sep 2023 03:15:04 +0000 (11:15 +0800)]
Fix wrong migration for email address (#27106)

On Iterate, `sess` should not be used in the closure function body.

Caused by #26952

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 17 Sep 2023 00:24:27 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoSupport `.git-blame-ignore-revs` file (#26395)
KN4CK3R [Sat, 16 Sep 2023 17:42:34 +0000 (19:42 +0200)]
Support `.git-blame-ignore-revs` file (#26395)

Closes #26329

This PR adds the ability to ignore revisions specified in the
`.git-blame-ignore-revs` file in the root of the repository.

![grafik](https://github.com/go-gitea/gitea/assets/1666336/9e91be0c-6e9c-431c-bbe9-5f80154251c8)

The banner is displayed in this case. I intentionally did not add a UI
way to bypass the ignore file (same behaviour as Github) but you can add
`?bypass-blame-ignore=true` to the url manually.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months agoAdd `RemoteAddress` to mirrors (#26952)
KN4CK3R [Sat, 16 Sep 2023 16:03:02 +0000 (18:03 +0200)]
Add `RemoteAddress` to mirrors (#26952)

This PR adds a new field `RemoteAddress` to both mirror types which
contains the sanitized remote address for easier (database) access to
that information. Will be used in the audit PR if merged.

13 months agoUpgrading the actions/checkout@4 (#27096)
puni9869 [Sat, 16 Sep 2023 15:06:27 +0000 (20:36 +0530)]
Upgrading the actions/checkout@4 (#27096)

as title
..Upgrading the actions/checkout@4

Signed-off-by: puni9869 <punitinani1@hotmail.com>
Co-authored-by: silverwind <me@silverwind.io>
13 months agoNext round of `db.DefaultContext` refactor (#27089)
JakobDev [Sat, 16 Sep 2023 14:39:12 +0000 (16:39 +0200)]
Next round of `db.DefaultContext` refactor (#27089)

Part of #27065

13 months agoUi correction in mobile view nav bar left aligned items. (#27046)
puni9869 [Sat, 16 Sep 2023 14:09:25 +0000 (19:39 +0530)]
Ui correction in mobile view nav bar left aligned items. (#27046)

As title
From the long time I was looking for this UI, Now its the time to fix
it.

Before
<img width="252" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/963f2cb4-5cfd-4a14-ab85-88e25c3daef5">

<img width="502" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/58453ef1-2555-4568-95d0-5293055b33b8">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoAdd missing deps to files-changed (#27100)
silverwind [Sat, 16 Sep 2023 13:23:06 +0000 (15:23 +0200)]
Add missing deps to files-changed (#27100)

The `docs` and `yaml` actions categories need to run when the
dependencies `markdownlin-cli` or `yamllint` change, so add those to the
list of dependencies for these actions.

Fixes: https://github.com/go-gitea/gitea/issues/27098
13 months agoUse db.WithTx for AddTeamMember to avoid ctx abuse (#27095)
wxiaoguang [Sat, 16 Sep 2023 12:54:23 +0000 (20:54 +0800)]
Use db.WithTx for AddTeamMember to avoid ctx abuse (#27095)

Compare with ignoring spaces:
https://github.com/go-gitea/gitea/pull/27095/files?diff=split&w=1

13 months agoDrop Node.js 16 and update js dependencies (#27094)
Chongyi Zheng [Sat, 16 Sep 2023 11:36:35 +0000 (07:36 -0400)]
Drop Node.js 16 and update js dependencies (#27094)

- Drop Node.js 16 since it reached EOL
- Upgrade js dependencies
- Two packages have major version bump
  - `updates`: require node 18
- `eslint-plugin-array-func`: require `eslint` 8.40.0, which is
satisfied
- Run `make svg` for `@primer/octicons` update

13 months agoFix NPE when editing OAuth2 applications (#27078) 26212/head
JakobDev [Sat, 16 Sep 2023 09:13:26 +0000 (11:13 +0200)]
Fix NPE when editing OAuth2 applications (#27078)

Fixes #27072

It looks like there are some cases where `ContextUser` is not set here

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
13 months agoUse `print` instead of `printf` (#27093)
KN4CK3R [Sat, 16 Sep 2023 03:51:54 +0000 (05:51 +0200)]
Use `print` instead of `printf` (#27093)

A bit more performant when we only use it for appending strings.

13 months agoAdd tests for db indexer in indexer_test.go (#27087)
Nanguan Lin [Sat, 16 Sep 2023 03:15:21 +0000 (11:15 +0800)]
Add tests for db indexer in indexer_test.go (#27087)

As described in the title.
Some points:
1. Why need those tests?
Because `buildIssueOverview` is not well tested, there are several
continuous bugs in the issue overview webpage.
2. Why in indexer_test.go?
It's hard to put those tests in `./modules/indexer/issue/db/db_test.go`
because those tests need 'real' data in db mocked by fixtures instead of
random data in `./modules/indexer/issue/internal/tests`. When using
'real' data(`unittest.PrepareTestDatabase`), `InitIssueIndexer` and the
package `init()` function of `indexer` are required to init indexer.
3. Why only db?
The other three indexer engines are well tested by random data and it's
okay to also test them with 'real' data in db mocked by fixtures. Any
follow-up PR is welcome.
4. Those tests are really basic, any more complicated tests are welcome.
5. I think it's also necessary to add tests in `TestAPISearchIssues`
in`api_test_issue.go` and `TestIssues` in `home_test.go`

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 16 Sep 2023 00:21:59 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoAllow empty Conan files (#27092)
KN4CK3R [Fri, 15 Sep 2023 23:14:36 +0000 (01:14 +0200)]
Allow empty Conan files (#27092)

Fixes #27090

Looks like the Conan upload process has changed since last year. The
empty uploads don't occur anymore.

13 months agoActions are no longer experimental, so enable them by default (#27054)
Lunny Xiao [Fri, 15 Sep 2023 06:43:39 +0000 (14:43 +0800)]
Actions are no longer experimental, so enable them by default (#27054)

This PR makes the actions enabled by default, so people will find it
easier to enable actions in repository setting.

13 months agoUpdate brew installation documentation since gitea moved to brew core package (#27070)
Lunny Xiao [Fri, 15 Sep 2023 06:14:24 +0000 (14:14 +0800)]
Update brew installation documentation since gitea moved to brew core package (#27070)

ref: https://gitea.com/gitea/homebrew-gitea/pulls/178

13 months agoMore refactoring of `db.DefaultContext` (#27083)
JakobDev [Fri, 15 Sep 2023 06:13:19 +0000 (08:13 +0200)]
More refactoring of `db.DefaultContext` (#27083)

Next step of #27065

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 15 Sep 2023 00:22:32 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoReduce usage of `db.DefaultContext` (#27073)
JakobDev [Thu, 14 Sep 2023 17:09:32 +0000 (19:09 +0200)]
Reduce usage of `db.DefaultContext` (#27073)

Part of #27065

This reduces the usage of `db.DefaultContext`. I think I've got enough
files for the first PR. When this is merged, I will continue working on
this.

Considering how many files this PR affect, I hope it won't take to long
to merge, so I don't end up in the merge conflict hell.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months agoRemove the useless function `GetUserIssueStats` and move relevant tests to `indexer_t...
Nanguan Lin [Thu, 14 Sep 2023 16:35:53 +0000 (00:35 +0800)]
Remove the useless function `GetUserIssueStats` and move relevant tests to `indexer_test.go` (#27067)

Since the issue indexer has been refactored, the issue overview webpage
is built by the `buildIssueOverview` function and underlying
`indexer.Search` function and `GetIssueStats` instead of
`GetUserIssueStats`. So the function is no longer used.
I moved the relevant tests to `indexer_test.go` and since the search
option changed from `IssueOptions` to `SearchOptions`, most of the tests
are useless now.
We need more tests about the db indexer because those tests are highly
connected with the issue overview webpage and now this page has several
bugs.
Any advice about those test cases is appreciated.

---------

Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
13 months agoFix issue templates when blank isses are disabled (#27061)
JakobDev [Thu, 14 Sep 2023 14:20:16 +0000 (16:20 +0200)]
Fix issue templates when blank isses are disabled (#27061)

Fixes #27060

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
13 months agoDisplay all user types and org types on admin management UI (#27050)
Lunny Xiao [Thu, 14 Sep 2023 06:53:36 +0000 (14:53 +0800)]
Display all user types and org types on admin management UI (#27050)

Follow #24026

<img width="1049" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/d3fc5159-b5e7-411a-b6f8-4a111a027e6b">

---------

Co-authored-by: delvh <dev.lh@web.de>
13 months agoApply lng2020 to maintainers (#27068)
Nanguan Lin [Thu, 14 Sep 2023 04:10:12 +0000 (12:10 +0800)]
Apply lng2020 to maintainers (#27068)

Hi all,

I've very much enjoyed working on Gitea and was hoping to make it
official by requesting maintainership.

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

13 months agoFix incorrect default branch label while switching between branches (#27053)
yp05327 [Thu, 14 Sep 2023 03:54:25 +0000 (12:54 +0900)]
Fix incorrect default branch label while switching between branches (#27053)

Fix #27008

13 months agoset version in snapcraft yaml
techknowlogick [Thu, 14 Sep 2023 03:20:46 +0000 (23:20 -0400)]
set version in snapcraft yaml

13 months agoReplace 'userxx' with 'orgxx' in all test files when the user type is org (#27052)
Nanguan Lin [Thu, 14 Sep 2023 02:59:53 +0000 (10:59 +0800)]
Replace 'userxx' with 'orgxx' in all test files when the user type is org  (#27052)

Currently 'userxx' and 'orgxx' are both used as username in test files
when the user type is org, which is confusing. This PR replaces all
'userxx' with 'orgxx' when the user type is org(`user.type==1`).
Some non-trivial changes
1. Rename `user3` dir to `org3` in `tests/git-repositories-meta`
2. Change `end` in `issue reference` because 'org3' is one char shorter
than 'user3'

![ksnip_20230913-112819](https://github.com/go-gitea/gitea/assets/70063547/442988c5-4cf4-49b8-aa01-4dd6bf0ca954)
3. Change the search result number of `user/repo2` because
`user3/repo21` can't be searched now

![ksnip_20230913-112931](https://github.com/go-gitea/gitea/assets/70063547/d9ebeba4-479f-4110-9a85-825efbc981fd)
4. Change the first org name getting from API because the result is
ordered by alphabet asc and now `org 17` is before `org25`
![JW8U7NIO(J$H
_YCRB36H)T](https://github.com/go-gitea/gitea/assets/70063547/f55a685c-cf24-40e5-a87f-3a2327319548)
![)KFD411O4I8RB5ZOH7E0
Z3](https://github.com/go-gitea/gitea/assets/70063547/a0dc3299-249c-46f6-91cb-d15d4ee88dd5)

Other modifications are just find all and replace all.
Unit tests with SQLite are all passed.

---------

Co-authored-by: caicandong <1290147055@qq.com>
13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 14 Sep 2023 00:22:27 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoLoad reviewer before sending notification (#27063)
sebastian-sauer [Wed, 13 Sep 2023 19:48:36 +0000 (21:48 +0200)]
Load reviewer before sending notification (#27063)

The
[template](https://github.com/go-gitea/gitea/blob/main/templates/mail/issue/default.tmpl#L51)
uses the Reviewer.Name property - this was not loaded.

Fixes #27035

13 months agobump all nightly builds to 16gb
techknowlogick [Wed, 13 Sep 2023 14:43:03 +0000 (10:43 -0400)]
bump all nightly builds to 16gb

13 months agoShow the repo count in code tab on both user profile and org page. (#27048)
puni9869 [Wed, 13 Sep 2023 10:47:35 +0000 (16:17 +0530)]
Show the repo count in code tab on both user profile and org page. (#27048)

as title

Screenshot before
User Profile page
<img width="1367" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/24e79689-ba2f-4c85-b591-fe5621746965">

after
<img width="1346" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/754a7ee8-c2f0-424d-9ba8-be38a48140aa">

Org page
<img width="1354" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/c96178d8-664f-45c5-a162-f4df5690d9d0">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months agoFix Fomantic's line-height causing vertical scrollbars to appear (#26961)
Kerwin Bryant [Wed, 13 Sep 2023 09:08:45 +0000 (17:08 +0800)]
Fix Fomantic's line-height causing vertical scrollbars to appear (#26961)

Before:

![before](https://github.com/go-gitea/gitea/assets/3371163/bc5a3b20-3490-4e14-ab1d-2fcfbc4a2e20)

After:

![after](https://github.com/go-gitea/gitea/assets/3371163/70e8be6a-11a2-46af-9e1e-78ac153cd2a4)

---

1. **Remove the scroll bar exception that in the a tag**
2. **Reduce the actual width of the a tag to the actual width of the
content**

![c363a5b5883e105a0c65d7337893b50](https://github.com/go-gitea/gitea/assets/3371163/789d9b83-ad14-46d2-8a1b-df551a063f6a)
As shown in the screenshot, the red box area should not be clickable

13 months agoDashboard context dropdown position fix on landing page in mobile view. (#27047)
puni9869 [Wed, 13 Sep 2023 07:15:36 +0000 (12:45 +0530)]
Dashboard context dropdown position fix on landing page in mobile view. (#27047)

as title.

Screensots

before

![image](https://github.com/go-gitea/gitea/assets/80308335/d72da379-1fb1-4d75-9f3e-f70e06ad4065)

after

![image](https://github.com/go-gitea/gitea/assets/80308335/110ea806-feed-4947-bf56-2985b1e1ec5f)

13 months agofix media description render for orgmode (#26895)
Earl Warren [Wed, 13 Sep 2023 05:44:59 +0000 (07:44 +0200)]
fix media description render for orgmode (#26895)

- In org mode you can specify an description for media via the following
syntax `[[description][media link]]`. The description is then used as
title or alt.
- This patch fixes the rendering of the description by seperating the
description and non-description cases and using `org.String()`.
- Added unit tests.
- Inspired by
https://github.com/niklasfasching/go-org/blob/6eb20dbda93cb88c3503f7508dc78cbbc639378f/org/html_writer.go#L406-L427
- Resolves https://codeberg.org/Codeberg/Community/issues/848

(cherry picked from commit 8b8aab83113b34bade61964e2097ed497abc39e9)

Co-authored-by: Gusted <postmaster@gusted.xyz>
13 months agoShow OpenID Connect and OAuth on signup page (#20242)
Dmitry Sharshakov [Wed, 13 Sep 2023 05:14:21 +0000 (08:14 +0300)]
Show OpenID Connect and OAuth on signup page (#20242)

Fix #19809

---------

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
Co-authored-by: jackHay22 <jack@allspice.io>
13 months agoUpdate status and code index after changing the default branch (#27018)
Nanguan Lin [Wed, 13 Sep 2023 04:43:31 +0000 (12:43 +0800)]
Update status and code index after changing the default branch (#27018)

Fix #26723
Add `ChangeDefaultBranch` to the `notifier` interface and implement it
in `indexerNotifier`. So when changing the default branch,
`indexerNotifier` sends a message to the `indexer queue` to update the
index.

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
13 months agoadd sparse url in cargo package guide (#26937)
merlleu [Wed, 13 Sep 2023 04:14:10 +0000 (06:14 +0200)]
add sparse url in cargo package guide (#26937)

Hello,

The current package guide for cargo gives you only the git index, with
the HTTP Index stabilized being used as default for crates.io and being
better for most use-cases.

However, it's not documented that gitea supports the sparse spec, and it
does not require the _crates-index git repo for the sparse api.

I personally think we should push users to use the sparse instead of the
git repository. (Even let users disable crates-index repos if they only
want to use sparse)

13 months agoAdd missing 404 response to Swagger (#27038)
JakobDev [Wed, 13 Sep 2023 02:37:54 +0000 (04:37 +0200)]
Add missing 404 response to Swagger (#27038)

Most middleware throw a 404 in case something is not found e.g. a Repo
that is not existing. But most API endpoints don't include the 404
response in their documentation. This PR changes this.

13 months agoFix object storage path handling (#27024)
wxiaoguang [Wed, 13 Sep 2023 01:18:52 +0000 (09:18 +0800)]
Fix object storage path handling (#27024)

Object storage path rules:

* No single `/` or `.`, use empty string for root path
* Need to use trailing `/` for a list prefix to distinguish a "dir/"

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 13 Sep 2023 00:22:36 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin

13 months agobump rootful to 16gb
techknowlogick [Tue, 12 Sep 2023 19:26:41 +0000 (15:26 -0400)]
bump rootful to 16gb

13 months agosetup go in the nightly release pipeline
techknowlogick [Tue, 12 Sep 2023 17:36:15 +0000 (13:36 -0400)]
setup go in the nightly release pipeline

13 months agoSpeed up nightly builds (#27045)
techknowlogick [Tue, 12 Sep 2023 17:33:45 +0000 (13:33 -0400)]
Speed up nightly builds (#27045)

* Rootless/ful docker images build separately
* Vendor go modules outside docker to speed up the build

Thanks to Alex Ellis for these suggestions (and actuated runner build
time)

13 months agoImprove repo/user/org search (#27030)
wxiaoguang [Tue, 12 Sep 2023 16:44:48 +0000 (00:44 +0800)]
Improve repo/user/org search  (#27030)

* Fix a regression from #26809 (the `data-org` is missing)
* Remove unnecessary style

Screenshots:

![image](https://github.com/go-gitea/gitea/assets/2114189/3f5cf628-db7f-4705-898a-7a4a1fbfbba8)

![image](https://github.com/go-gitea/gitea/assets/2114189/453d1fad-1090-4524-bf45-6c5da2465f04)

![image](https://github.com/go-gitea/gitea/assets/2114189/f14d9808-7596-42c8-84b4-0d57a0bf2278)

13 months agoUse Actuated.dev runner for nightly builds
techknowlogick [Tue, 12 Sep 2023 16:15:05 +0000 (12:15 -0400)]
Use Actuated.dev runner for nightly builds

13 months agoupdate snap package (#27021)
Sienna Lloyd [Tue, 12 Sep 2023 12:47:53 +0000 (06:47 -0600)]
update snap package (#27021)

13 months agoresolve issue with sort icons on admin/users and admin/runners (#24360)
jladbrook [Tue, 12 Sep 2023 12:26:51 +0000 (13:26 +0100)]
resolve issue with sort icons on admin/users and admin/runners (#24360)

Fixes #24327 to avoid the sort icon changing the table header over
multiple lines and adds missing sort icons on the runners page.

13 months agoAdd more package registry paths to the labeler (#27032)
JakobDev [Tue, 12 Sep 2023 06:29:09 +0000 (08:29 +0200)]
Add more package registry paths to the labeler (#27032)

Found this while working on #26960

13 months agoExtract auth middleware from service (#27028)
KN4CK3R [Tue, 12 Sep 2023 06:15:16 +0000 (08:15 +0200)]
Extract auth middleware from service (#27028)

Related #27027

Extract the router logic from `services/auth/middleware.go` into
`routers/web` <-> `routers/common` <-> `routers/api`.

13 months agoS3: log human readable error on connection failure (#26856)
Earl Warren [Tue, 12 Sep 2023 02:19:39 +0000 (04:19 +0200)]
S3: log human readable error on connection failure (#26856)

Should BucketExists (HeadBucket) fail because of an error related to
the connection rather than the existence of the bucket, no information
is available and the admin is left guessing.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadBucket.html

> This action is useful to determine if a bucket exists and you have
> permission to access it. The action returns a 200 OK if the bucket
> exists and you have permission to access it.
>
> If the bucket does not exist or you do not have permission to access
> it, the HEAD request returns a generic 400 Bad Request, 403
> Forbidden or 404 Not Found code. A message body is not included, so
> you cannot determine the exception beyond these error codes.

GetBucketVersioning is used instead and exclusively dedicated to
asserting if using the connection does not return a BadRequest.
If it does the NewMinioStorage logs an error and returns. Otherwise
it keeps going knowing that BucketExists is not going to fail for
reasons unrelated to the existence of the bucket and the permissions
to access it.

(cherry picked from commit d1df4b3bc62e5e61893a923f1c4b58f084eb03af)

Refs: https://codeberg.org/forgejo/forgejo/issues/1338

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 12 Sep 2023 00:21:32 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoFix "delete" modal dialog for issue/PR (#27015)
wxiaoguang [Mon, 11 Sep 2023 17:06:05 +0000 (01:06 +0800)]
Fix "delete" modal dialog for issue/PR (#27015)

Close #27012

By the way, rename the single-word ID to a long ID.

![image](https://github.com/go-gitea/gitea/assets/2114189/9f05ecc3-0a3d-4612-85e0-da60f7a45d2e)

![image](https://github.com/go-gitea/gitea/assets/2114189/9133808c-bd89-4265-99c5-83b986bd266f)

13 months agoFix context cache bug & enable context cache for dashabord commits' authors (#26991)
Lunny Xiao [Mon, 11 Sep 2023 10:14:01 +0000 (18:14 +0800)]
Fix context cache bug & enable context cache for dashabord commits' authors (#26991)

Unfortunately, when a system setting hasn't been stored in the database,
it cannot be cached.
Meanwhile, this PR also uses context cache for push email avatar display
which should avoid to read user table via email address again and again.

According to my local test, this should reduce dashboard elapsed time
from 150ms -> 80ms .

13 months agofix: typo (#27009)
MomentQYC [Mon, 11 Sep 2023 09:30:18 +0000 (17:30 +0800)]
fix: typo (#27009)

13 months agoUse secure cookie for HTTPS sites (#26999)
wxiaoguang [Mon, 11 Sep 2023 09:03:51 +0000 (17:03 +0800)]
Use secure cookie for HTTPS sites (#26999)

If the AppURL(ROOT_URL) is an HTTPS URL, then the COOKIE_SECURE's
default value should be true.

And, if a user visits an "http" site with "https" AppURL, they won't be
able to login, and they should have been warned. The only problem is
that the "language" can't be set either in such case, while I think it
is not a serious problem, and it could be fixed easily if needed.

![image](https://github.com/go-gitea/gitea/assets/2114189/7bc9a859-dcc1-467d-bc7c-1dd6a10389e3)

13 months agoAdd fetch wrappers, ignore network errors in actions view (#26985)
silverwind [Mon, 11 Sep 2023 08:25:10 +0000 (10:25 +0200)]
Add fetch wrappers, ignore network errors in actions view (#26985)

1. Introduce lightweight `fetch` wrapper functions that automatically
sets csfr token, content-type and use it in `RepoActionView.vue`.
2. Fix a specific issue on `RepoActionView.vue` where a fetch network
error is shortly visible during page reload sometimes. It can be
reproduced by F5-in in quick succession on the actions view page and was
also producing a red error box on the page.

Once approved, we can replace all current `fetch` uses in UI with this
in another PR.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 11 Sep 2023 00:22:57 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoAdd some more labels to labeler (#26987)
silverwind [Sun, 10 Sep 2023 19:54:20 +0000 (21:54 +0200)]
Add some more labels to labeler (#26987)

- Add more automatic labels
- Consistently use `**` glob for recursive directory globs.

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
13 months agoFix INI parsing for value with trailing slash (#26995)
wxiaoguang [Sun, 10 Sep 2023 16:15:51 +0000 (00:15 +0800)]
Fix INI parsing for value with trailing slash (#26995)

Fix #26977 (a temp fix)

13 months agoCorrect the database.LOG_SQL default value in config cheat sheet (#26997)
Infinoid [Sun, 10 Sep 2023 15:45:06 +0000 (11:45 -0400)]
Correct the database.LOG_SQL default value in config cheat sheet (#26997)

The default is false, fix the docs to reflect that.

Fixes: #26989
13 months agoImprove "language stats" UI (#26968)
wxiaoguang [Sun, 10 Sep 2023 10:27:23 +0000 (18:27 +0800)]
Improve "language stats" UI (#26968)

Before:

* The layout is quite complex
* The UI flickers when switch the stats (https://try.gitea.io/)

After:

* Simplify the code
* The UI doesn't flicker

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 10 Sep 2023 00:23:48 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoUpdate chroma to v2.9.1 (#26990)
silverwind [Sat, 9 Sep 2023 14:37:38 +0000 (16:37 +0200)]
Update chroma to v2.9.1 (#26990)

13 months agoImprove issue list layout (#26983)
wxiaoguang [Sat, 9 Sep 2023 12:23:57 +0000 (20:23 +0800)]
Improve issue list layout (#26983)

Align everything with a new layout.

* Use "baseline" for some special elements, the "flex-item-icon" is for
the issue list only at the moment and I think it should be general
enough now (but not using "flex-item-leading" anymore in this case).
* Make the labels stretch themselves.

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 9 Sep 2023 00:21:42 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoMove some functions to service layer (#26969)
Lunny Xiao [Fri, 8 Sep 2023 21:09:23 +0000 (05:09 +0800)]
Move some functions to service layer (#26969)

13 months agoLock yamllint and update indirect python deps (#26979)
silverwind [Fri, 8 Sep 2023 19:36:40 +0000 (21:36 +0200)]
Lock yamllint and update indirect python deps (#26979)

I forgot to lock `yamllint` to exact version, so did that and
regenerated `poetry.lock` as well.

13 months agoChroma color tweaks (#26978)
silverwind [Fri, 8 Sep 2023 16:03:01 +0000 (18:03 +0200)]
Chroma color tweaks (#26978)

13 months agoAdd a new column schedule_id for action_run to track (#26975)
Lunny Xiao [Fri, 8 Sep 2023 15:01:19 +0000 (23:01 +0800)]
Add a new column schedule_id for action_run to track (#26975)

Fix #26971

And the UI now will display it's scheduled but not triggered by a push.

<img width="954" alt="图片"
src="https://github.com/go-gitea/gitea/assets/81045/d211845c-457e-4c3e-af1f-a0d654d3f365">

13 months agoImprove flex list UI (#26970)
wxiaoguang [Fri, 8 Sep 2023 13:57:18 +0000 (21:57 +0800)]
Improve flex list UI (#26970)

1. There is already `gt-ac`, so no need to introduce `flex-item-center`
2. The `flex-item-baseline` and `.flex-item-icon svg { margin-top: 1px
}` seem to be a tricky patch, they don't resolve the root problem, and
still cause misalignment in some cases.
* The root problem is: the "icon" needs to align with the sibling
"title"
    * So, make the "icon" and the "title" both have the same height
3. `flex-text-inline` could only be used if the element is really
"inline", otherwise its `vertical-align` would make the box size change.
In most cases, `flex-text-block` is good enough.

![image](https://github.com/go-gitea/gitea/assets/2114189/1b7acfc2-b1c7-4e9c-a983-2fa932026479)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoClarify the git command Stdin hanging problem (#26967)
wxiaoguang [Fri, 8 Sep 2023 13:20:38 +0000 (21:20 +0800)]
Clarify the git command Stdin hanging problem (#26967)

13 months agoAdd v1.20.4 changelog (#26974)
Lunny Xiao [Fri, 8 Sep 2023 10:32:26 +0000 (18:32 +0800)]
Add v1.20.4 changelog (#26974)

frontport from #26966

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
13 months agoCheck newly added node type before "attachDirAuto" (#26972)
wxiaoguang [Fri, 8 Sep 2023 10:17:08 +0000 (18:17 +0800)]
Check newly added node type before "attachDirAuto" (#26972)