Commit graph

4153 commits

Author SHA1 Message Date
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
erik
566b3bc459 Parse Actor from star activity, Update function declaration order 2024-02-10 15:09:28 +01:00
erik
3a938b6c3f Use and validate source in ActorID struct 2024-02-10 15:09:28 +01:00
erik
9566e9bc5d Change tests to use IsValid method 2024-02-10 15:09:27 +01:00
erik
fccf5c37ca Add IsValid and PanicIfInvalid methods for ActorID 2024-02-10 15:09:26 +01:00
erik
8300d3fbde Add ToDos from code review 2024-02-10 15:09:25 +01:00
erik
91baf2be32 Add get functions for userId and HostAndPort 2024-02-10 15:09:23 +01:00
erik
92c089a4e2 Add a test for getting host and port 2024-02-10 15:09:23 +01:00
erik
8657f70960 Add todo 2024-02-10 15:09:21 +01:00
erik
5efce01f6f Make test messages consistent 2024-02-10 15:09:21 +01:00
erik
ad8adc880f Create easier to read tests for parser and validator 2024-02-10 15:09:20 +01:00
erik
62eae6564f Fix bug in validation 2024-02-10 15:09:20 +01:00
erik
d205c50a43 Implement generic validation on ActorID 2024-02-10 15:09:19 +01:00
erik
7b5d13a625 Split check for schema and host 2024-02-10 15:09:19 +01:00
erik
3d2b5115ad Implement and use Validatable interface 2024-02-10 15:09:18 +01:00
erik
235ed7cd1e Rename to actorID 2024-02-10 15:09:18 +01:00
Michael Jerger
fbff67f11a add some more todos 2024-02-10 15:09:09 +01:00
erik
5729cee3e5 Move test to model/activitypub 2024-02-10 15:09:07 +01:00
erik
78fc75135f Rename to ActorData 2024-02-10 15:09:04 +01:00
erik
09058c13c5 Rename to actor 2024-02-10 15:09:01 +01:00
erik
273ca49e22 Validate on ActorData independently and move to model 2024-02-10 15:08:58 +01:00
Earl Warren
094c84ed6d
Merge branch 'rebase-forgejo-dependency' into wip-forgejo 2024-02-05 18:58:23 +01:00
Earl Warren
d7e1854884
Merge branch 'rebase-forgejo-branding' into wip-forgejo 2024-02-05 18:58:18 +01:00
Earl Warren
030cdd6ae2
[GITEA] Allow changing the email address before activation (squash)
See https://codeberg.org/forgejo/forgejo/pulls/2300
2024-02-05 16:57:58 +01:00
Earl Warren
036f1eddc5
[GITEA] avoid superfluous synchronized pull_request run when opening a PR (#2236)
* Split TestPullRequest out of AddTestPullRequestTask
* Before scheduling the task, AddTestPullRequestTask stores the max
  index of the repository
* When the task runs, it does not take into account pull requests that
  have an index higher than the recorded max index

When AddTestPullRequestTask is called with isSync == true, it is the
direct consequence of a new commit being pushed. Forgejo knows nothing
of this new commit yet. If a PR is created later and its head
references the new commit, it will have an index that is higher and
must not be taken into account. It would be acting and triggering a
notification for a PR based on an event that happened before it
existed.

Refs: https://codeberg.org/forgejo/forgejo/issues/2009
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2236
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
(cherry picked from commit b3be895a30)
2024-02-05 16:57:58 +01:00
Gergely Nagy
2ca4862f8b
[GITEA] Allow changing the repo Wiki branch to main
Previously, the repo wiki was hardcoded to use `master` as its branch,
this change makes it possible to use `main` (or something else, governed
by `[repository].DEFAULT_BRANCH`, a setting that already exists and
defaults to `main`).

The way it is done is that a new column is added to the `repository`
table: `wiki_branch`. The migration will make existing repositories
default to `master`, for compatibility's sake, even if they don't have a
Wiki (because it's easier to do that). Newly created repositories will
default to `[repository].DEFAULT_BRANCH` instead.

The Wiki service was updated to use the branch name stored in the
database, and fall back to the default if it is empty.

Old repositories with Wikis using the older `master` branch will have
the option to do a one-time transition to `main`, available via the
repository settings in the "Danger Zone". This option will only be
available for repositories that have the internal wiki enabled, it is
not empty, and the wiki branch is not `[repository].DEFAULT_BRANCH`.

When migrating a repository with a Wiki, Forgejo will use the same
branch name for the wiki as the source repository did. If that's not the
same as the default, the option to normalize it will be available after
the migration's done.

Additionally, the `/api/v1/{owner}/{repo}` endpoint was updated: it will
now include the wiki branch name in `GET` requests, and allow changing
the wiki branch via `PATCH`.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit d87c526d2a)
2024-02-05 16:57:47 +01:00
Earl Warren
209610075a
[TESTS] add log.Level to test.NewLogChecker
So the caller can check log events at the desired level instead of
being limited to the default level log.INFO

(cherry picked from commit 2fbf5f9555)
(cherry picked from commit e2137a3147)
2024-02-05 16:54:44 +01:00
Gusted
6fb55e9c08
[GITEA] Add slow SQL query warning (squash) Fix setting typo
- Fix typo in the slow query threshold setting, add a deprecation warning.
- Resolves #2203

(cherry picked from commit 02f6608e5f)
(cherry picked from commit 4e8f6b2ffd)
2024-02-05 16:54:44 +01:00
Earl Warren
fe8622dae3
Revert "Fix schedule tasks bugs (#28691)"
This reverts commit 97292da960.

(cherry picked from commit 83e5eba031)
(cherry picked from commit f6ef8f3819)

Conflicts:
	services/repository/setting.go
2024-02-05 16:54:42 +01:00