]> source.dussan.org Git - gitea.git/log
gitea.git
2 months agoImprove textarea paste (#31948)
silverwind [Sun, 1 Sep 2024 15:15:29 +0000 (17:15 +0200)]
Improve textarea paste (#31948)

- When pasting a URL over another URL, replace the URL instead of
creating a useless `[url](url)`. This is the 1-line change
[here](https://github.com/go-gitea/gitea/pull/31948/files#diff-be8e94d7e3da33b187381f53d28095107bd0cf29ae9a9e997e4f422f4a54479cR122).
- Always run `initTextareaEvents`, previously it was not run when
`dropzoneEl` was not present like when attachements are disabled on the
server. Refactored the function to gracefully handle absent `dropzoneEl`
and rename the function to a better name.

2 months agoFix index too many file names bug (#31903)
Lunny Xiao [Sun, 1 Sep 2024 05:57:31 +0000 (13:57 +0800)]
Fix index too many file names bug (#31903)

Try to fix #31884
Fix #28584

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 1 Sep 2024 00:35:09 +0000 (00:35 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoMove web globals to `web_src/js/globals.d.ts` (#31943)
silverwind [Fri, 30 Aug 2024 07:36:53 +0000 (09:36 +0200)]
Move web globals to `web_src/js/globals.d.ts` (#31943)

This file serves exclusively to support `web_src/js`, so move it there.

2 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 30 Aug 2024 00:29:03 +0000 (00:29 +0000)]
[skip ci] Updated translations via Crowdin

2 months agoUpdate JS and PY dependencies (#31940)
silverwind [Thu, 29 Aug 2024 14:51:51 +0000 (16:51 +0200)]
Update JS and PY dependencies (#31940)

- `stylelint` is excluded because of deprecation warnings added in
16.8.2, depending on
https://github.com/AndyOGo/stylelint-declaration-strict-value/issues/379
- `eslint-plugin-sonarjs@2` adds a lot of new rules, but I have not
gotten around to reviewing them yet, so rule config is unchanged.
- Fixes https://github.com/go-gitea/gitea/security/dependabot/70
- Tested code editor and contributor graph

2 months agoFix search team (#31923)
Lunny Xiao [Thu, 29 Aug 2024 13:26:25 +0000 (21:26 +0800)]
Fix search team (#31923)

Fix #20658

2 months agoUpgrade micromatch to 4.0.8 (#31939)
Lunny Xiao [Thu, 29 Aug 2024 04:54:38 +0000 (12:54 +0800)]
Upgrade micromatch to 4.0.8 (#31939)

2 months agoRefactor globallock (#31933)
Jason Song [Thu, 29 Aug 2024 03:48:21 +0000 (11:48 +0800)]
Refactor globallock (#31933)

Follow #31908. The main refactor is that it has removed the returned
context of `Lock`.

The returned context of `Lock` in old code is to provide a way to let
callers know that they have lost the lock. But in most cases, callers
shouldn't cancel what they are doing even it has lost the lock. And the
design would confuse developers and make them use it incorrectly.

See the discussion history:
https://github.com/go-gitea/gitea/pull/31813#discussion_r1732041513 and
https://github.com/go-gitea/gitea/pull/31813#discussion_r1734078998

It's a breaking change, but since the new module hasn't been used yet, I
think it's OK to not add the `pr/breaking` label.

## Design principles

It's almost copied from #31908, but with some changes.

### Use spinlock even in memory implementation (unchanged)

In actual use cases, users may cancel requests. `sync.Mutex` will block
the goroutine until the lock is acquired even if the request is
canceled. And the spinlock is more suitable for this scenario since it's
possible to give up the lock acquisition.

Although the spinlock consumes more CPU resources, I think it's
acceptable in most cases.

### Do not expose the mutex to callers (unchanged)

If we expose the mutex to callers, it's possible for callers to reuse
the mutex, which causes more complexity.

For example:
```go
lock := GetLocker(key)
lock.Lock()
// ...
// even if the lock is unlocked, we cannot GC the lock,
// since the caller may still use it again.
lock.Unlock()
lock.Lock()
// ...
lock.Unlock()

// callers have to GC the lock manually.
RemoveLocker(key)
```

That's why
https://github.com/go-gitea/gitea/pull/31813#discussion_r1721200549

In this PR, we only expose `ReleaseFunc` to callers. So callers just
need to call `ReleaseFunc` to release the lock, and do not need to care
about the lock's lifecycle.
```go
release, err := locker.Lock(ctx, key)
if err != nil {
    return err
}
// ...
release()

// if callers want to lock again, they have to re-acquire the lock.
release, err := locker.Lock(ctx, key)
// ...
```

In this way, it's also much easier for redis implementation to extend
the mutex automatically, so that callers do not need to care about the
lock's lifecycle. See also
https://github.com/go-gitea/gitea/pull/31813#discussion_r1722659743

### Use "release" instead of "unlock" (unchanged)

For "unlock", it has the meaning of "unlock an acquired lock". So it's
not acceptable to call "unlock" when failed to acquire the lock, or call
"unlock" multiple times. It causes more complexity for callers to decide
whether to call "unlock" or not.

So we use "release" instead of "unlock" to make it clear. Whether the
lock is acquired or not, callers can always call "release", and it's
also safe to call "release" multiple times.

But the code DO NOT expect callers to not call "release" after acquiring
the lock. If callers forget to call "release", it will cause resource
leak. That's why it's always safe to call "release" without extra
checks: to avoid callers to forget to call it.

### Acquired locks could be lost, but the callers shouldn't stop

Unlike `sync.Mutex` which will be locked forever once acquired until
calling `Unlock`, for distributed lock, the acquired lock could be lost.

For example, the caller has acquired the lock, and it holds the lock for
a long time since auto-extending is working for redis. However, it lost
the connection to the redis server, and it's impossible to extend the
lock anymore.

In #31908, it will cancel the context to make the operation stop, but
it's not safe. Many operations are not revert-able. If they have been
interrupted, then the instance goes corrupted. So `Lock` won't return
`ctx` anymore in this PR.

### Multiple ways to use the lock

1. Regular way

```go
release, err := Lock(ctx, key)
if err != nil {
    return err
}
defer release()
// ...
```

2. Early release

```go
release, err := Lock(ctx, key)
if err != nil {
    return err
}
defer release()
// ...
// release the lock earlier
release()
// continue to do something else
// ...
```

3. Functional way

```go
if err := LockAndDo(ctx, key, func(ctx context.Context) error {
    // ...
    return nil
}); err != nil {
    return err
}
```

2 months agoFix a number of Typescript issues (#31877)
silverwind [Wed, 28 Aug 2024 16:32:38 +0000 (18:32 +0200)]
Fix a number of Typescript issues (#31877)

Typescript error count is reduced from 633 to 540 with this. No runtime
changes except in test code.

3 months agoSplit org Propfile README to a new tab `overview` (#31373)
a1012112796 [Tue, 27 Aug 2024 02:54:12 +0000 (10:54 +0800)]
Split org Propfile README to a new tab `overview` (#31373)

like user profile, add a new overviw tab to show profile READEME when it
is exist.

replace #31349 (another solution option)

example view:
![屏幕截图 2024-06-14
094116](https://github.com/go-gitea/gitea/assets/25342410/3303a1f2-ae02-48e0-9519-7fa11e65657f)
![屏幕截图 2024-06-14
094101](https://github.com/go-gitea/gitea/assets/25342410/7a4a5a48-dc2b-4ad4-b2a2-9ea4ab5d5808)

---------

Signed-off-by: a1012112796 <1012112796@qq.com>
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 27 Aug 2024 00:28:30 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoIntroduce globallock as distributed locks (#31908)
Jason Song [Mon, 26 Aug 2024 14:27:57 +0000 (22:27 +0800)]
Introduce globallock as distributed locks (#31908)

To help #31813, but do not replace it, since this PR just introduces the
new module but misses some work:

- New option in settings. `#31813` has done it.
- Use the locks in business logic. `#31813` has done it.

So I think the most efficient way is to merge this PR first (if it's
acceptable) and then finish #31813.

## Design principles

### Use spinlock even in memory implementation

In actual use cases, users may cancel requests. `sync.Mutex` will block
the goroutine until the lock is acquired even if the request is
canceled. And the spinlock is more suitable for this scenario since it's
possible to give up the lock acquisition.

Although the spinlock consumes more CPU resources, I think it's
acceptable in most cases.

### Do not expose the mutex to callers

If we expose the mutex to callers, it's possible for callers to reuse
the mutex, which causes more complexity.

For example:
```go
lock := GetLocker(key)
lock.Lock()
// ...
// even if the lock is unlocked, we cannot GC the lock,
// since the caller may still use it again.
lock.Unlock()
lock.Lock()
// ...
lock.Unlock()

// callers have to GC the lock manually.
RemoveLocker(key)
```

That's why
https://github.com/go-gitea/gitea/pull/31813#discussion_r1721200549

In this PR, we only expose `ReleaseFunc` to callers. So callers just
need to call `ReleaseFunc` to release the lock, and do not need to care
about the lock's lifecycle.
```go
_, release, err := locker.Lock(ctx, key)
if err != nil {
    return err
}
// ...
release()

// if callers want to lock again, they have to re-acquire the lock.
_, release, err := locker.Lock(ctx, key)
// ...
```

In this way, it's also much easier for redis implementation to extend
the mutex automatically, so that callers do not need to care about the
lock's lifecycle. See also
https://github.com/go-gitea/gitea/pull/31813#discussion_r1722659743

### Use "release" instead of "unlock"

For "unlock", it has the meaning of "unlock an acquired lock". So it's
not acceptable to call "unlock" when failed to acquire the lock, or call
"unlock" multiple times. It causes more complexity for callers to decide
whether to call "unlock" or not.

So we use "release" instead of "unlock" to make it clear. Whether the
lock is acquired or not, callers can always call "release", and it's
also safe to call "release" multiple times.

But the code DO NOT expect callers to not call "release" after acquiring
the lock. If callers forget to call "release", it will cause resource
leak. That's why it's always safe to call "release" without extra
checks: to avoid callers to forget to call it.

### Acquired locks could be lost

Unlike `sync.Mutex` which will be locked forever once acquired until
calling `Unlock`, in the new module, the acquired lock could be lost.

For example, the caller has acquired the lock, and it holds the lock for
a long time since auto-extending is working for redis. However, it lost
the connection to the redis server, and it's impossible to extend the
lock anymore.

If the caller don't stop what it's doing, another instance which can
connect to the redis server could acquire the lock, and do the same
thing, which could cause data inconsistency.

So the caller should know what happened, the solution is to return a new
context which will be canceled if the lock is lost or released:

```go
ctx, release, err := locker.Lock(ctx, key)
if err != nil {
    return err
}
defer release()
// ...
DoSomething(ctx)

// the lock is lost now, then ctx has been canceled.

// Failed, since ctx has been canceled.
DoSomethingElse(ctx)
```

### Multiple ways to use the lock

1. Regular way

```go
ctx, release, err := Lock(ctx, key)
if err != nil {
    return err
}
defer release()
// ...
```

2. Early release

```go
ctx, release, err := Lock(ctx, key)
if err != nil {
    return err
}
defer release()
// ...
// release the lock earlier and reset the context back
ctx = release()
// continue to do something else
// ...
```

3. Functional way

```go
if err := LockAndDo(ctx, key, func(ctx context.Context) error {
    // ...
    return nil
}); err != nil {
    return err
}
```

3 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 26 Aug 2024 00:28:33 +0000 (00:28 +0000)]
[skip ci] Updated licenses and gitignores

3 months agoUpdate mermaid to v11 (#31913)
silverwind [Sun, 25 Aug 2024 17:23:13 +0000 (19:23 +0200)]
Update mermaid to v11 (#31913)

Update mermaid to
[v11](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) and
enable the new [`suppressErrorRendering`
option](https://github.com/mermaid-js/mermaid/pull/4359) to ensure
mermaid never renders error elements into the DOM (we have per-chart
error rendering, so don't need it). Tested various chart types.

BTW, I was unable to reproduce that error rendering from mermaid with
`suppressErrorRendering: false` and I thought we had some CSS to hide
the error element, but I could not find it, not even in git history.

3 months agoHandle "close" actionable references for manual merges (#31879)
Zettat123 [Sun, 25 Aug 2024 17:18:19 +0000 (01:18 +0800)]
Handle "close" actionable references for manual merges (#31879)

Fix #31743

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 25 Aug 2024 00:30:57 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoRemove "dsa-1024" testcases from Test_SSHParsePublicKey and Test_calcFingerprint...
Saulius Gurklys [Sat, 24 Aug 2024 10:07:16 +0000 (13:07 +0300)]
Remove "dsa-1024" testcases from Test_SSHParsePublicKey and Test_calcFingerprint (#31905)

DSA is considered inherently insecure and is already disabled/removed in
OpenSSH 9.8.

Therefore "dsa-1024" tescases are failing.

```
--- FAIL: Test_calcFingerprint (0.02s)
    --- FAIL: Test_calcFingerprint/dsa-1024 (0.00s)
        --- FAIL: Test_calcFingerprint/dsa-1024/SSHKeygen (0.00s)
            ssh_key_test.go:196:
                        Error Trace:    /src/gitea/models/asymkey/ssh_key_test.go:196
                        Error:          Received unexpected error:
                                        Unable to verify key content [result: /tmp/gitea_keytest1239408114 is not a public key file.
                                        ]
                        Test:           Test_calcFingerprint/dsa-1024/SSHKeygen
            ssh_key_test.go:197:
                        Error Trace:    /src/gitea/models/asymkey/ssh_key_test.go:197
                        Error:          Not equal:
                                        expected: "SHA256:fSIHQlpKMDsGPVAXI8BPYfRp+e2sfvSt1sMrPsFiXrc"
                                        actual  : ""

                                        Diff:
                                        --- Expected
                                        +++ Actual
                                        @@ -1 +1 @@
                                        -SHA256:fSIHQlpKMDsGPVAXI8BPYfRp+e2sfvSt1sMrPsFiXrc
                                        +
                        Test:           Test_calcFingerprint/dsa-1024/SSHKeygen
FAIL
```

Fix #31624

3 months agoBump relative-time-element to v4.4.3 (#31910)
Yarden Shoham [Fri, 23 Aug 2024 17:22:36 +0000 (20:22 +0300)]
Bump relative-time-element to v4.4.3 (#31910)

All date-times work as before

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 22 Aug 2024 00:27:44 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoUse correct function name (#31887)
Lunny Xiao [Wed, 21 Aug 2024 21:05:48 +0000 (05:05 +0800)]
Use correct function name (#31887)

3 months agoMove lock icon position and add additional tooltips to branch list page (#31839)
william-allspice [Wed, 21 Aug 2024 05:40:18 +0000 (00:40 -0500)]
Move lock icon position and add additional tooltips to branch list page (#31839)

This Pull Request adds missing tool tips for the protected, copy, and rss icons on the branch list page. It also moved protected icon position after the branch name.

3 months agoDon't return 500 if mirror url contains special chars (#31859)
Lunny Xiao [Wed, 21 Aug 2024 01:54:55 +0000 (09:54 +0800)]
Don't return 500 if mirror url contains special chars (#31859)

Fix #31640

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 21 Aug 2024 00:27:45 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoRefactor the usage of batch catfile (#31754)
Lunny Xiao [Tue, 20 Aug 2024 17:04:57 +0000 (01:04 +0800)]
Refactor the usage of batch catfile (#31754)

When opening a repository, it will call `ensureValidRepository` and also
`CatFileBatch`. But sometimes these will not be used until repository
closed. So it's a waste of CPU to invoke 3 times git command for every
open repository.

This PR removed all of these from `OpenRepository` but only kept
checking whether the folder exists. When a batch is necessary, the
necessary functions will be invoked.

3 months agoFix agit automerge (#31207)
Lunny Xiao [Tue, 20 Aug 2024 06:17:21 +0000 (14:17 +0800)]
Fix agit automerge (#31207)

3 months agoadd CfTurnstileSitekey context data to all captcha templates (#31874)
Rowan Bohde [Mon, 19 Aug 2024 17:58:53 +0000 (12:58 -0500)]
add CfTurnstileSitekey context data to all captcha templates (#31874)

In the OpenID flows, the "CfTurnstileSitekey" wasn't populated, which
caused those flows to fail if using Turnstile as the Captcha
implementation.

This adds the missing context variables, allowing Turnstile to be used
in the OpenID flows.

3 months agoAdd tag name in the commits list (#31082)
Lunny Xiao [Mon, 19 Aug 2024 17:04:06 +0000 (01:04 +0800)]
Add tag name in the commits list (#31082)

Fix #10036

This PR adds some labels for tags of this commit after the commit
message on the commits table. The tag template is share as commit
graph's.

Desktop:
<img width="1302" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/ba94e1e6-2a3d-44f3-85a3-575fb5667c97">

Mobile:
<img width="370" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/e3eb1f44-3686-4012-aa9d-52cd88b22c0e">

3 months agoFix actions notify bug (#31866)
Lunny Xiao [Mon, 19 Aug 2024 16:25:41 +0000 (00:25 +0800)]
Fix actions notify bug (#31866)

Try to fix
https://github.com/go-gitea/gitea/issues/31757#issuecomment-2295131062

3 months agoActions support workflow dispatch event (#28163)
胖梁 [Mon, 19 Aug 2024 02:38:40 +0000 (10:38 +0800)]
Actions support workflow dispatch event (#28163)

fix #23668

My plan:
* In the `actions.list` method, if workflow is selected and IsAdmin,
check whether the on event contains `workflow_dispatch`. If so, display
a `Run workflow` button to allow the user to manually trigger the run.
* Providing a form that allows users to select target brach or tag, and
these parameters can be configured in yaml
* Simple form validation, `required` input cannot be empty
* Add a route `/actions/run`, and an `actions.Run` method to handle
* Add `WorkflowDispatchPayload` struct to pass the Webhook event payload
to the runner when triggered, this payload carries the `inputs` values
and other fields, doc: [workflow_dispatch
payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_dispatch)

Other PRs
* the `Workflow.WorkflowDispatchConfig()` method still return non-nil
when workflow_dispatch is not defined. I submitted a PR
https://gitea.com/gitea/act/pulls/85 to fix it. Still waiting for them
to process.

Behavior should be same with github, but may cause confusion. Here's a
quick reminder.
*
[Doc](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch)
Said: This event will `only` trigger a workflow run if the workflow file
is `on the default branch`.
* If the workflow yaml file only exists in a non-default branch, it
cannot be triggered. (It will not even show up in the workflow list)
* If the same workflow yaml file exists in each branch at the same time,
the version of the default branch is used. Even if `Use workflow from`
selects another branch

![image](https://github.com/go-gitea/gitea/assets/3114995/4bf596f3-426b-48e8-9b8f-0f6d18defd79)
```yaml
name: Docker Image CI

on:
  workflow_dispatch:
    inputs:
      logLevel:
        description: 'Log level'
        required: true
        default: 'warning'
        type: choice
        options:
        - info
        - warning
        - debug
      tags:
        description: 'Test scenario tags'
        required: false
        type: boolean
      boolean_default_true:
        description: 'Test scenario tags'
        required: true
        type: boolean
        default: true
      boolean_default_false:
        description: 'Test scenario tags'
        required: false
        type: boolean
        default: false
      environment:
        description: 'Environment to run tests against'
        type: environment
        required: true
        default: 'environment values'
      number_required_1:
        description: 'number '
        type: number
        required: true
        default: '100'
      number_required_2:
        description: 'number'
        type: number
        required: true
        default: '100'
      number_required_3:
        description: 'number'
        type: number
        required: true
        default: '100'
      number_1:
        description: 'number'
        type: number
        required: false
      number_2:
        description: 'number'
        type: number
        required: false
      number_3:
        description: 'number'
        type: number
        required: false

env:
  inputs_logLevel:              ${{ inputs.logLevel }}
  inputs_tags:                  ${{ inputs.tags }}
  inputs_boolean_default_true:  ${{ inputs.boolean_default_true }}
  inputs_boolean_default_false: ${{ inputs.boolean_default_false }}
  inputs_environment:           ${{ inputs.environment }}
  inputs_number_1:              ${{ inputs.number_1  }}
  inputs_number_2:              ${{ inputs.number_2  }}
  inputs_number_3:              ${{ inputs.number_3  }}
  inputs_number_required_1:     ${{ inputs.number_required_1  }}
  inputs_number_required_2:     ${{ inputs.number_required_2  }}
  inputs_number_required_3:     ${{ inputs.number_required_3  }}

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: ls -la
      - run: env | grep inputs
      - run: echo ${{ inputs.logLevel }}
      - run: echo ${{ inputs.boolean_default_false }}
```

![image](https://github.com/go-gitea/gitea/assets/3114995/a58a842d-a0ff-4618-bc6d-83a9596d07c8)

![image](https://github.com/go-gitea/gitea/assets/3114995/44a7cca5-7bd4-42a9-8723-91751a501c88)

---------

Co-authored-by: TKaxv_7S <954067342@qq.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 19 Aug 2024 00:28:51 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 18 Aug 2024 00:30:09 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoFix overflowing content in action run log (#31842)
Adrian Hirt [Sat, 17 Aug 2024 03:34:27 +0000 (05:34 +0200)]
Fix overflowing content in action run log (#31842)

When a long line with characters such as dots is returned by a step in
an action (e.g. by the output of the Ruby on Rails test runner), it
overflows the log container, causing the page to scroll sideways.

This PR adds the CSS `overflow-wrap: anywhere;` to the
`.job-step-section .job-step-logs .job-log-line .log-msg` selector,
which causes such lines to wrap as well

3 months agoUpgrade `htmx` to `2.0.2` (#31847)
Yarden Shoham [Fri, 16 Aug 2024 17:48:54 +0000 (20:48 +0300)]
Upgrade `htmx` to `2.0.2` (#31847)

Tested `Follow`, `Star`, `Watch`, and the admin dashboard page. All
functionality remains unchanged.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
3 months agofix the component of access token list not mounted (#31824)
sillyguodong [Fri, 16 Aug 2024 17:37:36 +0000 (01:37 +0800)]
fix the component of access token list not mounted (#31824)

try to fix #31771

3 months agoAvoid returning without written ctx when posting PR (#31843)
Jason Song [Fri, 16 Aug 2024 17:04:54 +0000 (01:04 +0800)]
Avoid returning without written ctx when posting PR (#31843)

Fix #31625.

If `pull_service.NewPullRequest` return an error which misses each `if`
check, `CompareAndPullRequestPost` will return immediately, since it
doesn't write the HTTP response, a 200 response with empty body will be
sent to clients.

```go
if err := pull_service.NewPullRequest(ctx, repo, pullIssue, labelIDs, attachments, pullRequest, assigneeIDs); err != nil {
if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
} else if git.IsErrPushRejected(err) {
// ...
ctx.JSONError(flashError)
} else if errors.Is(err, user_model.ErrBlockedUser) {
// ...
ctx.JSONError(flashError)
} else if errors.Is(err, issues_model.ErrMustCollaborator) {
// ...
ctx.JSONError(flashError)
}
return
}
```

Not sure what kind of error can cause it to happen, so this PR just
expose it. And we can fix it when users report that creating PRs failed
with error responses.

It's all my guess since I cannot reproduce the problem, but even if it's
not related, the code here needs to be improved.

3 months agoFix raw wiki links (#31825)
Zettat123 [Fri, 16 Aug 2024 12:40:51 +0000 (20:40 +0800)]
Fix raw wiki links (#31825)

Fix #31395

This regression is introduced by #30273. To find out how GitHub handles
this case, I did [some
tests](https://github.com/go-gitea/gitea/issues/31395#issuecomment-2278929115).

I use redirect in this PR instead of checking if the corresponding `.md`
file exists when rendering the link because GitHub also uses redirect.
With this PR, there is no need to resolve the raw wiki link when
rendering a wiki page. If a wiki link points to a raw file, access will
be redirected to the raw link.

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 16 Aug 2024 00:27:28 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoAdd missing repository type filter parameters to pager (#31832)
yp05327 [Thu, 15 Aug 2024 16:34:24 +0000 (01:34 +0900)]
Add missing repository type filter parameters to pager  (#31832)

Fix #31807

ps: the newly added params's value will be changed.
When the first time you selected the filter, the values of params will
be `0` or `1`
But in pager it will be `true` or `false`.
So do we have `boolToInt` function?

3 months agoFix panic of ssh public key page after deletion of auth source (#31829)
Lunny Xiao [Thu, 15 Aug 2024 15:59:01 +0000 (23:59 +0800)]
Fix panic of ssh public key page after deletion of auth source (#31829)

Fix #31730

This PR rewrote the function `PublicKeysAreExternallyManaged` with a
simple test. The new function removed the loop to make it more readable.

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 15 Aug 2024 00:27:03 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

3 months agorender plain text file if the LFS object doesn't exist (#31812)
Rowan Bohde [Wed, 14 Aug 2024 21:50:09 +0000 (16:50 -0500)]
render plain text file if the LFS object doesn't exist (#31812)

We had an issue where a repo was using LFS to store a file, but the user
did not push the file. When trying to view the file, Gitea returned a
500 HTTP status code referencing `ErrLFSObjectNotExist`. It appears the
intent was the render this file as plain text, but the conditional was
flipped. I've also added a test to verify that the file is rendered as
plain text.

3 months agoAdd spacing to global error message (#31826)
Sebastian Luino [Wed, 14 Aug 2024 01:58:26 +0000 (21:58 -0400)]
Add spacing to global error message (#31826)

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

Include Typescript files in Tailwind config so they can be
pre-processed.

![Screenshot from 2024-08-13
08-44-33](https://github.com/user-attachments/assets/196d7801-e299-4000-8b39-cd9f89917f17)

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 14 Aug 2024 00:28:12 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoFixes for unreachable project issues when transfer repository from organization ...
Edip Emre Bodur [Tue, 13 Aug 2024 02:53:43 +0000 (05:53 +0300)]
Fixes for unreachable project issues when transfer repository from organization (#31770)

When transferring repositories that have issues linked to a project
board to another organization, the issues remain associated with the
original project board. This causes the columns in the project board to
become bugged, making it difficult to move other issues in or out of the
affected columns. As a solution, I removed the issue relations since the
other organization does not have this project table.

Fix for #31538

Co-authored-by: Jason Song <i@wolfogre.com>
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 13 Aug 2024 00:28:59 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoScroll images in project issues separately from the remaining issue (#31683)
Simon Priet [Mon, 12 Aug 2024 23:36:28 +0000 (01:36 +0200)]
Scroll images in project issues separately from the remaining issue (#31683)

As discussed in #31667 & #26561, when a card on a Project contains
images, they can overflow the card on its containing column. This aims
to fix this issue via snapping scrollbars.

---
Issue #31667 is open to discussion as there should be room for
improvement.

3 months agoSupport issue template assignees (#31083)
Zettat123 [Mon, 12 Aug 2024 08:00:40 +0000 (16:00 +0800)]
Support issue template assignees (#31083)

Resolve #13955

3 months agoAdd `:focus-visible` style to buttons (#31799)
silverwind [Mon, 12 Aug 2024 00:40:18 +0000 (02:40 +0200)]
Add `:focus-visible` style to buttons (#31799)

Buttons now show a focus style via
[`:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible)
when the browser deems the focus to be important, like for example when
the button is focused via keyboard navigation.

<img width="492" alt="Screenshot 2024-08-07 at 22 12 51"
src="https://github.com/user-attachments/assets/060568b1-1599-4c56-bafb-b36ebb1bec35">
<img width="479" alt="image"
src="https://github.com/user-attachments/assets/885f4e10-f496-47f0-8ae5-45827ded09f8">

3 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 12 Aug 2024 00:29:12 +0000 (00:29 +0000)]
[skip ci] Updated licenses and gitignores

3 months agoShow lock owner instead of repo owner on LFS setting page (#31788)
Jason Song [Sun, 11 Aug 2024 14:48:20 +0000 (22:48 +0800)]
Show lock owner instead of repo owner on LFS setting page (#31788)

Fix #31784.

Before:

<img width="1648" alt="image"
src="https://github.com/user-attachments/assets/03f32545-4a85-42ed-bafc-2b193a5d8023">

After:

<img width="1653" alt="image"
src="https://github.com/user-attachments/assets/e5bcaf93-49cb-421f-aac1-5122bc488b02">

3 months agoMove repository visibility to danger zone in the settings area (#31126)
Fábio Barkoski [Sun, 11 Aug 2024 04:50:54 +0000 (01:50 -0300)]
Move repository visibility to danger zone in the settings area (#31126)

Moved repository visibility to the danger zone in the settings area. To
change the visibility, it is necessary to go to the danger zone, click
on the private/public button, and accept the change in the modal.

Resolves:  #23826

---
## Screenshots

<details>
<summary>Before</summary>
Private repo:

![Private
repo](https://github.com/go-gitea/gitea/assets/65479069/4313492a-4854-48bc-9f47-974e3539d791)

Public repo:

![Public
repo](https://github.com/go-gitea/gitea/assets/65479069/1c45f6e4-ee93-4799-9331-e9d4a7e0f16a)

</details>
<details>
<summary>After</summary>
Make private:

![Screenshot from 2024-05-28
21-35-38](https://github.com/go-gitea/gitea/assets/65479069/4887e28a-0514-4990-aa69-bf3ddc7e6c7d)

Make private modal

![Screenshot from 2024-06-13
23-55-55](https://github.com/go-gitea/gitea/assets/65479069/9f5a7604-069b-41a2-973b-ee2d58e85953)

![Screenshot from 2024-06-13
23-53-09](https://github.com/go-gitea/gitea/assets/65479069/06c22726-eab2-4bce-8df7-62849dcce974)

Make public:

![Screenshot from 2024-05-28
21-34-27](https://github.com/go-gitea/gitea/assets/65479069/6d388f99-0356-48a0-9d85-320cdba55179)

Make public modal

![Screenshot from 2024-06-13
23-53-37](https://github.com/go-gitea/gitea/assets/65479069/8944972e-f2d4-4aea-ba96-b892febb5ced)

</details>

---------

Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 11 Aug 2024 00:31:26 +0000 (00:31 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoAdd types to various low-level functions (#31781)
silverwind [Sat, 10 Aug 2024 09:46:48 +0000 (11:46 +0200)]
Add types to various low-level functions (#31781)

Adds types to various low-level modules. All changes are type-only, no
runtime changes. `tsc` now reports 38 less errors.

One problem was that `@types/sortablejs` does not accept promise return
in its functions which triggered the linter, so I disabled the rules on
those line.

3 months agoAdd warning message in merge instructions when `AutodetectManualMerge` was not enable...
a1012112796 [Sat, 10 Aug 2024 01:09:34 +0000 (09:09 +0800)]
Add warning message in merge instructions when `AutodetectManualMerge` was not enabled (#31805)

not enabled

quick-f-i-x https://github.com/go-gitea/gitea/issues/31433 ? , maybe
need more disscusion about better solutions.

example view:

![image](https://github.com/user-attachments/assets/2af7e1e8-42b9-4473-89c7-12d4a9205d3f)

adtion notes about how to enable `AutodetectManualMerge`

![image](https://github.com/user-attachments/assets/28f84317-367a-40d8-b50d-a19ef7c664d4)

Signed-off-by: a1012112796 <1012112796@qq.com>
3 months agoShow latest run when visit /run/latest (#31808)
FuXiaoHei [Sat, 10 Aug 2024 00:40:41 +0000 (08:40 +0800)]
Show latest run when visit /run/latest (#31808)

Proposal from
https://github.com/go-gitea/gitea/issues/27911#issuecomment-2271982172

When visit latest run path, such as
`/{user}/{repo}/actions/runs/latest`. It renders latest run instead of
index=0 currently.

3 months agoFix typo for `LOG_COMPRESSION` in ini (#31809)
Jason Song [Fri, 9 Aug 2024 22:07:35 +0000 (06:07 +0800)]
Fix typo for `LOG_COMPRESSION` in ini (#31809)

Follow #31761

---------

Co-authored-by: silverwind <me@silverwind.io>
3 months agoAdd label `docs-update-needed` for PRs that modify `app.example.ini` (#31810)
Jason Song [Fri, 9 Aug 2024 16:20:59 +0000 (00:20 +0800)]
Add label `docs-update-needed` for PRs that modify `app.example.ini` (#31810)

To help #31536.

Or it's easy to forget to update https://gitea.com/gitea/docs when
modifying `app.example.ini`.

3 months agoFix `IsObjectExist` with gogit (#31790)
Jason Song [Fri, 9 Aug 2024 02:40:45 +0000 (10:40 +0800)]
Fix `IsObjectExist` with gogit (#31790)

Fix #31271.

When gogit is enabled, `IsObjectExist` calls
`repo.gogitRepo.ResolveRevision`, which is not correct. It's for
checking references not objects, it could work with commit hash since
it's both a valid reference and a commit object, but it doesn't work
with blob objects.

So it causes #31271 because it reports that all blob objects do not
exist.

3 months agoSupport compression for Actions logs (#31761)
Jason Song [Fri, 9 Aug 2024 02:10:30 +0000 (10:10 +0800)]
Support compression for Actions logs (#31761)

Support compression for Actions logs to save storage space and
bandwidth. Inspired by
https://github.com/go-gitea/gitea/issues/24256#issuecomment-1521153015

The biggest challenge is that the compression format should support
[seekable](https://github.com/facebook/zstd/blob/dev/contrib/seekable_format/zstd_seekable_compression_format.md).
So when users are viewing a part of the log lines, Gitea doesn't need to
download the whole compressed file and decompress it.

That means gzip cannot help here. And I did research, there aren't too
many choices, like bgzip and xz, but I think zstd is the most popular
one. It has an implementation in Golang with
[zstd](https://github.com/klauspost/compress/tree/master/zstd) and
[zstd-seekable-format-go](https://github.com/SaveTheRbtz/zstd-seekable-format-go),
and what is better is that it has good compatibility: a seekable format
zstd file can be read by a regular zstd reader.

This PR introduces a new package `zstd` to combine and wrap the two
packages, to provide a unified and easy-to-use API.

And a new setting `LOG_COMPRESSION` is added to the config, although I
don't see any reason why not to use compression, I think's it's a good
idea to keep the default with `none` to be consistent with old versions.

`LOG_COMPRESSION` takes effect for only new log files, it adds `.zst` as
an extension to the file name, so Gitea can determine if it needs
decompression according to the file name when reading. Old files will
keep the format since it's not worth converting them, as they will be
cleared after #31735.

<img width="541" alt="image"
src="https://github.com/user-attachments/assets/e9598764-a4e0-4b68-8c2b-f769265183c9">

3 months agoAdd issue comment when moving issues from one column to another of the project (...
Lunny Xiao [Fri, 9 Aug 2024 01:29:02 +0000 (09:29 +0800)]
Add issue comment when moving issues from one column to another of the project (#29311)

Fix #27278
Replace #27816

This PR adds a meta-comment for an issue when dragging an issue from one
column to another of a project.

<img width="600" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/5fc1d954-430e-4db0-aaee-a00006fa91f5">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 9 Aug 2024 00:27:50 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoFix RPM resource leak (#31794)
KN4CK3R [Thu, 8 Aug 2024 09:43:04 +0000 (11:43 +0200)]
Fix RPM resource leak (#31794)

Fixes a resource leak introduced by #27069.

- add defer
- move sign code out of `repository.go`

3 months agoAdd `TAGS` to `TEST_TAGS` and fix bugs found with gogit (#31791)
Jason Song [Wed, 7 Aug 2024 15:29:08 +0000 (23:29 +0800)]
Add `TAGS` to `TEST_TAGS` and fix bugs found with gogit (#31791)

Found at
https://github.com/go-gitea/gitea/pull/31790#issuecomment-2272898915

`unit-tests-gogit` never work since the workflow set `TAGS` with
`gogit`, but the Makefile use `TEST_TAGS`.

This PR adds the values of `TAGS` to `TEST_TAGS`, ensuring that setting
`TAGS` is always acceptable and avoiding confusion about which one
should be set.

3 months agoFix protected branch files detection on pre_receive hook (#31778)
Lunny Xiao [Tue, 6 Aug 2024 13:32:49 +0000 (21:32 +0800)]
Fix protected branch files detection on pre_receive hook (#31778)

Fix #31738

When pushing a new branch, the old commit is zero. Most git commands
cannot recognize the zero commit id. To get the changed files in the
push, we need to get the first diverge commit of this branch. In most
situations, we could check commits one by one until one commit is
contained by another branch. Then we will think that commit is the
diverge point.

And in a pre-receive hook, this will be more difficult because all
commits haven't been merged and they actually stored in a temporary
place by git. So we need to bring some envs to let git know the commit
exist.

3 months agoAdd signature support for the RPM module (#27069)
Exploding Dragon [Tue, 6 Aug 2024 13:03:33 +0000 (21:03 +0800)]
Add signature support for the RPM module (#27069)

close  #27031

If the rpm package does not contain a matching gpg signature, the
installation will fail. See (#27031) , now auto-signing rpm uploads.

This option is turned off by default for compatibility.

3 months agoFix null requested_reviewer from API (#31773)
Edip Emre Bodur [Mon, 5 Aug 2024 10:59:53 +0000 (13:59 +0300)]
Fix null requested_reviewer from API (#31773)

If the assign the pull request review to a team, it did not show the
members of the team in the "requested_reviewers" field, so the field was
null. As a solution, I added the team members to the array.

fix #31764

3 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 5 Aug 2024 00:28:44 +0000 (00:28 +0000)]
[skip ci] Updated licenses and gitignores

3 months agoRename head branch of pull requests when renaming a branch (#31759)
Lunny Xiao [Sun, 4 Aug 2024 03:21:42 +0000 (11:21 +0800)]
Rename head branch of pull requests when renaming a branch (#31759)

Fix #31716

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 4 Aug 2024 00:30:13 +0000 (00:30 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoFix wiki revision pagination (#31760)
Lunny Xiao [Sat, 3 Aug 2024 18:35:55 +0000 (02:35 +0800)]
Fix wiki revision pagination (#31760)

Fix #31755

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 3 Aug 2024 00:27:17 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoUpdate JS dependencies (#31766)
silverwind [Fri, 2 Aug 2024 21:28:12 +0000 (23:28 +0200)]
Update JS dependencies (#31766)

3 months agoUpgrade bleve to 2.4.2 (#31762)
Lunny Xiao [Fri, 2 Aug 2024 19:32:31 +0000 (03:32 +0800)]
Upgrade bleve to 2.4.2 (#31762)

3 months agoRemove unused code from models/repos/release.go (#31756)
Kemal Zebari [Fri, 2 Aug 2024 14:23:49 +0000 (07:23 -0700)]
Remove unused code from models/repos/release.go (#31756)

These blocks aren't used anywhere else when doing a grep search.

3 months agoClear up old Actions logs (#31735)
Jason Song [Fri, 2 Aug 2024 00:42:08 +0000 (08:42 +0800)]
Clear up old Actions logs (#31735)

Part of #24256.

Clear up old action logs to free up storage space.

Users will see a message indicating that the log has been cleared if
they view old tasks.

<img width="1361" alt="image"
src="https://github.com/user-attachments/assets/9f0f3a3a-bc5a-402f-90ca-49282d196c22">

Docs: https://gitea.com/gitea/docs/pulls/40

---------

Co-authored-by: silverwind <me@silverwind.io>
3 months agoFix createElementFromAttrs bug (#31751)
wxiaoguang [Thu, 1 Aug 2024 19:06:03 +0000 (03:06 +0800)]
Fix createElementFromAttrs bug (#31751)

The "false" value was not handled correctly, it would cause bugs in the
future (fortunately, this behavior is not used in code yet).

3 months agobump vue-bar-graph (#31705)
techknowlogick [Thu, 1 Aug 2024 17:42:51 +0000 (13:42 -0400)]
bump vue-bar-graph (#31705)

3 months agoUse UTC as default timezone when schedule Actions cron tasks (#31742)
Jason Song [Thu, 1 Aug 2024 10:02:46 +0000 (18:02 +0800)]
Use UTC as default timezone when schedule Actions cron tasks (#31742)

Fix #31657.

According to the
[doc](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onschedule)
of GitHub Actions, The timezone for cron should be UTC, not the local
timezone. And Gitea Actions doesn't have any reasons to change this, so
I think it's a bug.

However, Gitea Actions has extended the syntax, as it supports
descriptors like `@weekly` and `@every 5m`, and supports specifying the
timezone like `TZ=UTC 0 10 * * *`. So we can make it use UTC only when
the timezone is not specified, to be compatible with GitHub Actions, and
also respect the user's specified.

It does break the feature because the times to run tasks would be
changed, and it may confuse users. So I don't think we should backport
this.

## ⚠️ BREAKING ⚠️

If the server's local time zone is not UTC, a scheduled task would run
at a different time after upgrading Gitea to this version.

3 months agoAdd permission description for API to add repo collaborator (#31744)
Jason Song [Thu, 1 Aug 2024 09:33:40 +0000 (17:33 +0800)]
Add permission description for API to add repo collaborator (#31744)

Fix #31552.

3 months agoClarify Actions resources ownership (#31724)
Jason Song [Thu, 1 Aug 2024 09:04:04 +0000 (17:04 +0800)]
Clarify Actions resources ownership (#31724)

Fix #31707.

Also related to #31715.

Some Actions resources could has different types of ownership. It could
be:

- global: all repos and orgs/users can use it.
- org/user level: only the org/user can use it.
- repo level: only the repo can use it.

There are two ways to distinguish org/user level from repo level:
1. `{owner_id: 1, repo_id: 2}` for repo level, and `{owner_id: 1,
repo_id: 0}` for org level.
2. `{owner_id: 0, repo_id: 2}` for repo level, and `{owner_id: 1,
repo_id: 0}` for org level.

The first way seems more reasonable, but it may not be true. The point
is that although a resource, like a runner, belongs to a repo (it can be
used by the repo), the runner doesn't belong to the repo's org (other
repos in the same org cannot use the runner). So, the second method
makes more sense.

And the first way is not user-friendly to query, we must set the repo id
to zero to avoid wrong results.

So, #31715 should be right. And the most simple way to fix #31707 is
just:

```diff
- shared.GetRegistrationToken(ctx, ctx.Repo.Repository.OwnerID, ctx.Repo.Repository.ID)
+ shared.GetRegistrationToken(ctx, 0, ctx.Repo.Repository.ID)
```

However, it is quite intuitive to set both owner id and repo id since
the repo belongs to the owner. So I prefer to be compatible with it. If
we get both owner id and repo id not zero when creating or finding, it's
very clear that the caller want one with repo level, but set owner id
accidentally. So it's OK to accept it but fix the owner id to zero.

3 months agoExclude protected branches from recently pushed (#31748)
Jason Song [Thu, 1 Aug 2024 07:21:28 +0000 (15:21 +0800)]
Exclude protected branches from recently pushed (#31748)

Resolve #31566.

Updates to protected branches often come from PR merges, and they are
unlikely to be used to create new PRs.

<img width="1346" alt="image"
src="https://github.com/user-attachments/assets/9ed72bd6-0303-435d-856c-184784104c6a">
<img width="1347" alt="image"
src="https://github.com/user-attachments/assets/c1a1df4b-1c16-4116-aea3-d452242119e0">
<img width="1336" alt="image"
src="https://github.com/user-attachments/assets/706034ad-d3c3-4853-a6b8-cbaf87c70ba0">

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 1 Aug 2024 00:31:07 +0000 (00:31 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoDistinguish LFS object errors to ignore missing objects during migration (#31702)
Jason Song [Wed, 31 Jul 2024 10:29:48 +0000 (18:29 +0800)]
Distinguish LFS object errors to ignore missing objects during migration (#31702)

Fix #31137.

Replace #31623 #31697.

When migrating LFS objects, if there's any object that failed (like some
objects are losted, which is not really critical), Gitea will stop
migrating LFS immediately but treat the migration as successful.

This PR checks the error according to the [LFS api
doc](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#successful-responses).

> LFS object error codes should match HTTP status codes where possible:
>
> - 404 - The object does not exist on the server.
> - 409 - The specified hash algorithm disagrees with the server's
acceptable options.
> - 410 - The object was removed by the owner.
> - 422 - Validation error.

If the error is `404`, it's safe to ignore it and continue migration.
Otherwise, stop the migration and mark it as failed to ensure data
integrity of LFS objects.

And maybe we should also ignore others errors (maybe `410`? I'm not sure
what's the difference between "does not exist" and "removed by the
owner".), we can add it later when some users report that they have
failed to migrate LFS because of an error which should be ignored.

3 months agoImprove names of cron jobs for Actions (#31736)
Jason Song [Wed, 31 Jul 2024 03:03:30 +0000 (11:03 +0800)]
Improve names of cron jobs for Actions (#31736)

Before:

<img width="1641" alt="image"
src="https://github.com/user-attachments/assets/60fa3f3e-cf19-4903-b080-616aef28057b">

After:

<img width="1674" alt="image"
src="https://github.com/user-attachments/assets/b04fd01e-838d-45c3-9655-cb39a2f7d1f2">

3 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 31 Jul 2024 00:23:19 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

3 months agoFix the display of project type for deleted projects (#31732)
yp05327 [Tue, 30 Jul 2024 04:37:43 +0000 (13:37 +0900)]
Fix the display of project type for deleted projects (#31732)

Fix: #31727
After:

![image](https://github.com/user-attachments/assets/1dfb4b31-3bd6-47f7-b126-650f33f453e2)

3 months agoFix Null Pointer error for CommitStatusesHideActionsURL (#31731)
yp05327 [Tue, 30 Jul 2024 02:56:25 +0000 (11:56 +0900)]
Fix Null Pointer error for CommitStatusesHideActionsURL (#31731)

Fix https://github.com/go-gitea/gitea/pull/30156#discussion_r1695247028

Forgot fixing it in #31719

3 months agoMove `registerActionsCleanup` to `initActionsTasks` (#31721)
Jason Song [Tue, 30 Jul 2024 02:27:28 +0000 (10:27 +0800)]
Move `registerActionsCleanup` to `initActionsTasks` (#31721)

There's already `initActionsTasks`; it will avoid additional check for
if Actions enabled to move `registerActionsCleanup` into it.

And we don't really need `OlderThanConfig`.

3 months agoSet owner id to zero when GetRegistrationToken for repo (#31725)
Jason Song [Mon, 29 Jul 2024 18:46:45 +0000 (02:46 +0800)]
Set owner id to zero when GetRegistrationToken for repo (#31725)

Fix #31707.

It's split from #31724.

Although #31724 could also fix #31707, it has change a lot so it's not a
good idea to backport it.

3 months agofix(api): owner ID should be zero when created repo secret (#31715)
Bo-Yi Wu [Mon, 29 Jul 2024 17:15:02 +0000 (01:15 +0800)]
fix(api): owner ID should be zero when created repo secret (#31715)

- Change condition to include `RepoID` equal to 0 for organization
secrets

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
3 months agoFix API endpoint for registration-token (#31722)
Jason Song [Mon, 29 Jul 2024 16:45:24 +0000 (00:45 +0800)]
Fix API endpoint for registration-token (#31722)

Partially fix #31707. Related to #30656

3 months agoFix loadRepository error when access user dashboard (#31719)
yp05327 [Mon, 29 Jul 2024 06:51:02 +0000 (15:51 +0900)]
Fix loadRepository error when access user dashboard (#31719)

3 months agoAdd permission check when creating PR (#31033)
yp05327 [Mon, 29 Jul 2024 02:21:22 +0000 (11:21 +0900)]
Add permission check when creating PR (#31033)

user should be a collaborator of the base repo to create a PR

3 months agoMake GetRepositoryByName more safer (#31712)
Lunny Xiao [Mon, 29 Jul 2024 01:32:54 +0000 (09:32 +0800)]
Make GetRepositoryByName more safer (#31712)

Fix #31708

3 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 29 Jul 2024 00:28:39 +0000 (00:28 +0000)]
[skip ci] Updated licenses and gitignores

3 months agoRun `go-install` in `deps-tools` in parallel (#31711)
silverwind [Sun, 28 Jul 2024 17:27:24 +0000 (19:27 +0200)]
Run `go-install` in `deps-tools` in parallel (#31711)

`go install` is far too conservative in regards to parallel HTTP
requests, so we can run the commands in parallel to achieve a speedup.

3 months agoHide the "Details" link of commit status when the user cannot access actions (#30156)
Zettat123 [Sun, 28 Jul 2024 15:11:40 +0000 (23:11 +0800)]
Hide the "Details" link of commit status when the user cannot access actions (#30156)

Fix #26685

If a commit status comes from Gitea Actions and the user cannot access
the repo's actions unit (the user does not have the permission or the
actions unit is disabled), a 404 page will occur after clicking the
"Details" link. We should hide the "Details" link in this case.

<img
src="https://github.com/go-gitea/gitea/assets/15528715/68361714-b784-4bb5-baab-efde4221f466"
width="400px" />

4 months agoEnable `no-jquery/no-parse-html-literal` and fix violation (#31684)
silverwind [Sat, 27 Jul 2024 14:44:41 +0000 (16:44 +0200)]
Enable `no-jquery/no-parse-html-literal` and fix violation (#31684)

Tested it, path segment creation works just like before.

4 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 27 Jul 2024 00:27:00 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin