Commit Graph

3702 Commits

Author SHA1 Message Date
e65f69f52e Merge branch 'main' into feature/bots 2023-01-10 15:18:48 +08:00
5442440b5e fix: order by index 2023-01-10 11:52:51 +08:00
335873e1d8 chore: remove exp 2023-01-10 10:37:20 +08:00
a35714372d Fix halfCommitter and WithTx (#22366)
Related to #22362.

I overlooked that there's always `committer.Close()`, like:

```go
		ctx, committer, err := db.TxContext(db.DefaultContext)
		if err != nil {
			return nil
		}
		defer committer.Close()

		// ...

		if err != nil {
			return nil
		}

		// ...

		return committer.Commit()
```

So the `Close` of `halfCommitter` should ignore `commit and close`, it's
not a rollback.

See: [Why `halfCommitter` and `WithTx` should rollback IMMEDIATELY or
commit
LATER](https://github.com/go-gitea/gitea/pull/22366#issuecomment-1374778612).

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-01-09 12:19:19 -05:00
f414fd6141 Merge branch 'main' into feature/bots 2023-01-09 12:17:08 +08:00
7adc2de464 Use context parameter in models/git (#22367)
After #22362, we can feel free to use transactions without
`db.DefaultContext`.

And there are still lots of models using `db.DefaultContext`, I think we
should refactor them carefully and one by one.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-01-09 11:50:54 +08:00
5e9d4f7b9c Merge branch 'main' into feature/bots 2023-01-09 10:42:38 +08:00
dfd2db5695 Fix set system setting failure once it cached (#22333)
Unfortunately, #22295 introduced a bug that when set a cached system
setting, it will not affect.
This PR make sure to remove the cache key when updating a system
setting.

Fix #22332
2023-01-08 21:22:41 +08:00
6135359a04 Always reuse transaction (#22362) 2023-01-08 09:34:58 +08:00
21db670907 fix: use webhook_module 2023-01-06 20:46:36 +08:00
4c65c1d8b0 Merge branch 'main' into feature/bots 2023-01-06 20:32:23 +08:00
3dbd2d942b Remove old HookEventType (#22358)
Supplement to #22256.
2023-01-06 19:49:14 +08:00
aba1c03fee feat: improve listing runs 2023-01-06 16:29:10 +08:00
6f6bfc5d51 feat: more translations 2023-01-06 15:55:47 +08:00
243b769754 feat: locale status for runner 2023-01-06 15:07:44 +08:00
91dfef0425 feat: LocaleString for status 2023-01-06 15:02:03 +08:00
63e82382fc Update models/actions/task_step.go
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2023-01-05 18:05:07 +08:00
22496aa57e Update models/actions/task.go
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
2023-01-05 18:04:23 +08:00
92b117f930 test: fix import cycle in dbfs test 2023-01-05 17:23:13 +08:00
a4b2cf2426 feat: calculate duration 2023-01-05 16:19:08 +08:00
c510fdbcf1 chore: simplify IsActions 2023-01-05 16:03:21 +08:00
eee662442a fix: simplify deleting 2023-01-05 15:40:19 +08:00
0d2945fe4d Merge branch 'main' into feature/bots 2023-01-04 18:57:57 +08:00
4b15a33257 chore: format code 2023-01-04 18:57:10 +08:00
95167fd0a2 chore: rename to NumActionRuns 2023-01-04 18:52:22 +08:00
6148e4c940 fix: rename to GetPossibleUserByID 2023-01-04 18:52:22 +08:00
0887e98f2a refactor: getPoster 2023-01-04 18:52:22 +08:00
d5e6d959eb refactor: rename Number to Index 2023-01-04 18:52:22 +08:00
2c686e8826 fix: add restraints for models 2023-01-04 18:52:22 +08:00
7f6a803d24 fix: omit total in FindTasks 2023-01-04 18:52:22 +08:00
5d938ebf4e fix: use container.Set 2023-01-04 18:52:21 +08:00
5925722501 chore: move statusNames 2023-01-04 18:52:21 +08:00
cd2af5d4f2 fix: check if steps are empty 2023-01-04 18:52:21 +08:00
1faa8856a4 Update models/user/user_system.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 18:30:02 +08:00
0f824b693c Update models/user/user_system.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 18:28:31 +08:00
fdbb0b4762 fix gravatar disable bug (#22336) 2023-01-04 16:19:56 +08:00
9b00ded1fb Update models/actions/task_list.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 16:11:17 +08:00
2917057b00 Update models/actions/status.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 15:37:55 +08:00
53afbcecad Merge branch 'main' into feature/bots 2023-01-03 09:43:23 +08:00
a1c30740bb Fix get system setting bug when enabled redis cache (#22295)
Fix #22281

In #21621 , `Get[V]` and `Set[V]` has been introduced, so that cache
value will be `*Setting`. For memory cache it's OK. But for redis cache,
it can only store `string` for the current implementation. This PR
revert some of changes of that and just store or return a `string` for
system setting.
2023-01-02 00:06:52 +08:00
0f4e1b9ac6 Restructure webhook module (#22256)
Previously, there was an `import services/webhooks` inside
`modules/notification/webhook`.
This import was removed (after fighting against many import cycles).
Additionally, `modules/notification/webhook` was moved to
`modules/webhook`,
and a few structs/constants were extracted from `models/webhooks` to
`modules/webhook`.

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-01-01 23:23:15 +08:00
9c8fc7f677 Fix bug of DisableGravatar default value (#22296)
#18058 made a mistake. The disableGravatar's default value depends on
`OfflineMode`. If it's `true`, then `disableGravatar` is true, otherwise
it's `false`. But not opposite.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-01-01 20:19:23 +08:00
3fef47b41c Use ErrInvalidArgument in packages (#22268)
Related to
https://github.com/go-gitea/gitea/pull/22262#discussion_r1059010774

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
2022-12-31 12:49:37 +01:00
e5deeda0aa Support estimated count with multiple schemas (#22276)
The `EstimateCount` could be incorrect when the table lives in multiple
schemas. Related to #19775.
2022-12-30 12:25:58 -06:00
b76970f2e4 Fix key signature error page (#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`](e81ccc406b/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`](e81ccc406b/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.

Before:

![image](https://user-images.githubusercontent.com/25481501/209404800-0e7c39ce-861a-455b-b234-62498d750aa8.png)

After:

![image](https://user-images.githubusercontent.com/25481501/209404821-c70f81c6-fd10-4197-ab58-61cb9fc873d8.png)

Co-authored-by: zeripath <art27@cantab.net>
2022-12-30 12:53:05 +08:00
d995fc6281 Merge branch 'main' into feature/bots 2022-12-28 13:29:46 +08:00
7cc7db73b9 Add option to prohibit fork if user reached maximum limit of repositories (#21848)
If user has reached the maximum limit of repositories:

- Before
  - disallow create
  - allow fork without limit
- This patch:
  - disallow create
  - disallow fork
- Add option `ALLOW_FORK_WITHOUT_MAXIMUM_LIMIT` (Default **true**) :
enable this allow user fork repositories without maximum number limit

fixed https://github.com/go-gitea/gitea/issues/21847

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
2022-12-27 15:21:14 -06:00
6cf09ccab4 Use complete SHA to create and query commit status (#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>
2022-12-27 21:12:49 +08:00
a67e14d0ed chore: fmt code 2022-12-23 21:09:58 +08:00
3462760632 Merge branch 'main' into feature/bots 2022-12-23 20:56:52 +08:00