]> source.dussan.org Git - gitea.git/log
gitea.git
20 months agoUpdate `github.com/zeripath/zapx/v15` (#22485)
KN4CK3R [Tue, 17 Jan 2023 14:51:24 +0000 (15:51 +0100)]
Update `github.com/zeripath/zapx/v15` (#22485)

Fixes #22481

_Originally posted by @zeripath in
https://github.com/go-gitea/gitea/issues/22481#issuecomment-1385188703_

20 months agoFix pull request API field `closed_at` always being `null` (#22482) (#22483)
Yarden Shoham [Tue, 17 Jan 2023 11:41:43 +0000 (13:41 +0200)]
Fix pull request API field `closed_at` always being `null` (#22482) (#22483)

Backport #22482

Fix #22480

20 months agoFix migration from GitBucket (#22465)
Haruo Kinoshita [Tue, 17 Jan 2023 08:57:17 +0000 (17:57 +0900)]
Fix migration from GitBucket (#22465)

Migration from GitBucket does not work due to a access for "Reviews" API
on GitBucket that makes 404 response.
This PR has following changes.
1. Made to stop access for Reviews API while migrating from GitBucket.
2. Added support for custom URL (e.g.
`http://example.com/gitbucket/owner/repository`)
3. Made to accept for git checkout URL
(`http://example.com/git/owner/repository.git`)

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
20 months agoFix container blob mount (#22226) (#22476)
John Olheiser [Tue, 17 Jan 2023 06:50:45 +0000 (00:50 -0600)]
Fix container blob mount (#22226) (#22476)

Backport #22226

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
20 months agoFix error when calculate the repository size (#22392) (#22474)
zeripath [Mon, 16 Jan 2023 22:07:06 +0000 (22:07 +0000)]
Fix error when calculate the repository size (#22392) (#22474)

Backport #22392

Fix #22386

`GetDirectorySize` moved as `getDirectorySize` because it becomes a
special function which should not be put in `util`.

Co-authored-by: Jason Song <i@wolfogre.com>
20 months agoFix Operator does not exist bug on explore page with ONLY_SHOW_RELEVANT_REPOS (#22454...
zeripath [Mon, 16 Jan 2023 20:17:22 +0000 (20:17 +0000)]
Fix Operator does not exist bug on explore page with ONLY_SHOW_RELEVANT_REPOS (#22454) (#22472)

Backport #22454

There is a mistake in the code for SearchRepositoryCondition where it
tests topics as a string. This is incorrect for postgres where topics is
cast and stored as json. topics needs to be cast to text for this to
work. (For some reason JSON_ARRAY_LENGTH does not work, so I have taken
the simplest solution of casting to text and doing a string comparison.)

Ref https://github.com/go-gitea/gitea/pull/21962#issuecomment-1379584057

Signed-off-by: Andrew Thornton <art27@cantab.net>
20 months agoFix environments for KaTeX and error reporting (#22453) (#22473)
zeripath [Mon, 16 Jan 2023 19:34:50 +0000 (19:34 +0000)]
Fix environments for KaTeX and error reporting (#22453) (#22473)

Backport #22453

In #22447 it was noticed that display environments were not working
correctly. This was due to the setting displayMode not being set.

Further it was noticed that the error was not being displayed correctly.

This PR fixes both of these issues by forcibly setting the displayMode
setting and corrects an error in displayError.

Fix #22447

Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months ago Remove the netgo tag for Windows build (#22467) (#22468)
wxiaoguang [Mon, 16 Jan 2023 13:05:12 +0000 (21:05 +0800)]
 Remove the netgo tag for Windows build (#22467) (#22468)

Backport #22467

Fix #22370 and more.

Before Go 1.19, the `netgo` tag for Windows does nothing.

But Go 1.19 rewrite the net package code for Windows DNS, and there is a
bug:

* https://github.com/golang/go/issues/57757

This PR just removes the `netgo` tag for Windows build, then the Gitea
for Windows can have the old DNS behavior.

21 months agoFix leaving organization bug on user settings -> orgs (#21983) (#22438)
zeripath [Sun, 15 Jan 2023 23:29:27 +0000 (23:29 +0000)]
Fix leaving organization bug on user settings -> orgs (#21983) (#22438)

Backport #21983

Fix #21772

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 花墨 <shanee@live.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
21 months agoRestore previous official review when an official review is deleted (#22449) (#22460)
Jimmy Praet [Sun, 15 Jan 2023 19:47:54 +0000 (20:47 +0100)]
Restore previous official review when an official review is deleted (#22449) (#22460)

Backport #22449

Co-authored-by: Lauris BH <lauris@nix.lv>
21 months agoPrevent panic on looking at api "git" endpoints for empty repos (#22457) (#22458)
zeripath [Sun, 15 Jan 2023 14:35:56 +0000 (14:35 +0000)]
Prevent panic on looking at api "git" endpoints for empty repos (#22457) (#22458)

Backport #22457

The API endpoints for "git" can panic if they are called on an empty
repo. We can simply allow empty repos for these endpoints without worry
as they should just work.

Fix #22452

Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months agoFixed colour transparency regex matching in project board sorting (#22092) (#22437)
zeripath [Sun, 15 Jan 2023 12:05:04 +0000 (12:05 +0000)]
Fixed colour transparency regex matching in project board sorting (#22092) (#22437)

Backport #22092

As described in the linked issue (#22091), semi-transparent UI elements
would result in JS errors due to the fact that the CSS `backgroundColor`
element was being matched by the pattern
`^rgb\((\d+),\s*(\d+),\s*(\d+)\)$`, which does not take the alpha
channel into account.

I changed the pattern to `^rgba?\((\d+),\s*(\d+),\s*(\d+).*\)$`. This
new pattern accepts both `rgb` and `rgba` tuples, and ignores the alpha
channel (that little `.*` at the end) from the sorting criteria. The
reason why I chose to ignore alpha is because when it comes to kanban
colour sorting, only the hue is important; the order of the panels
should stay the same, even if some of them are transparent.

Alternative solutions were discussed in the bug report and are included
here for completeness:
1. Change the regex from ^rgb\((\d+),\s*(\d+),\s*(\d+)\)$ to
^rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*(\d+(\.\d+)?))?\)$ (alpha channel is
a float or NaN on 5th group) and include the alpha channel in the
sorting criteria.
2. Rethink on why you're reading colours out of the CSS in the first
place, then reformat this sorting procedure.

Fix #22091

Co-authored-by: MisterCavespider <deler.urist@tutanota.de>
21 months agoLog STDERR of external renderer when it fails (#22442) (#22444)
Jonathan Tran [Sat, 14 Jan 2023 23:14:27 +0000 (18:14 -0500)]
Log STDERR of external renderer when it fails (#22442) (#22444)

Backport #22442.

21 months agofix: PR status layout on mobile (#21547) (#22441)
zeripath [Sat, 14 Jan 2023 08:56:44 +0000 (08:56 +0000)]
fix: PR status layout on mobile (#21547) (#22441)

Backport #21547

This PR fixes the layout of PR status layouts on mobile. For longer
status context names or on very small screens the text would overflow
and push the "Details" and "Required" badges out of the container.

Before:

![Screen Shot 2022-10-22 at 12 27

46](https://user-images.githubusercontent.com/13721712/197335454-e4decf09-4778-43e8-be88-9188fabbec23.png)

After:

![Screen Shot 2022-10-22 at 12 53

24](https://user-images.githubusercontent.com/13721712/197335449-2c731a6c-7fd6-4b97-be0e-704a99fd3d32.png)

Co-authored-by: kolaente <k@knt.li>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
21 months agoFix wechatwork webhook sends empty content in PR review (#21762) (#22440)
zeripath [Sat, 14 Jan 2023 03:37:18 +0000 (03:37 +0000)]
Fix wechatwork webhook sends empty content in PR review (#21762) (#22440)

Backport #21762

Wechatwork webhook is sending the following string for pull request
reviews:

``` markdown
>
```

This commit fixes this problem.

Co-authored-by: Jim Kirisame <jim@lotlab.org>
21 months agoRemove duplicate "Actions" label in mobile view (#21974) (#22439)
zeripath [Fri, 13 Jan 2023 23:23:39 +0000 (23:23 +0000)]
Remove duplicate "Actions" label in mobile view (#21974) (#22439)

Backport #21974

Closes #21973.

The "Actions" button on the commit view page is labelled twice in mobile
view. No other buttons on the page have a `mobile-only` extra label, so
this PR removes it.

Before:

![before](https://user-images.githubusercontent.com/6496999/204540002-75baa08a-6c06-4b39-847b-34272e09d71e.PNG)

After:

![after](https://user-images.githubusercontent.com/6496999/204539991-a0607765-d5e2-4b1a-84c9-a3e16cbc674e.PNG)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Mark Ormesher <me@markormesher.co.uk>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
21 months agoPrepend refs/heads/ to issue template refs (#20461) (#22427)
zeripath [Fri, 13 Jan 2023 22:33:35 +0000 (22:33 +0000)]
Prepend refs/heads/ to issue template refs (#20461) (#22427)

Backport #20461

Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months agoContinue GCing other repos on error in one repo (#22422) (#22425)
zeripath [Fri, 13 Jan 2023 21:29:16 +0000 (21:29 +0000)]
Continue GCing other repos on error in one repo (#22422) (#22425)

Backport #22422

The current code propagates all errors up to the iteration step meaning
that a single malformed repo will prevent GC of other repos.

This PR simply stops that propagation.

Fix #21605

Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months agoCorrectly handle select on multiple channels in Queues (#22146) (#22428)
zeripath [Fri, 13 Jan 2023 20:42:42 +0000 (20:42 +0000)]
Correctly handle select on multiple channels in Queues (#22146) (#22428)

Backport #22146

There are a few places in FlushQueueWithContext which make an incorrect
assumption about how `select` on multiple channels works.

The problem is best expressed by looking at the following example:

```go
package main

import "fmt"

func main() {
    closedChan := make(chan struct{})
    close(closedChan)
    toClose := make(chan struct{})
    count := 0

    for {
        select {
        case <-closedChan:
            count++
            fmt.Println(count)
            if count == 2 {
                close(toClose)
            }
        case <-toClose:
            return
        }
    }
}
```

This PR double-checks that the contexts are closed outside of checking
if there is data in the dataChan. It also rationalises the WorkerPool
FlushWithContext because the previous implementation failed to handle
pausing correctly. This will probably fix the underlying problem in
 #22145

Fix #22145

Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months agoRemove test session cache to reduce possible concurrent problem (#22199) (#22429)
Lunny Xiao [Fri, 13 Jan 2023 18:54:58 +0000 (02:54 +0800)]
Remove test session cache to reduce possible concurrent problem (#22199) (#22429)

backport #22199

21 months agoRestore function to "Show more" buttons (#22399) (#22426)
zeripath [Fri, 13 Jan 2023 09:29:10 +0000 (09:29 +0000)]
Restore function to "Show more" buttons (#22399) (#22426)

Backport #22399

There was a serious regression in #21012 which broke the Show More
button on the diff page, and the show more button was also broken on the
file tree too.

This PR fixes this by resetting the pageData.diffFiles as the vue
watched value and reattachs a function to the show more button outside
of the file tree view.

Fix #22380

Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months agoAllow HOST has no port (#22280) (#22409)
Lunny Xiao [Thu, 12 Jan 2023 01:57:03 +0000 (09:57 +0800)]
Allow HOST has no port (#22280) (#22409)

Fix #22274
Backport #22280

This PR will allow `HOST` without port. Then a default port will be
given in future steps.

21 months agofix: omit avatar_url in discord payload when empty (#22393) (#22394)
John Olheiser [Tue, 10 Jan 2023 19:44:18 +0000 (13:44 -0600)]
fix: omit avatar_url in discord payload when empty (#22393) (#22394)

Backport #22393

Signed-off-by: jolheiser <john.olheiser@gmail.com>
21 months agoDon't display stop watch top bar icon when disabled and hidden when click other place...
Yarden Shoham [Tue, 10 Jan 2023 09:21:29 +0000 (11:21 +0200)]
Don't display stop watch top bar icon when disabled and hidden when click other place (#22374) (#22387)

Backport #22374

Fix #22286

When timetracking is disabled, the stop watch top bar icon should be
hidden. When the stop watch recording popup, it should be allowed to
hide with some operation. Now click any place on this page will hide the
popup window.

21 months agoDon't lookup mail server when using sendmail (#22300) (#22383)
Lunny Xiao [Mon, 9 Jan 2023 17:18:03 +0000 (01:18 +0800)]
Don't lookup mail server when using sendmail (#22300) (#22383)

Fix #22287
backport #22300

21 months agoFix set system setting failure once it cached (#22334)
Lunny Xiao [Mon, 9 Jan 2023 02:04:44 +0000 (10:04 +0800)]
Fix set system setting failure once it cached (#22334)

backport #22333

21 months agoUpdate Emoji dataset to Unicode 14 (#22342) (#22343)
isla w [Wed, 4 Jan 2023 18:45:18 +0000 (13:45 -0500)]
Update Emoji dataset to Unicode 14 (#22342) (#22343)

Backport of #22342 to release/v1.18 as requested

21 months agofix gravatar disable bug (#22337)
Lunny Xiao [Wed, 4 Jan 2023 13:17:59 +0000 (21:17 +0800)]
fix gravatar disable bug (#22337)

21 months agofix: update settings table on install (#22326) (#22327)
John Olheiser [Tue, 3 Jan 2023 22:19:57 +0000 (16:19 -0600)]
fix: update settings table on install (#22326) (#22327)

Backport #22326

Signed-off-by: jolheiser <john.olheiser@gmail.com>
21 months agoAdd deprecated warning for DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR (#22324)
Kyle D [Tue, 3 Jan 2023 16:11:00 +0000 (11:11 -0500)]
Add deprecated warning for DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR (#22324)

Backport https://github.com/go-gitea/gitea/pull/22318

21 months agoFix sitemap (#22272) (#22320)
Jason Song [Tue, 3 Jan 2023 14:03:56 +0000 (22:03 +0800)]
Fix sitemap (#22272) (#22320)

Backport #22272.

Fix #22270.

Related to #18407.

The old code treated both sitemap and sitemap index as the format like:

```xml
...
<url>
  <loc>http://localhost:3000/explore/users/sitemap-1.xml</loc>
</url>
...
```

Actually, it's incorrect for sitemap index, it should be:

```xml
...
<sitemap>
  <loc>http://localhost:3000/explore/users/sitemap-1.xml</loc>
</sitemap>
...
```

See https://www.sitemaps.org/protocol.html

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
21 months agoDisplay error log when a modified template has an error so that it could recovery...
Lunny Xiao [Tue, 3 Jan 2023 11:39:58 +0000 (19:39 +0800)]
Display error log when a modified template has an error so that it could recovery when the error fixed (#22261) (#22321)

backport #22261

A drawback is the previous generated template has been cached, so you
cannot get error in the UI but only from log

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: delvh <dev.lh@web.de>
21 months agofix: code search title translation (#22285) (#22316)
John Olheiser [Tue, 3 Jan 2023 03:33:55 +0000 (21:33 -0600)]
fix: code search title translation (#22285) (#22316)

Backport #22285

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
21 months agoFix due date rendering the wrong date in issue (#22302) (#22306)
Yarden Shoham [Mon, 2 Jan 2023 12:42:39 +0000 (14:42 +0200)]
Fix due date rendering the wrong date in issue (#22302) (#22306)

Backport #22302

Previously, the last minute of the chosen date caused bad timezone
rendering.

For example, I chose January 4th, 2023.

### Before
```html
<time data-format="date" datetime="Wed, 04 Jan 2023 23:59:59 +0000">January 5, 2023</time>
```

### After
```html
<time data-format="date" datetime="2023-01-04">January 4, 2023</time>
```

---

Closes #21999

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
21 months agoFix get system setting bug when enabled redis cache (#22298)
Lunny Xiao [Sun, 1 Jan 2023 15:24:01 +0000 (23:24 +0800)]
Fix get system setting bug when enabled redis cache (#22298)

backport #22295, fix #22281

Co-authored-by: Lauris BH <lauris@nix.lv>
21 months agoFix bug of DisableGravatar default value (#22297)
Lunny Xiao [Sun, 1 Jan 2023 12:20:04 +0000 (20:20 +0800)]
Fix bug of DisableGravatar default value (#22297)

backport #22296

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
21 months agoAdd `sync_on_commit` option for push mirrors api (#22271) (#22292)
Chongyi Zheng [Sat, 31 Dec 2022 11:46:14 +0000 (06:46 -0500)]
Add `sync_on_commit` option for push mirrors api (#22271) (#22292)

Backport of #22271

21 months agoFix key signature error page (#22229) (#22230)
Gusted [Fri, 30 Dec 2022 04:53:23 +0000 (05:53 +0100)]
Fix key signature error page (#22229) (#22230)

- Backport of #22229
- When the GPG key contains an error, such as an invalid signature or an
email address that does not match the user.A page will be shown that
says you must provide a signature for the token.
- This page had two errors: one had the wrong translation key and the
other tried to use an undefined variable
[`.PaddedKeyID`](https://github.com/go-gitea/gitea/blob/e81ccc406bf723a5a58d685e7782f281736affd4/models/asymkey/gpg_key.go#L65-L72),
which is a function implemented on the `GPGKey` struct, given that we
don't have that, we use
[`KeyID`](https://github.com/go-gitea/gitea/blob/e81ccc406bf723a5a58d685e7782f281736affd4/routers/web/user/setting/keys.go#L102)
which is [the fingerprint of the
publickey](https://pkg.go.dev/golang.org/x/crypto/openpgp/packet#PublicKey.KeyIdString)
and is a valid way for opengpg to refer to a key.

21 months agoFrontport 1.17.4 changelog and Add 1.18.0 changelog (#22215) v1.18.0
Lunny Xiao [Thu, 29 Dec 2022 19:08:57 +0000 (03:08 +0800)]
Frontport 1.17.4 changelog and Add 1.18.0 changelog (#22215)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
21 months agoAdd more test directory to exclude dir of air, remove watching templates from air...
Lunny Xiao [Thu, 29 Dec 2022 15:12:10 +0000 (23:12 +0800)]
Add more test directory to exclude dir of air, remove watching templates from air include dir because gitea has internal mechanism (#22246) (#22247)

backport #22246

Since #20218 introduced internal watching template, template watching
should be removed from `air`. This will prevent restart the whole server
once the template files changed to speed up developing when using `make
watch`.

To ensure `make watch` will reuse template watching, this PR introduced
a new ENV `GITEA_RUN_MODE` to make sure `make watch` will always run in
a dev mode of Gitea so that template watching will open.

This PR also added more exclude testdata directories.

Co-authored-by: 6543 <6543@obermui.de>
21 months agorefactor auth interface to return error when verify failure (#22119) (#22259)
Lunny Xiao [Thu, 29 Dec 2022 05:50:09 +0000 (13:50 +0800)]
refactor auth interface to return error when verify failure (#22119) (#22259)

backport #22119

This PR changed the Auth interface signature from `Verify(http
*http.Request, w http.ResponseWriter, store DataStore, sess
SessionStore) *user_model.User`
to
`Verify(http *http.Request, w http.ResponseWriter, store DataStore, sess
SessionStore) (*user_model.User, error)`.

There is a new return argument `error` which means the verification
condition matched but verify process failed, we should stop the auth
process.

Before this PR, when return a `nil` user, we don't know the reason why
it returned `nil`. If the match condition is not satisfied or it
verified failure? For these two different results, we should have
different handler. If the match condition is not satisfied, we should
try next auth method and if there is no more auth method, it's an
anonymous user. If the condition matched but verify failed, the auth
process should be stop and return immediately.

This will fix #20563

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Jason Song <i@wolfogre.com>
21 months agoUse complete SHA to create and query commit status (#22244) (#22257)
Jason Song [Wed, 28 Dec 2022 10:03:21 +0000 (18:03 +0800)]
Use complete SHA to create and query commit status (#22244) (#22257)

Backport #22244.

Fix #13485.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
21 months agoRemove ReverseProxy authentication from the API (#22219) (#22251)
Lunny Xiao [Tue, 27 Dec 2022 19:24:43 +0000 (03:24 +0800)]
Remove ReverseProxy authentication from the API (#22219) (#22251)

backport from #22219

Since we changed the /api/v1/ routes to disallow session authentication
we also removed their reliance on CSRF. However, we left the
ReverseProxy authentication here - but this means that POSTs to the API
are no longer protected by CSRF.

Now, ReverseProxy authentication is a kind of session authentication,
and is therefore inconsistent with the removal of session from the API.

This PR proposes that we simply remove the ReverseProxy authentication
from the API and therefore users of the API must explicitly use tokens
or basic authentication.

Replace #22077
Close #22221
Close #22077

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
21 months agoUpdate bleve and zapx to fix unaligned atomic (#22031) (#22218)
zeripath [Thu, 22 Dec 2022 15:45:38 +0000 (15:45 +0000)]
Update bleve and zapx to fix unaligned atomic (#22031) (#22218)

Backport #22031

There is an unaligned atomic field in zapx 15.3.5 which should have been
fixed in a subsequent patch

This bug causes issues on 32bit builds.

Update bleve and zapx to account for this.

Fix #21957

Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months agoFix container layer display overflow (#22208) (#22211)
Lauris BH [Thu, 22 Dec 2022 13:26:48 +0000 (15:26 +0200)]
Fix container layer display overflow (#22208) (#22211)

Backport #22208

21 months agoAllow empty assignees on pull request edit (#22150) (#22214)
KN4CK3R [Thu, 22 Dec 2022 12:40:07 +0000 (13:40 +0100)]
Allow empty assignees on pull request edit (#22150) (#22214)

Backport of #22150

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
21 months agoAdd setting to disable the git apply step in test patch (#22130) (#22170)
zeripath [Thu, 22 Dec 2022 10:59:10 +0000 (10:59 +0000)]
Add setting to disable the git apply step in test patch (#22130) (#22170)

Backport #22130

For a long time Gitea has tested PR patches using a git apply --check
method, and in fact prior to the introduction of a read-tree assisted
three-way merge in #18004, this was the only way of checking patches.

Since #18004, the git apply --check method has been a fallback method,
only used when the read-tree three-way merge method has detected a
conflict. The read-tree assisted three-way merge method is much faster
and less resource intensive method of detecting conflicts. #18004 kept
the git apply method around because it was thought possible that this
fallback might be able to rectify conflicts that the read-tree three-way
merge detected. I am not certain if this could ever be the case.

Given the uncertainty here and the now relative stability of the
read-tree method - this PR makes using this fallback optional but
enables it by default. A `log.Critical` has been added which will alert
if the `git apply --check` method was successful at checking a PR that
`read-tree` failed on.

The hope is that none of these log.Critical messages will be found and
there will be no significant difference in conflict detection. Thus we
will be able to remove the git apply fallback in future, and/or improve
the read-tree three-way merge method to catch any conflicts that git
apply method might have been able to fix.

An additional benefit for anyone who disables the check method is that
patch checking should be significantly less resource intensive and much
quicker.

(See
https://github.com/go-gitea/gitea/issues/22083\#issuecomment-1347961737)

Ref #22083

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

Please check the following:

1. Make sure you are targeting the `main` branch, pull requests on
release branches are only allowed for bug fixes.
2. Read contributing guidelines:
https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md
3. Describe what your pull request does and which issue you're targeting
(if any)

-->

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
21 months agoNormalize NuGet package version on upload (#22186) (#22200)
KN4CK3R [Wed, 21 Dec 2022 20:50:17 +0000 (21:50 +0100)]
Normalize NuGet package version on upload (#22186) (#22200)

Backport of #22186

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
21 months agofix: update libcurl in docs pipeline (#22204)
John Olheiser [Wed, 21 Dec 2022 19:39:05 +0000 (13:39 -0600)]
fix: update libcurl in docs pipeline (#22204)

Backport https://github.com/go-gitea/gitea/pull/22203

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
21 months agoCheck for zero time instant in TimeStamp.IsZero() (#22171) (#22172)
Gusted [Tue, 20 Dec 2022 02:04:46 +0000 (03:04 +0100)]
Check for zero time instant in TimeStamp.IsZero() (#22171) (#22172)

- Backport of #22171
- Currently, the 'IsZero' function for 'TimeStamp' just checks if the
unix time is zero, which is not the behavior of 'Time.IsZero()', but
Gitea is using this method in accordance with the behavior of
'Time.IsZero()'.
  - Adds a new condition to check for the zero time instant.
- Fixes a bug where non-expiring GPG keys where shown as they expired on
Jan 01, 0001.
  - Related https://codeberg.org/Codeberg/Community/issues/791

21 months agoEnsure that plain files are rendered correctly even when containing ambiguous charact...
zeripath [Mon, 19 Dec 2022 15:51:21 +0000 (15:51 +0000)]
Ensure that plain files are rendered correctly even when containing ambiguous characters (#22017) (#22160)

Backport #22017

As recognised in #21841 the rendering of plain text files is somewhat
incorrect when there are ambiguous characters as the html code is double
escaped. In fact there are several more problems here.

We have a residual isRenderedHTML which is actually simply escaping the
file - not rendering it. This is badly named and gives the wrong
impression.

There is also unusual behaviour whether the file is called a Readme or
not and there is no way to get to the source code if the file is called
README.

In reality what should happen is different depending on whether the file
is being rendered a README at the bottom of the directory view or not.

1. If it is rendered as a README on a directory - it should simply be
escaped and rendered as `<pre>` text.
2. If it is rendered as a file then it should be rendered as source
code.

This PR therefore does:
1. Rename IsRenderedHTML to IsPlainText
2. Readme files rendered at the bottom of the directory are rendered
without line numbers
3. Otherwise plain text files are rendered as source code.

Replace #21841

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
21 months agoDo not list active repositories as unadopted (#22034) (#22166)
Christian Ullrich [Mon, 19 Dec 2022 12:48:38 +0000 (13:48 +0100)]
Do not list active repositories as unadopted (#22034) (#22166)

Backport #22034

This fixes a bug where, when searching unadopted repositories, active
repositories will be listed as well. This is because the size of the
array of repository names to check is larger by one than the
`IterateBufferSize`.

For an `IterateBufferSize` of 50, the original code will pass 51
repository names but set the query to `LIMIT 50`. If all repositories in
the query are active (i.e. not unadopted) one of them will be omitted
from the result. Due to the `ORDER BY` clause it will be the oldest (or
least recently modified) one.

Co-authored-by: Christian Ullrich <christian.ullrich@traditionsa.lu>
21 months agoLocal storage should not store files as executable (#22162) (#22163)
zeripath [Sun, 18 Dec 2022 23:12:25 +0000 (23:12 +0000)]
Local storage should not store files as executable (#22162) (#22163)

Backport #22162

The PR #21198 introduced a probable security vulnerability which
resulted in making all storage files be marked as executable.

This PR ensures that these are forcibly marked as non-executable.

Fix #22161

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
21 months agoFix heatmap first color being unused (#22158)
silverwind [Sun, 18 Dec 2022 13:18:07 +0000 (14:18 +0100)]
Fix heatmap first color being unused (#22158)

Backport #22157. vue3-calendar-heatmap has the behaviour that the first
and second colors are mapped to values null and 0, meaning the second
color was not used as intended for values > 0. I think this is a
behaviour change from previous vue2 version that was missed during the
upgrade.

This change makes first and second values the same, so the heatmap can
now use one additional color for meaningful values.

22 months agoFix margin and alignment in dashboard repolist (#22120) (#22122)
silverwind [Fri, 16 Dec 2022 19:57:22 +0000 (20:57 +0100)]
Fix margin and alignment in dashboard repolist (#22120) (#22122)

Backport #22120 to 1.18. Seems this has recently regressed, previously,
there was a significant whitespace between icon and text, but it seems
to be gone, so I added the margin.

22 months agoCorrectly handle moved files in apply patch (#22118) (#22135)
zeripath [Thu, 15 Dec 2022 00:59:16 +0000 (00:59 +0000)]
Correctly handle moved files in apply patch (#22118) (#22135)

Backport #22118

Moved files in a patch will result in git apply returning:

```
error: {filename}: No such file or directory
```

This wasn't handled by the git apply patch code. This PR adds handling
for this.

Fix #22083

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
22 months agoFix condition for is_internal (#22095) (#22132)
KN4CK3R [Wed, 14 Dec 2022 18:38:15 +0000 (19:38 +0100)]
Fix condition for is_internal (#22095) (#22132)

Backport of #22095

I changed it to a static condition because it needs a new version of
xorm which is only available in 1.19. This change is valid because
`SearchLatestVersions` is never called to list internal versions and
there will no change to this behaviour in <1.19.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
22 months agoMake gitea work using cmd.exe again (#22073) (#22133)
zeripath [Wed, 14 Dec 2022 13:13:16 +0000 (13:13 +0000)]
Make gitea work using cmd.exe again (#22073) (#22133)

Backport #22073

Gitea will attempt to lookup its location using LookPath however, this
fails on cmd.exe if gitea is in the current working directory.

exec.LookPath will return an exec.ErrDot error which we can test for and
then simply using filepath.Abs(os.Args[0]) to absolute gitea against the
current working directory.

Fix #22063

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoFix sorting admin user list by last login (#22081) (#22107)
aceArt-GmbH [Tue, 13 Dec 2022 22:37:33 +0000 (23:37 +0100)]
Fix sorting admin user list by last login (#22081) (#22107)

22 months agoFix parallel creating commit status bug with tests (#21911) (#21989)
Lunny Xiao [Tue, 13 Dec 2022 10:59:18 +0000 (18:59 +0800)]
Fix parallel creating commit status bug with tests (#21911) (#21989)

backport #21911
backport #21998

Co-authored-by: silverwind <me@silverwind.io>
22 months agoFix permission check on issue/pull lock (#22113)
Lunny Xiao [Mon, 12 Dec 2022 19:59:50 +0000 (03:59 +0800)]
Fix permission check on issue/pull lock (#22113)

backport #22110

22 months agoWorkaround for container registry push/pull errors (#21862) (#22068)
KN4CK3R [Sat, 10 Dec 2022 00:11:46 +0000 (01:11 +0100)]
Workaround for container registry push/pull errors (#21862) (#22068)

Backport of #21862

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoFix issue/PR numbers (#22037) (#22044)
Jason Song [Wed, 7 Dec 2022 06:20:12 +0000 (14:20 +0800)]
Fix issue/PR numbers (#22037) (#22044)

Backport #22037.

When deleting a closed issue, we should update both `NumIssues`and
`NumClosedIssues`, or `NumOpenIssues`(`= NumIssues -NumClosedIssues`)
will be wrong. It's the same for pull requests.

Releated to #21557.

Alse fixed two harmless problems:

- The SQL to check issue/PR total numbers is wrong, that means it will
update the numbers even if they are correct.
- Replace legacy `num_issues = num_issues + 1` operations with
`UpdateRepoIssueNumbers`.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoHandle empty author names (#21902) (#22027)
zeripath [Tue, 6 Dec 2022 13:16:47 +0000 (13:16 +0000)]
Handle empty author names (#21902) (#22027)

Backport #21902

Although git does expect that author names should be of the form: `NAME
<EMAIL>` some users have been able to create commits with: `<EMAIL>`

Fix #21900

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoAdd dumb-init to rootless docker (#22046)
Michael Kriese [Tue, 6 Dec 2022 11:01:58 +0000 (12:01 +0100)]
Add dumb-init to rootless docker (#22046)

- backport #21775

22 months agoUse GhostUser if needed for TrackedTimes (#22021) (#22029)
zeripath [Mon, 5 Dec 2022 12:20:37 +0000 (12:20 +0000)]
Use GhostUser if needed for TrackedTimes (#22021) (#22029)

Backport #22021

When getting tracked times out of the db and loading their attributes
handle not exist errors in a nicer way. (Also prevent an NPE.)

Fix #22006

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoEnsure that Chinese punctuation is not ambiguous when locale is Chinese (#22019)...
zeripath [Mon, 5 Dec 2022 09:20:38 +0000 (09:20 +0000)]
Ensure that Chinese punctuation is not ambiguous when locale is Chinese (#22019) (#22030)

Backport #22019

Although there are per-locale fallbacks for ambiguity the locale names
for Chinese do not quite match our locales. This PR simply maps zh-CN on
to zh-hans and other zh variants on to zh-hant.

Ref #20999

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
22 months agoFix ListBranches to handle empty case (#21921) (#22024)
Lunny Xiao [Sun, 4 Dec 2022 22:13:11 +0000 (06:13 +0800)]
Fix ListBranches to handle empty case (#21921) (#22024)

Fix #21910
Backport #21921

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
22 months agoDo not emit ambiguous character warning on rendered pages (#22016) (#22018)
zeripath [Sun, 4 Dec 2022 11:10:54 +0000 (11:10 +0000)]
Do not emit ambiguous character warning on rendered pages (#22016) (#22018)

Backport #22016

The real sensitivity of ambiguous characters is in source code -
therefore warning about them in rendered pages causes too many warnings.
Therefore simply remove the warning on rendered pages.

The escape button will remain available and it is present on the view
source page.

Fix #20999

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoOn tag/branch-exist check, dont panic if repo is nil (#21787) (#21788)
6543 [Sun, 4 Dec 2022 10:29:19 +0000 (11:29 +0100)]
On tag/branch-exist check, dont panic if repo is nil (#21787) (#21788)

backport #21787

22 months agoUse path not filepath in template filenames (#21993) (#22022)
zeripath [Sun, 4 Dec 2022 05:58:58 +0000 (05:58 +0000)]
Use path not filepath in template filenames (#21993) (#22022)

Backport #21993

Paths in git are always separated by `/` not `\` - therefore we should
`path` and not `filepath`

Fix #21987

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
22 months agoMultiple improvements for comment edit diff (#21990) (#22007)
silverwind [Fri, 2 Dec 2022 20:42:41 +0000 (21:42 +0100)]
Multiple improvements for comment edit diff (#21990) (#22007)

Backport #21990

- Use explicit avatar size so when JS copies the HTML, the size gets
copied with it
- Replace icon font use with SVG
- Improve styling and diff rendering
- Sort lists in `svg.js`

Fixes: https://github.com/go-gitea/gitea/issues/21924
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
22 months agoCorrect the fallbacks for mailer configuration (#21945) (#21953)
zeripath [Sun, 27 Nov 2022 19:45:59 +0000 (19:45 +0000)]
Correct the fallbacks for mailer configuration (#21945) (#21953)

Backport #21945

Unfortunately the fallback configuration code for [mailer] that were
added in #18982 are incorrect. When you read a value from an ini section
that key is added. This leads to a failure of the fallback mechanism.
Further there is also a spelling mistake in the startTLS configuration.

This PR restructures the mailer code to first map the deprecated
settings on to the new ones - and then use ini.MapTo to map those on to
the struct with additional validation as necessary.

Ref #21744

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoFix markdown anchor re-clicking (#21931) (#21946)
silverwind [Sat, 26 Nov 2022 16:21:13 +0000 (17:21 +0100)]
Fix markdown anchor re-clicking (#21931) (#21946)

Backport #21931. The hashchange event did not fire on re-click of a
active anchor. Instead, use the click event which always fires.

Fixes: https://github.com/go-gitea/gitea/issues/21680
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
22 months agoPrevent NPE if trying to restore an already restored deleted branch (#21940) (#21944)
zeripath [Fri, 25 Nov 2022 23:28:03 +0000 (23:28 +0000)]
Prevent NPE if trying to restore an already restored deleted branch (#21940) (#21944)

Backport #21940

If a deleted-branch has already been restored, a request to restore it
again will cause a NPE. This PR adds detection for this case, but also
disables buttons when they're clicked in order to help prevent
accidental repeat requests.

Fix #21930

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoAdd support for HEAD requests in Maven registry (#21834) (#21929)
KN4CK3R [Fri, 25 Nov 2022 11:46:28 +0000 (12:46 +0100)]
Add support for HEAD requests in Maven registry (#21834) (#21929)

Backport of #21834

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoFix button in branch list, avoid unexpected page jump before restore branch actually...
Xinyu Zhou [Thu, 24 Nov 2022 16:02:33 +0000 (00:02 +0800)]
Fix button in branch list, avoid unexpected page jump before restore branch actually done (#21562) (#21928)

Backport #21562

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
22 months agoadd changelog for 1.18.0-rc1 (#21829) v1.18.0-rc1
techknowlogick [Thu, 24 Nov 2022 11:49:22 +0000 (06:49 -0500)]
add changelog for 1.18.0-rc1 (#21829)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoFix flex layout for repo list icons (#21896) (#21920)
Xinyu Zhou [Thu, 24 Nov 2022 06:44:07 +0000 (14:44 +0800)]
Fix flex layout for repo list icons (#21896) (#21920)

Backport #21896

#20241 Added a tooltip, which does not satisfy the flex layout, and the
icons are not aligned

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
22 months agoFix vertical align of committer avatar rendered by email address (#21884) (#21918)
Xinyu Zhou [Thu, 24 Nov 2022 02:52:20 +0000 (10:52 +0800)]
Fix vertical align of committer avatar rendered by email address (#21884) (#21918)

Backport #21884

Committer avatar rendered by `func AvatarByEmail` are not vertical align
as `func Avatar` does.

- Replace literals `ui avatar` and `ui avatar vm` with the constant
`DefaultAvatarClass`

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
22 months agoFix setting HTTP headers after write (#21833) (#21877)
KN4CK3R [Tue, 22 Nov 2022 01:00:42 +0000 (02:00 +0100)]
Fix setting HTTP headers after write (#21833) (#21877)

Backport of #21833

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
22 months agoDo not allow Ghost access to limited visible user/org (#21849) (#21876)
KN4CK3R [Sun, 20 Nov 2022 19:37:20 +0000 (20:37 +0100)]
Do not allow Ghost access to limited visible user/org (#21849) (#21876)

Backport of #21849

22 months agoColor and Style enhancements (#21784, #21799) (#21868)
silverwind [Sun, 20 Nov 2022 10:47:02 +0000 (11:47 +0100)]
Color and Style enhancements (#21784, #21799) (#21868)

Backport #21784
Backport #21799

These PRs provide tweaks and simplification to the less/css selectors, simplifying text color selectors and tweak arc-green colors with a follow-up to adjust the timeline

See the original PRs for more details

22 months agoSupport comma-delimited string as labels in issue template (#21831) (#21873)
Jason Song [Sun, 20 Nov 2022 10:44:20 +0000 (18:44 +0800)]
Support comma-delimited string as labels in issue template (#21831) (#21873)

Backport #21831.

The [labels in issue YAML templates](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax)
can be a string array or a comma-delimited string, so a single string
should be valid labels.

The old codes committed in #20987 ignore this, that's why the warning is
displayed:

<img width="618" alt="image" src="https://user-images.githubusercontent.com/9418365/202112642-93dc72d0-71c3-40a2-9720-30fc2d48c97c.png">

Fixes #17877.

22 months agoPrevent dangling user redirects (#21856) (#21858)
Gusted [Fri, 18 Nov 2022 14:25:00 +0000 (15:25 +0100)]
Prevent dangling user redirects (#21856) (#21858)

- Backport #21856
- It's possible that the `user_redirect` table contains a user id that
no longer exists.
  - Delete a user redirect upon deleting the user.
- Add a check for these dangling user redirects to check-db-consistency.

23 months agoIgnore issue template with a special name (#21830) (#21835)
Jason Song [Wed, 16 Nov 2022 19:48:33 +0000 (03:48 +0800)]
Ignore issue template with a special name (#21830) (#21835)

Backport #21830.

A file in `ISSUE_TEMPLATE` with the name `config.yml` shouldn't be
treated as a YAML template, it's for [configuring the template
chooser](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser).

The old code tried to ignore the file, but it didn't work, caused by
#20987. That's why the warning is displayed:

<img width="415" alt="image"

src="https://user-images.githubusercontent.com/9418365/202094067-804c42fe-0e9e-4fc5-bf01-d95fa336f54f.png">

Note that this PR is not an implementation of `config.yml`, there will
be another one to do it.

23 months agoPrevent panic in doctor command when running default checks (#21791) (#21807)
zeripath [Mon, 14 Nov 2022 02:58:32 +0000 (02:58 +0000)]
Prevent panic in doctor command when running default checks (#21791) (#21807)

Backport #21791

There was a bug introduced in #21352 due to a change of behaviour caused
by #19280. This causes a panic on running the default doctor checks
because the panic introduced by #19280 assumes that the only way
opts.StdOut and opts.Stderr can be set in RunOpts is deliberately.
Unfortunately, when running a git.Command the provided RunOpts can be
set, therefore if you share a common set of RunOpts these two values can
be set by the previous commands.

This PR stops using common RunOpts for the commands in that doctor check
but secondly stops RunCommand variants from changing the provided
RunOpts.

Signed-off-by: Andrew Thornton <art27@cantab.net>
23 months agoLoad GitRepo in API before deleting issue (#21720) (#21796)
Jason Song [Sun, 13 Nov 2022 05:54:24 +0000 (13:54 +0800)]
Load GitRepo in API before deleting issue (#21720) (#21796)

Backport #21720.

Fix #20921.

The `ctx.Repo.GitRepo` has been used in deleting issues when the issue
is a PR.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
23 months ago Upgrade golang.org/x/crypto (#21792) (#21793)
Gusted [Sun, 13 Nov 2022 04:15:21 +0000 (05:15 +0100)]
 Upgrade golang.org/x/crypto (#21792) (#21793)

- Backport #21792
- Update the crypto dependency to include
https://github.com/golang/crypto/commit/6fad3dfc18918c2ac9c112e46b32473bd2e5e2f9
  - Resolves #17798

23 months agoIgnore line anchor links with leading zeroes (#21728) (#21776)
silverwind [Fri, 11 Nov 2022 13:14:16 +0000 (14:14 +0100)]
Ignore line anchor links with leading zeroes (#21728) (#21776)

Backport #21728
Fixes: https://github.com/go-gitea/gitea/issues/21722
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoSet last login when activating account (#21731) (#21755)
Jason Song [Fri, 11 Nov 2022 06:26:17 +0000 (14:26 +0800)]
Set last login when activating account (#21731) (#21755)

Backport #21731.

Fix #21698.

Set the last login time to the current time when activating the user
successfully.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago Revert unrelated changes for SMTP auth (#21767) (#21768)
wxiaoguang [Thu, 10 Nov 2022 21:11:56 +0000 (05:11 +0800)]
 Revert unrelated changes for SMTP auth (#21767) (#21768)

Backport #21767

The purpose of #18982 is to improve the SMTP mailer, but there were some
unrelated changes made to the SMTP auth in
https://github.com/go-gitea/gitea/pull/18982/commits/d60c43869420f5fc43ad19b454c9ae50dad65964

This PR reverts these unrelated changes, fix #21744

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago Init git module before database migration (#21764) (#21765)
wxiaoguang [Thu, 10 Nov 2022 14:22:41 +0000 (22:22 +0800)]
 Init git module before database migration (#21764) (#21765)

Backport #21764

Some database migrations depend on the git module.

23 months agoFix dashboard ignored system setting cache (#21621) (#21759)
Lunny Xiao [Thu, 10 Nov 2022 11:41:44 +0000 (19:41 +0800)]
Fix dashboard ignored system setting cache (#21621) (#21759)

backport #21621

This is a performance regression from #18058

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
23 months agoFix UI language switching bug (#21597) (#21749)
Xinyu Zhou [Thu, 10 Nov 2022 02:14:32 +0000 (10:14 +0800)]
Fix UI language switching bug (#21597) (#21749)

Backport #21597

Related:
* https://github.com/go-gitea/gitea/pull/21596#issuecomment-1291450224

There was a bug when switching language by AJAX: the irrelevant POST
requests were processed by the target page's handler.

Now, use GET instead of POST. The GET requests should be harmless.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agoRemove semver compatible flag and change pypi to an array of test cases (#21708)...
Wayne Starr [Wed, 9 Nov 2022 15:02:11 +0000 (09:02 -0600)]
Remove semver compatible flag and change pypi to an array of test cases (#21708) (#21730)

Backport (#21708)

This addresses #21707 and adds a second package test case for a
non-semver compatible version (this might be overkill though since you
could also edit the old package version to have an epoch in front and
see the error, this just seemed more flexible for the future).

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
23 months agoQuick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734) (#21738)
Xinyu Zhou [Wed, 9 Nov 2022 13:19:44 +0000 (21:19 +0800)]
Quick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734) (#21738)

Backport #21734

fixes: https://github.com/go-gitea/gitea/issues/21733

Uncaught Error: Language id "vs.editor.nullLanguage" is not configured
nor known

Note that this monaco-editor worked fine on 0.33.0 and broke on 0.34.0.
If upstream fixed, remove this code.

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoAllow local package identifiers for PyPI packages (#21690) (#21727)
Wayne Starr [Wed, 9 Nov 2022 01:10:06 +0000 (19:10 -0600)]
Allow local package identifiers for PyPI packages (#21690) (#21727)

Backport (#21690)

Fixes #21683

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
23 months agoFix token generation when using INTERNAL_TOKEN_URI (#21669) (#21670)
wxiaoguang [Thu, 3 Nov 2022 20:54:25 +0000 (04:54 +0800)]
Fix token generation when using INTERNAL_TOKEN_URI (#21669) (#21670)

Backport #21669

Fix https://github.com/go-gitea/gitea/issues/21666
Caused by https://github.com/go-gitea/gitea/pull/19663

Before: when install, the INTERNAL_TOKEN was always generated and saved.
But the internal token may be already there by INTERNAL_TOKEN_URI

After: INTERNAL_TOKEN_URI file must be non-empty. When install, skip
internal token generation if the token exists.

23 months agoFix repository adoption on Windows (#21646) (#21650)
zeripath [Tue, 1 Nov 2022 22:32:03 +0000 (22:32 +0000)]
Fix repository adoption on Windows (#21646) (#21650)

Backport #21646

A bug was introduced in #17865 where filepath.Join is used to join
putative unadopted repository owner and names together. This is
incorrect as these names are then used as repository names - which shoud
have the '/' separator. This means that adoption will not work on
Windows servers.

Fix #21632

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