Commit Graph

3680 Commits

Author SHA1 Message Date
Jason Song 0d2945fe4d
Merge branch 'main' into feature/bots 2023-01-04 18:57:57 +08:00
Jason Song 4b15a33257
chore: format code 2023-01-04 18:57:10 +08:00
Jason Song 95167fd0a2
chore: rename to NumActionRuns 2023-01-04 18:52:22 +08:00
Jason Song 6148e4c940
fix: rename to GetPossibleUserByID 2023-01-04 18:52:22 +08:00
Jason Song 0887e98f2a
refactor: getPoster 2023-01-04 18:52:22 +08:00
Jason Song d5e6d959eb
refactor: rename Number to Index 2023-01-04 18:52:22 +08:00
Jason Song 2c686e8826
fix: add restraints for models 2023-01-04 18:52:22 +08:00
Jason Song 7f6a803d24
fix: omit total in FindTasks 2023-01-04 18:52:22 +08:00
Jason Song 5d938ebf4e
fix: use container.Set 2023-01-04 18:52:21 +08:00
Jason Song 5925722501
chore: move statusNames 2023-01-04 18:52:21 +08:00
Jason Song cd2af5d4f2
fix: check if steps are empty 2023-01-04 18:52:21 +08:00
Jason Song 1faa8856a4
Update models/user/user_system.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 18:30:02 +08:00
Jason Song 0f824b693c
Update models/user/user_system.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 18:28:31 +08:00
Lunny Xiao fdbb0b4762
fix gravatar disable bug (#22336) 2023-01-04 16:19:56 +08:00
Jason Song 9b00ded1fb
Update models/actions/task_list.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 16:11:17 +08:00
Jason Song 2917057b00
Update models/actions/status.go
Co-authored-by: delvh <dev.lh@web.de>
2023-01-04 15:37:55 +08:00
Jason Song 53afbcecad
Merge branch 'main' into feature/bots 2023-01-03 09:43:23 +08:00
Lunny Xiao 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
delvh 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
Lunny Xiao 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
KN4CK3R 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
Jason Song 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
Gusted 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
Jason Song d995fc6281
Merge branch 'main' into feature/bots 2022-12-28 13:29:46 +08:00
Xinyu Zhou 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
Jason Song 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
Jason Song a67e14d0ed
chore: fmt code 2022-12-23 21:09:58 +08:00
Jason Song 3462760632
Merge branch 'main' into feature/bots 2022-12-23 20:56:52 +08:00
Jason Song 71ca3067bc
Check primary keys for all tables and drop ForeignReference (#21721)
Some dbs require that all tables have primary keys, see
- #16802
- #21086

We can add a test to keep it from being broken again.

Edit:

~Added missing primary key for `ForeignReference`~ Dropped the
`ForeignReference` table to satisfy the check, so it closes #21086.

More context can be found in comments.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
2022-12-23 19:35:43 +08:00
Jason Song 255d778737
fix: last eight token 2022-12-23 13:18:49 +08:00
Jason Song 4782792604
Merge branch 'main' into feature/bots 2022-12-23 10:34:48 +08:00
Nick a2779def36 Test views of LFS files (#22196) 2022-12-23 07:41:56 +08:00
Jason Song 9eafbada53
chore: reorganize locale of actions 2022-12-22 17:29:41 +08:00
Jason Song aee01d139c
chore: remove FindObjects 2022-12-22 15:16:10 +08:00
Jason Song 34be6b5092
fix: remove old secret model 2022-12-22 15:07:04 +08:00
Jason Song 058675f7e5
fix: use new secrets 2022-12-22 14:44:22 +08:00
Jason Song d183b32aa8
Merge branch 'main' into feature/bots 2022-12-22 12:00:41 +08:00
Jason Song 659055138b
Secrets storage with SecretKey encrypted (#22142)
Fork of #14483, but [gave up
MasterKey](https://github.com/go-gitea/gitea/pull/14483#issuecomment-1350728557),
and fixed some problems.

Close #12065.
Needed by #13539.

Featrues:
- Secrets for repo and org, not user yet.
- Use SecretKey to encrypte/encrypt secrets.
- Trim spaces of secret value.
- Add a new locale ini block, to make it easy to support secrets for
user.

Snapshots:

Repo level secrets:

![image](https://user-images.githubusercontent.com/9418365/207823319-b8a4903f-38ca-4af7-9d05-336a5af906f3.png)

Rrg level secrets

![image](https://user-images.githubusercontent.com/9418365/207823371-8bd02e93-1928-40d1-8c76-f48b255ace36.png)

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2022-12-20 17:07:13 +08:00
Jason Song b03f6e5b65
fix: remove meanless code 2022-12-19 18:32:38 +08:00
Jason Song 215d80f6b2
Update models/actions/run.go
Co-authored-by: a1012112796 <1012112796@qq.com>
2022-12-19 18:30:16 +08:00
Jason Song ab98c3ff43
Merge branch 'main' into feature/bots 2022-12-19 18:26:28 +08:00
zeripath 651fe4bb7d
Add doctor command for full GC of LFS (#21978)
The recent PR adding orphaned checks to the LFS storage is not
sufficient to completely GC LFS, as it is possible for LFSMetaObjects to
remain associated with repos but still need to be garbage collected.

Imagine a situation where a branch is uploaded containing LFS files but
that branch is later completely deleted. The LFSMetaObjects will remain
associated with the Repository but the Repository will no longer contain
any pointers to the object.

This PR adds a second doctor command to perform a full GC.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2022-12-15 20:44:16 +00:00
KN4CK3R 07461e18d3
Fix condition for is_internal (#22095)
depends on #22094

Fixes https://codeberg.org/forgejo/forgejo/issues/77

The old logic did not consider `is_internal`.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-12-14 17:16:01 +08:00
Jason Song 6c622137f1
Merge branch 'main' into feature/bots 2022-12-13 09:50:18 +08:00
Lunny Xiao 36a2d2f919
Add a simple test for external renderer (#20033)
Fix #16402
2022-12-12 20:45:21 +08:00
Jason Song e69e829102
fix: remove ActionTask.GetRepo 2022-12-12 18:52:52 +08:00
Jason Song 1c9288f3dd
fix: list runners 2022-12-12 18:52:52 +08:00
Jason Song cca23dd4af
feat: rename bot user to gitea-actions 2022-12-12 17:29:34 +08:00
Jason Song 4da0a65511
chore: migrations v236 2022-12-12 13:12:00 +08:00
Jason Song 86d6598a54
fix: use LONGBLOB 2022-12-12 13:08:49 +08:00