Commit graph

4182 commits

Author SHA1 Message Date
6543
f796548225
Workaround to clean up old reviews on creating a new one (#28554)
close  #28542

blocks  #28544

---
*Sponsored by Kithara Software GmbH*

(cherry picked from commit 217d71c48a10265e08b95cc961656b921f61f9ff)

Conflicts:
	tests/integration/api_pull_review_test.go
	context
2024-02-26 21:42:14 +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
FuXiaoHei
c551d3f3ab
Artifact deletion in actions ui (#27172)
Add deletion link in runs view page.
Fix #26315

![image](https://github.com/go-gitea/gitea/assets/2142787/aa65a4ab-f434-4deb-b953-21e63c212033)

When click deletion button. It marks this artifact `need-delete`.

This artifact would be deleted when actions cleanup cron task.
2024-02-23 09:06:14 +01:00
Earl Warren
726ce5e3f9 Merge pull request '[BUG] Load AllUnitsEnabled when necessary' (#2420) from gusted/forgejo-add-more into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2420
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-21 13:25:38 +00:00
Michael Kriese
849de07064 feat(xorm): add max idle time setting for db connections (#2418)
Add a new optional `CONN_MAX_IDLETIME`[^1]

This allows to set the `SetConnMaxIdleTime` on `database/sql`.
It's useful to allow to close more idle connections to reduce database connections, especially on postgresql.
For me i would like to use it to set a higher max idle connections but they will all be closed after being idle.
So also the last idle connection will be closed when there is no load on forgejo.
I also use it with max connection lifetime, because currently `database/sql` doesn't detect a postgresql master change[^2] and i'll get `[E] can't update runner status: pq: cannot execute UPDATE in a read-only transaction`[^3] on forgejo until the connection is closed.

[^1]: https://pkg.go.dev/database/sql#DB.SetConnMaxIdleTime
[^2]: https://stackoverflow.com/questions/51858659/how-to-safely-discard-golang-database-sql-pooled-connections-for-example-when-t
[^3]: https://matrix.to/#/!zpNKWqkiEOyljSMQDK:matrix.org/$_AJft_amsGn5hXGOYw75JoBJQnW3aKJEpb-Iw53L_TU?via=schinas.net&via=matrix.org&via=nitro.chat

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2418
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
2024-02-21 12:17:16 +00:00
Gusted
6fbfe441de
[BUG] Load AllUnitsEnabled when necessary
- In order to determine if the "Add more..." tab should be shown, the
template has to know if the repository has all units enabled, this is
done in the repository header which can be shown for quite a lot of
pages (code, issues, projects, actions etc.)
- This was previously set in the `RepoRefByType` function, which would
be called by pages such as code, issues and releases, but it was not
being called for all pages such as actions, packages and wiki. Which
would in turn incorrectly show the "Add more..." button when it
shouldn't.
- Now call it from the template itself, so the value is 'always' loaded
when necessary.
2024-02-21 12:48:26 +01:00
yp05327
78f6b29248
Fix gitea-action user avatar broken on edited menu (#29190)
Fix #29178

(cherry picked from commit 8e2831611c06e84dd8fedf7a0b2cce9f98d4188f)
2024-02-17 23:24:31 +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
KN4CK3R
52ef33b931
Remove unused KeyID. (#29167)
`KeyID` is never set.

(cherry picked from commit 155269fa586c41a268530c3bb56349e68e6761d7)

Conflicts:
	models/user/email_address.go
	trivial context conflict
2024-02-16 15:20:52 +01:00
KN4CK3R
6eaabb1a9d
Use ghost user if user was not found (#29161)
Fixes #29159

(cherry picked from commit 37061e8266806c0b2b66ac64138e725632b295db)
2024-02-16 15:20:52 +01:00
oliverpool
0fc61c8836 [BUG] split code conversations in diff tab (#2306)
Follow-up of #2282 and #2296 (which tried to address #2278)

One of the issue with the previous PR is that when a conversation on the Files tab was marked as "resolved", it would fetch all the comments for that line (even the outdated ones, which should not be shown on this page - except when explicitly activated).

To properly fix this, I have changed `FetchCodeCommentsByLine` to `FetchCodeConversation`. Its role is to fetch all comments related to a given (review, path, line) and reverted my changes in the template (which were based on a misunderstanding).

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2306
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: oliverpool <git@olivier.pfad.fr>
Co-committed-by: oliverpool <git@olivier.pfad.fr>
2024-02-16 12:16:11 +00:00
Earl Warren
c8b177713a
[CLEANUP] make golangci-lint@v1.56.1 happy 2024-02-15 16:19:36 +01:00
6543
e9e6c6152e
Dont load Review if Comment is CommentTypeReviewRequest (#28551)
RequestReview get deleted on review.
So we don't have to try to load them on comments.

broken out #28544

(cherry picked from commit 6fad2c874438275d3f69bb1cc223708bd2d27ff6)
2024-02-14 21:44:25 +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
Earl Warren
05eaf1cf3e Merge pull request 'Repository settings refactor' (#2221) from algernon/forgejo:repo-units/ui-refactor into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2221
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
2024-02-14 13:29:04 +00:00
Gergely Nagy
e07b0e75ff
Add a direct link from repo header to unit settings
If a repository administrator is viewing a repository, and there are
units that can be enabled, display an "Add more..." link that leads to
the repository unit settings page.

The goal here is to allow instances to configure a small set of repo
units to be enabled by default, but also highlight for repo admins that
they can add more.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-13 22:42:09 +01:00
Clemens
db2f896264 small fix by adding id as pk for FederatedUser 2024-02-13 11:09:31 +01:00
Gusted
cbbcfdd400
[FEAT] Don't log context cancelled SQL errors
- I found this while doing some unrelated testing in Forgejo. It wasn't
my intention to log failed SQL queries if they were cancelled (which can
happen quite frequently for larger instances) as in those cases it's not
interesting to know which SQL query was run. My intentation was only to
log an SQL query if there was an error reported by the database.
- Ref #2140
2024-02-12 23:11:50 +01:00
Michael Jerger
181d743a8a update copyright 2024-02-12 10:14:29 +01:00
Gwyneth Morgan
9a1d5c549c
[gitea] Drop "@" from email sender to avoid spam filters (#29109)
Commit 360b3fd17c (Include username in email headers (#28981),
2024-02-03) adds usernames to the From field of notification emails in
the form of `Display Name (@username)`, to prevent spoofing. However,
some email filtering software flags "@" in the display name part of the
From field as potential spoofing, as you could set the display name part
to another email address than the one you are sending from (e.g.
`From: "apparent@email-address" <actual@email-address>`). To avoid
being flagged, instead send emails from `Display Name (username)`.

Closes: #29107

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 5b2fd0fc19a2a77414c8e2989b4794b6617221f5)
2024-02-11 13:47:44 +01:00
Michael Jerger
6d17f45986 fix misspell 2024-02-10 15:22:38 +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
3b244d673b small fixes 2024-02-10 15:21:17 +01:00
Michael Jerger
e733809ef2 symetric handling for value/reference 2024-02-10 15:20:33 +01:00
Michael Jerger
d2d5e84977 federated user is not entity - so no need for ID 2024-02-10 15:20:26 +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
e44be72251 Add tx around user creation 2024-02-10 15:20:01 +01:00
Michael Jerger
edf7f61b83 mv federated_user_creation to user package 2024-02-10 15:19:55 +01:00
Clemens
e180467760 added user creation from ap 2024-02-10 15:19:47 +01:00
Michael Jerger
a702da69cc added test for federated user 2024-02-10 15:19:40 +01:00
Clemens
67f3f66be4 Created FederatedUser 2024-02-10 15:19:36 +01:00
Michael Jerger
5a7f6f15a6 ensure federation info fqdn to lowercase 2024-02-10 15:19:08 +01:00
Michael Jerger
c58a995fb2 refactor FederationInfo -> FederationHost 2024-02-10 15:18:56 +01:00
Michael Jerger
0453598e3d add some todos 2024-02-10 15:18:51 +01:00
Michael Jerger
0ddc2db46a mitigate Block by future StartTime 2024-02-10 15:18:46 +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
9a9ac33766 lint fix 2024-02-10 15:18:44 +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
Clemens
7d30d14c76 breaking struct adjustment 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
Clemens
52400f7978 Added FederationInfo get methods for repository 2024-02-10 15:18:37 +01:00
Michael Jerger
bbccc24ed1 test federationinfo validation 2024-02-10 15:18:32 +01:00
Michael Jerger
c67be3b668 start work on federationinfo 2024-02-10 15:18:29 +01:00
Michael Jerger
8610d94af8 start work on federationinfo 2024-02-10 15:18:29 +01:00
Michael Jerger
6e46739090 validate person 2024-02-10 15:17:14 +01:00
Michael Jerger
0505baab2b ad validation for like activity 2024-02-10 15:17:13 +01:00
Michael Jerger
3ab2d9a449 rename star -> ForgeLike 2024-02-10 15:17:12 +01:00
Michael Jerger
4473fb788a start refactoring star->like 2024-02-10 15:17:11 +01:00
Michael Jerger
38438b592f rebase conflicts to fix 2024-02-10 15:17:10 +01:00
Michael Jerger
8116214727 introduce nodeinfo 2024-02-10 15:17:07 +01:00
bom
310d740cee Start NodeInfo implementation 2024-02-10 15:17:05 +01:00
Michael Jerger
3c2493902d adjust to ugly linting 2024-02-10 15:17:05 +01:00
Michael Jerger
e704e5adcc adjust to ugly linting 2024-02-10 15:17:04 +01:00
erik
1e40b814a1 Linting 2024-02-10 15:17:03 +01:00
erik
8585edc47a Linting 2024-02-10 15:17:03 +01:00
Michael Jerger
a64ce2feb1 removed resolved todos 2024-02-10 15:17:02 +01:00
erik
2e031a9763 WIP Generic IsValid for *Id structs 2024-02-10 15:17:01 +01:00
erik
e69e5df089 Assume validated url.URL for NewActorID 2024-02-10 15:17:00 +01:00
Michael Jerger
6e4467d49d experiment on generalization 2024-02-10 15:16:59 +01:00
erik
75cc5b900d Add review todo 2024-02-10 15:16:59 +01:00
erik
1dd3084f66 Split test according to actor.go 2024-02-10 15:16:58 +01:00
erik
c887bddb72 Attempt generalization of Id creation 2024-02-10 15:16:57 +01:00
erik
0378b2dc7d Add questions for review discussion 2024-02-10 15:16:36 +01:00
Michael Jerger
1704ac5bc2 fix most of the tests 2024-02-10 15:14:35 +01:00
Michael Jerger
e1d7db178c unify logging & minor improvements 2024-02-10 15:14:31 +01:00
Michael Jerger
3172eb69d2 introduce RepositoryId 2024-02-10 15:14:08 +01:00
Michael Jerger
1fe35e14a5 mv our actor code to forgefed 2024-02-10 15:14:07 +01:00
Michael Jerger
abdf56dde1 move forgefed to models 2024-02-10 15:14:06 +01:00
Michael Jerger
184388015d added more tests 2024-02-10 15:10:39 +01:00
Michael Jerger
b5a467e94d remove unused & implement webfinger 2024-02-10 15:10:38 +01:00
Michael Jerger
e8371ca94c ActorId -> PersonId 2024-02-10 15:10:37 +01:00
Michael Jerger
3151c8fe81 make validate more compact 2024-02-10 15:10:37 +01:00
Michael Jerger
be4d3544ae Refactor ActorID -> ActorId 2024-02-10 15:10:36 +01:00
Michael Jerger
afcc7f0def factory instead of parse & validate 2024-02-10 15:10:35 +01:00
erik
3c515c2614 Add review todos 2024-02-10 15:10:33 +01:00
erik
6ad52a6d67 Update tests 2024-02-10 15:10:24 +01:00
erik
25d34e0c14 Check for empty path in IRI 2024-02-10 15:10:22 +01:00
erik
fa1acd1ebb Extract url string validation and parsing from ActorID parsing 2024-02-10 15:10:19 +01:00
erik
4d3ab4dda2 Update Validate() 2024-02-10 15:10:19 +01:00
erik
39d4c8dd2d Generalize validate_is_not_empty 2024-02-10 15:10:17 +01:00
erik
085db0c127 Remove todo 2024-02-10 15:10:16 +01:00
Michael Jerger
28a290da10 reviewed current work 2024-02-10 15:10:13 +01:00
erik
02dc8901af Fix tests 2024-02-10 15:10:13 +01:00
erik
68cd621053 Test for empty string 2024-02-10 15:10:12 +01:00
erik
946e5cf34c Remove typo in func 2024-02-10 15:10:10 +01:00
erik
c0f1681fa3 Allow parsing of repository-id too 2024-02-10 15:10:09 +01:00
erik
4f25e5057a Make the source an argument to the parser 2024-02-10 15:10:08 +01:00
erik
52e950a492 Check the path for empty strings 2024-02-10 15:10:06 +01:00
erik
65f7124c67 Use u.Hostname() instead of u.Host
u.Host returns hostname:port.
2024-02-10 15:10:05 +01:00
erik
27c9db1027 Better function descriptions 2024-02-10 15:10:05 +01:00
Michael Jerger
9b5d8bbeda If we use user.loginname to store the actor.id we can search for local users earlier 2024-02-10 15:10:04 +01:00
erik
fde8de4f90 Rename to ParseActorIDFromStarActivity 2024-02-10 15:09:35 +01:00
erik
ede86df685 Remove todo 2024-02-10 15:09:34 +01:00
erik
8a53331283 Add ToDo 2024-02-10 15:09:30 +01:00
erik
9568eab62a Fix tests 2024-02-10 15:09:29 +01:00