Commit graph

229 commits

Author SHA1 Message Date
Michael Jerger
94be68725a Merge branch 'forgejo' into forgejo-federated-star 2024-05-15 09:35:02 +02:00
Clemens
c4f9f8578a Introduced ErrNotValid 2024-05-13 11:14:04 +02:00
6543
eb4c6f3f09
Get repo list with OrderBy alpha should respect owner too (#30784)
instead of:
- zowner/gcode
- awesome/nul
- zowner/nul
- zowner/zzz

we will get:
- awesome/nul
- zowner/gcode
- zowner/nul
- zowner/zzz

(cherry picked from commit 8e8ca6c6530e49e39f970bdfa84716ffda8973d0)
2024-05-12 20:03:10 +02:00
Yaroslav Halchenko
2b2fd2728c Add codespell support and fix a good number of typos with its help (#3270)
More about codespell: https://github.com/codespell-project/codespell .

I personally introduced it to dozens if not hundreds of projects already and so far only positive feedback.

```
❯ grep lint-spell Makefile
	@echo " - lint-spell                       lint spelling"
	@echo " - lint-spell-fix                   lint spelling and fix issues"
lint: lint-frontend lint-backend lint-spell
lint-fix: lint-frontend-fix lint-backend-fix lint-spell-fix
.PHONY: lint-spell
lint-spell: lint-codespell
.PHONY: lint-spell-fix
lint-spell-fix: lint-codespell-fix
❯ git grep lint- -- .forgejo/
.forgejo/workflows/testing.yml:      - run: make --always-make -j$(nproc) lint-backend checks-backend # ensure the "go-licenses" make target runs
.forgejo/workflows/testing.yml:      - run: make lint-frontend
```
so how would you like me to invoke `lint-codespell` on CI? (without that would be IMHO very suboptimal and let typos sneak in)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3270
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
Co-committed-by: Yaroslav Halchenko <debian@onerussian.com>
2024-05-09 13:49:37 +00:00
6543
51b8d964c8
Get repo assignees and reviewers should ignore deactivated users (#30770) (#30782)
Backport  #30770

If an user is deactivated, it should not be in the list of users who are
suggested to be assigned or review-requested.

old assignees or reviewers are not affected.

---
*Sponsored by Kithara Software GmbH*

(cherry picked from commit f2d8ccc5bb2df25557cc0d4d23f2cdd029358274)

Conflicts:
	models/repo/user_repo_test.go
	because there is one less fixture user compared to Gitea
2024-05-05 08:53:27 +01:00
Michael Jerger
ee71f86432 Merge branch 'forgejo' into forgejo-federated-star 2024-05-03 08:44:49 +02:00
silverwind
12b199c5e5
Enable more revive linter rules (#30608)
Noteable additions:

- `redefines-builtin-id` forbid variable names that shadow go builtins
- `empty-lines` remove unnecessary empty lines that `gofumpt` does not
remove for some reason
- `superfluous-else` eliminate more superfluous `else` branches

Rules are also sorted alphabetically and I cleaned up various parts of
`.golangci.yml`.

(cherry picked from commit 74f0c84fa4245a20ce6fb87dac1faf2aeeded2a2)

Conflicts:
	.golangci.yml
	apply the linter recommendations to Forgejo code as well
2024-04-28 15:39:00 +02:00
Michael Jerger
70ae102597 Merge branch 'forgejo' into forgejo-federated-star 2024-04-26 17:16:15 +02:00
JakobDev
1bce2dc5c5 [FEAT]Add Option to hide Release Archive links (#3139)
This adds a new options to releases to hide the links to the automatically generated archives. This is useful, when the automatically generated Archives are broken e.g. because of Submodules.

![grafik](/attachments/5686edf6-f318-4175-8459-89c33973b181)
![grafik](/attachments/74a8bf92-2abb-47a0-876d-d41024770d0b)

Note:
This juts hides the Archives from the UI. Users can still download 5the Archive if they know t correct URL.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3139
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: JakobDev <jakobdev@gmx.de>
Co-committed-by: JakobDev <jakobdev@gmx.de>
2024-04-24 15:15:55 +00:00
oliverpool
525accfae6 Add container.FilterSlice function (gitea#30339)
Many places have the following logic:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	ids := make(container.Set[int64], len(jobs))
	for _, j := range jobs {
		if j.RunID == 0 {
			continue
		}
		ids.Add(j.RunID)
	}
	return ids.Values()
}
```

this introduces a `container.FilterMapUnique` function, which reduces
the code above to:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	return container.FilterMapUnique(jobs, func(j *ActionRunJob) (int64, bool) {
		return j.RunID, j.RunID != 0
	})
}
```
Conflicts:
models/issues/comment_list.go due to premature refactor in #3116
2024-04-16 11:49:44 +02:00
wxiaoguang
9b8de15797
Clean up log messages (#30313)
`log.Xxx("%v")` is not ideal, this PR adds necessary context messages.
Remove some unnecessary logs.

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 83f83019ef3471b847a300f0821499b3896ec987)

Conflicts:
	- modules/util/util.go
          Conflict resolved by picking `util.Iif` from 654cfd1dfbd3f3f1d94addee50b6fe2b018a49c3
2024-04-15 20:01:35 +02:00
erik
b878e74f76 Merge branch 'forgejo-federated-star' of codeberg.org:meissa/forgejo into forgejo-federated-star 2024-04-12 14:33:57 +02:00
erik
fb1d0df791 Also check for RepoID to be unique 2024-04-12 14:29:32 +02:00
Michael Jerger
37420442de unify copyright comment 2024-04-12 13:52:26 +02:00
erik
94091cc144 Don't use TEXT type 2024-04-09 16:40:09 +02:00
erik
6310e75d8d Update todo 2024-04-09 16:33:13 +02:00
erik
af0d0f7745 Merge branch 'forgejo' into forgejo-federated-star 2024-04-09 15:38:11 +02:00
erik
97343470bc Merge branch 'forgejo' into forgejo-federated-star 2024-04-09 10:42:42 +02:00
Earl Warren
7179ae8cc1 Merge pull request '[GITEA PORT] Do some performance optimize for issues list and view issue/pull (gitea#29515)' (#3116) from oliverpool/forgejo:port_29515 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3116
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-08 19:04:40 +00:00
Lunny Xiao
c9854bee98 Do some performance optimize for issues list and view issue/pull (gitea#29515)
This PR do some performance optimzations.

- [x] Add `index` for the column `comment_id` of `Attachment` table to
accelerate query from the database.
- [x] Remove unnecessary database queries when viewing issues. Before
some conditions which id = 0 will be sent to the database
- [x] Remove duplicated load posters
- [x] Batch loading attachements, isread of comments on viewing issue

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Conflicts:
models/issues/comment_code.go: function was renamed in Forgejo
models/migrations/migrations.go: migration already ported
2024-04-08 14:47:31 +02:00
JakobDev
a610e93cc9 Add fix and migration 2024-04-08 12:54:43 +02:00
JakobDev
613e5387c5 Count downloads for tag archives 2024-04-08 12:51:27 +02:00
Clemens
8d78c3edca make fmt 2024-04-04 15:12:41 +02:00
Clemens
92d011f1a5 fix some linting issues 2024-04-04 15:08:02 +02:00
Clemens
73cf1e3901 Revert "added repoUri to federationService"
This reverts commit 8cd89bf4d3.
2024-04-04 07:22:04 +02:00
Clemens
8cd89bf4d3 added repoUri to federationService
This does not work yet. APAPI url OR host and id have to be derived from repoUri.
2024-04-03 15:39:37 +02:00
Clemens
2b7a22afb3 renamed FederatedRepo to FollowingRepo 2024-04-03 12:26:33 +02:00
erik
daccaed157 Rename federatedRepo to followingRepo 2024-04-03 12:08:44 +02:00
0ko
2f38c2220f [I18N] Allow custom repo size format
Following https://codeberg.org/forgejo/forgejo/pulls/2528#issuecomment-1721846

- simplify the code
- allow to have custom format in translations
- provide proper Russian translation because test depends on it
2024-04-02 18:43:12 +05:00
0ko
29cc80d849 Provide a way to translate data units 2024-03-30 21:10:47 +05:00
Clemens
7f19247b0a Moved sendLikeActivities to federation_service 2024-03-28 14:27:50 +01:00
Clemens
1ad7bdf983 fixed tests
part1, one test still failing
2024-03-28 09:36:08 +01:00
Michael Jerger
d624ebb712 use doer coming from api 2024-03-28 08:13:00 +01:00
Michael Jerger
992fbf6898 comments 2024-03-28 07:44:22 +01:00
Michael Jerger
259c0202c7 fix test & add some review 2024-03-27 19:56:32 +01:00
erik
01e9853161 Add ToDo for storing federated repos
We need to check whether federated repos already exist in db. This way multiple repos on a server (forks) can have the same federated repos.
2024-03-26 16:54:55 +01:00
erik
436466dcad Check if federation enabled in StarRepo 2024-03-26 16:21:28 +01:00
erik
32d457f9a3 StarRepo Wrapper 2024-03-26 15:28:36 +01:00
Clemens
bbe5096307 fixed circular dependencies
next: fix post call error
2024-03-26 14:02:30 +01:00
Clemens
7f0371056e moved functionality
import of forgefed causes circular dependencies. This has to be solved!
2024-03-26 10:23:14 +01:00
Clemens
d251fc2611 set federatedRepoList into context 2024-03-26 08:28:22 +01:00
Michael Jerger
cf8a30efac mob-next: how to store port & schema 2024-03-26 07:58:04 +01:00
Michael Jerger
5b8173f660 do not return invalid result 2024-03-26 07:36:09 +01:00
erik
6d814447d0 Use Plural 2024-03-25 16:52:39 +01:00
erik
653ced5596 Validate before returning 2024-03-25 16:47:18 +01:00
erik
35d3fc199c Rename to StoreFederatedRepo* 2024-03-25 16:35:35 +01:00
erik
ca7d1c6f78 Localize error messages 2024-03-25 16:30:02 +01:00
Lunny Xiao
3b3747ffe8
Fix schedule tasks bugs (#28691)
Fix #28157

This PR fix the possible bugs about actions schedule.

- Move `UpdateRepositoryUnit` and `SetRepoDefaultBranch` from models to
service layer
- Remove schedules plan from database and cancel waiting & running
schedules tasks in this repository when actions unit has been disabled
or global disabled.
- Remove schedules plan from database and cancel waiting & running
schedules tasks in this repository when default branch changed.

(cherry picked from commit 97292da960)

Conflicts:
	modules/actions/github.go
	routers/web/repo/setting/default_branch.go
	routers/web/repo/setting/setting.go
	services/repository/branch.go
	services/repository/setting.go
	tests/integration/actions_trigger_test.go
2024-03-25 16:25:02 +01:00
Michael Jerger
828e7a76f6 use new table to populate settings 2024-03-25 09:15:32 +01:00
Michael Jerger
a9d18e5327 fixed issues, store now works 2024-03-23 17:01:25 +01:00