Commit graph

1391 commits

Author SHA1 Message Date
erik
97343470bc Merge branch 'forgejo' into forgejo-federated-star 2024-04-09 10:42:42 +02:00
erik
33c60ebdff Add logging 2024-04-05 17:06:57 +02:00
Michael Jerger
e2b11b93bc Merge branch 'forgejo-federated-star' of codeberg.org:meissa/forgejo into forgejo-federated-star 2024-03-28 15:21:40 +01:00
Michael Jerger
fc8e2b3f8a Merge branch 'forgejo-federated-star' of codeberg.org:meissa/forgejo into forgejo-federated-star 2024-03-28 15:05:35 +01:00
Michael Jerger
4d5c8b5563 refactor services 2024-03-28 15:00:55 +01: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
erik
04f907c8c8 Revert 2024-03-26 15:28:55 +01:00
erik
b2105de36f SendLikeActivity to api
It might not be a good idea to start a possibly long lasting http call during a running DB transaction. I.E. in the case of failing transaction we already sent some data into the world which might not be valid.
2024-03-26 14:39:25 +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
Michael Jerger
9ccad50b05 review 2024-03-22 07:52:03 +01:00
erik
3e6eb255b3 WIP Initial, naive implementation of sending stars to fed repos
Currently no rate limits are respected
The mechanisms to use the Federated repo table need to be used
2024-03-21 16:29:13 +01:00
erik
42a41ce2bc Remove todo 2024-03-21 14:42:16 +01:00
Gusted
42ae3d3d81
[BUG] Fix header name in swagger response
- This was incorrectly copied from the `swaggerCommitList` struct, which
on the other hand does set `X-Total`, but the API handler that uses this
response only sets `X-Total-Count`.
2024-02-29 14:08:10 +01:00
Earl Warren
2855727c85 Merge pull request 'Disabling Stars should disable the routes too' (#2471) from algernon/forgejo:stars/disable-routes into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2471
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-27 21:24:25 +00:00
oliverpool
e154655c87 fix missing argument 2024-02-27 18:35:43 +00:00
Jimmy Praet
f95fb8cc44 Add attachment support for code review comments (#29220)
Fixes #27960, #24411, #12183

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-27 18:35:43 +00:00
qwerty287
1608ef0ce9
Add API to get merged PR of a commit (#29243)
Adds a new API `/repos/{owner}/{repo}/commits/{sha}/pull` that allows
you to get the merged PR associated to a commit.

---------

Co-authored-by: 6543 <6543@obermui.de>
(cherry picked from commit 0a426cc575734e5eff410d6a790f40473117f753)
2024-02-26 22:30:26 +01:00
Lunny Xiao
6905540088
Use the database object format name but not read from git repoisitory everytime and fix possible migration wrong objectformat when migrating a sha256 repository (#29294)
Now we can get object format name from git command line or from the
database repository table. Assume the column is right, we don't need to
read from git command line every time.

This also fixed a possible bug that the object format is wrong when
migrating a sha256 repository from external.

<img width="658" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/6e9a9dcf-13bf-4267-928b-6bf2c2560423">

(cherry picked from commit b79c30435f439af8243ee281310258cdf141e27b)

Conflicts:
	routers/web/repo/blame.go
	services/agit/agit.go
	context
2024-02-26 22:30:26 +01:00
6543
8ff858b94b
Start to migrate from util.OptionalBool to optional.Option[bool] (#29329)
just create transition helper and migrate two structs

(cherry picked from commit 7fbdb60fc1152acc9a040dc04b1b0f5a3475b081)
2024-02-26 22:30:26 +01:00
vincent
fb137d1e49
Fix content size does not match error when uploading lfs file (#29259)
![image](https://github.com/go-gitea/gitea/assets/38434877/cd726b4d-4771-4547-8aee-ae4e4b56b1d1)
When we update an lfs file by API
`api/v1/repos/{owner}/{repo}/contents/{filepath}`, there will show an
error

```json
{
  "message": "Put \"05904d6c7b\": readfrom tcp [::1]:57300->[::1]:9000: content size does not match",
  "url": "http://localhost:3000/api/swagger"
}
```

The reason of this error is
https://github.com/go-gitea/gitea/blob/main/services/repository/files/update.go,
in this file, the `file.ContentReader` been used twice. So when use
`file.ContentReader` in the second time, the `i` of this Reader has been
updated to the length of the content. it will return 0 and an `io.EOF`
error when we try to read cotent from this Reader.

(cherry picked from commit 35d5e4aea4bb02a0b4c7b38ecb2acf612151e891)
2024-02-26 21:42:14 +01:00
Gergely Nagy
0b4a9c4ec2
Disabling Stars should disable the routes too
Similarly to how `[repository].DISABLE_FORKS` works, lets make
`[repository].DISABLE_STARS` disable the routes too, not just hide the
functionality from the UI.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-26 20:50:32 +01:00
qwerty287
feb189554e
Add API to get PR by base/head (#29242)
Closes https://github.com/go-gitea/gitea/issues/16289

Add a new API `/repos/{owner}/{repo}/pulls/{base}/{head}` to get a PR by
its base and head branch.
2024-02-26 03:41:42 +01:00
Gergely Nagy
0ea021c8c9
Allow instance-wide disabling of forking
For small, personal self-hosted instances with no user signups, the fork
button is just a noise. This patch allows disabling them like stars can
be disabled too.

Disabling forks does not only remove the buttons from the web UI, it
also disables the routes that could be used to create forks.

Fixes #2441.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-25 12:00:17 +01:00
wxiaoguang
81925ebb0c
Refactor more code in templates (#29236)
Follow #29165.

* Introduce JSONTemplate to help to render JSON templates
* Introduce JSEscapeSafe for templates. Now only use `{{ ... |
JSEscape}}` instead of `{{ ... | JSEscape | Safe}}`
* Simplify "UserLocationMapURL" useage

(cherry picked from commit 31bb9f3247388b993c61a10190cfd512408ce57e)
2024-02-19 22:58:32 +01:00
wxiaoguang
65248945c9
Refactor locale&string&template related code (#29165)
Clarify when "string" should be used (and be escaped), and when
"template.HTML" should be used (no need to escape)

And help PRs like  #29059 , to render the error messages correctly.

(cherry picked from commit f3eb835886031df7a562abc123c3f6011c81eca8)

Conflicts:
	modules/web/middleware/binding.go
	routers/web/feed/convert.go
	tests/integration/branches_test.go
	tests/integration/repo_branch_test.go
	trivial context conflicts
2024-02-16 15:20:52 +01:00
Chris Copeland
83123b493f
Add merge style fast-forward-only (#28954)
With this option, it is possible to require a linear commit history with
the following benefits over the next best option `Rebase+fast-forward`:
The original commits continue existing, with the original signatures
continuing to stay valid instead of being rewritten, there is no merge
commit, and reverting commits becomes easier.

Closes #24906
2024-02-14 17:19:19 +01:00
Clemens
2e41fe0a46 fix import 2024-02-12 13:00:47 +01:00
Michael Jerger
6e6813a88b make operatorid unique 2024-02-10 15:23:04 +01:00
Michael Jerger
eecb9b8040 fmt fix 2024-02-10 15:22:30 +01:00
Michael Jerger
3ef57385ec fix linting 2024-02-10 15:21:22 +01:00
Michael Jerger
b2cc848e7d clean up aliases 2024-02-10 15:20:48 +01:00
Michael Jerger
91f7541add refactor for semantic and cycle free deps 2024-02-10 15:20:17 +01:00
Michael Jerger
66bc7a9a0c Search federatedUser instead of loginName 2024-02-10 15:20:09 +01:00
Michael Jerger
edf7f61b83 mv federated_user_creation to user package 2024-02-10 15:19:55 +01:00
Michael Jerger
a702da69cc added test for federated user 2024-02-10 15:19:40 +01:00
Michael Jerger
a1ca7e958a use local fqdn for generated user email 2024-02-10 15:19:09 +01:00
Michael Jerger
c58a995fb2 refactor FederationInfo -> FederationHost 2024-02-10 15:18:56 +01:00
Michael Jerger
1b35bd2911 lint fix 2024-02-10 15:18:46 +01:00
Michael Jerger
c4eb763f4a lint fix 2024-02-10 15:18:45 +01:00
Michael Jerger
ca5eaa8c6b introduce FI Factory 2024-02-10 15:18:43 +01:00
Michael Jerger
dabd773f6b Fix error handling & add timestamp check 2024-02-10 15:18:43 +01:00
Michael Jerger
40ec049013 add the next todo 2024-02-10 15:18:42 +01:00
Clemens
1f989f2ecd Added FederationInfo Create function 2024-02-10 15:18:41 +01:00
Michael Jerger
380d3db0bf integrate federation info in api call 2024-02-10 15:18:40 +01:00
bom
87bfa79f71 Configure client against DOS 2024-02-10 15:18:25 +01:00
Michael Jerger
ecf391dcbf add some user creation unittests 2024-02-10 15:17:24 +01:00
Michael Jerger
de2569618c fix: wmail should start with char 2024-02-10 15:17:23 +01:00