Commit graph

924 commits

Author SHA1 Message Date
fr33domlover
de51fb9ab5 C2S: offerTicketC: If origin provided but not bundle, generate patches from git
For now it's implemented only for Git:

If tracker is a local loom, and a (local or remote) origin repo is specified,
but no patches are provided, then generate them ourselves!

* Clone the (local) target repo
* Add the (local or remote) origin repo as a git remote
* Make sure target branch is an ancestor of the origin branch
* Generate patches for the commits that origin adds on top of target
* Insert them into our DB
2022-09-22 17:12:37 +00:00
fr33domlover
2e7c5f767c Add 'cloneUri' to AP.Repo, publish in getRepoR, grab in offerTicketC
In offerTicketC it can be used for fetching commits from the remote origin
repo, by knowing its clone URI

Only HTTP clone URIs are supported for now, because it's enough for finishing
the federated MR implementation. Apparently user@host:path isn't a valid URI
and I'll later add a parser for that
2022-09-22 06:02:14 +00:00
fr33domlover
e7ab9e701c C2S: offerTicketC: Add VCS-type and patch-type consistency checks 2022-09-21 17:45:38 +00:00
fr33domlover
23b5343ec2 C2S: Enable offerTicketC for person inbox post handler 2022-09-21 14:22:36 +00:00
fr33domlover
de2e29d505 C2S: offerTicketC re-enabled and supporting looms and remote origin repo
What's missing:

- Match patch VCS, origin repo VCS and target repo VCS
- Hook into postPersonInboxR
- If only origin is provided, generate patches / otherwise somehow remember the
  commits proposed
2022-09-21 12:50:26 +00:00
fr33domlover
0b10056cc3 UI: getClothR: If a Bundle exists in DB, display list of its patches 2022-09-19 12:02:48 +00:00
fr33domlover
ffe68390e5 UI: getBundleR: Display list of old versions and list of patches 2022-09-19 11:40:08 +00:00
fr33domlover
dae8554a12 UI: getPatchR: Display diff-syntax-highlighted patch content file 2022-09-19 11:00:47 +00:00
fr33domlover
5673340bd1 UI: Display origin and target repos in getClothR HTML 2022-09-18 17:37:25 +00:00
fr33domlover
9906231d04 DB, Web: Allow origin repo for Cloths, mention in getClothR JSON 2022-09-18 15:55:42 +00:00
fr33domlover
9deba96cf2 UI: Serve HTML in getClothR, copied from getTicketR 2022-09-18 07:44:00 +00:00
fr33domlover
1e2b3d2006 UI: HTML version for getLoomClothsR, copied from getDeckTicketsR 2022-09-17 19:17:11 +00:00
fr33domlover
1db56ced39 UI: Re-enable ticket page, some pieces still missing, mostly buttons 2022-09-17 17:42:04 +00:00
fr33domlover
e69d775f3f UI: Fix and re-enable deck ticket list view 2022-09-17 10:14:27 +00:00
fr33domlover
c495d78d05 C2S, UI: Loom creation and Repo linking to a Loom
RepoSourceR, for a repo that doesn't have a loom, lists looms that want to
serve that repo with buttons for bidirectionally linking the repo to a loom

Once linked, the repo navbar has a Patches/MRs link pointing to the LoomClothsR
of the linked Loom
2022-09-17 08:31:22 +00:00
fr33domlover
1c8c6d9d24 UI: In RepoSourceR page, mention SSH clone address 2022-09-16 14:04:24 +00:00
fr33domlover
40f741e504 UI: Fix and re-enable getRepoSourceR (repo content file/dir browsing) 2022-09-16 13:47:10 +00:00
fr33domlover
b66bab4295 UI: Fix and re-enable getRepoCommitsR (i.e. repo history view) 2022-09-16 12:46:52 +00:00
fr33domlover
91cdbf51ab UI: Fix and re-enable getRepoCommitR 2022-09-16 11:41:58 +00:00
fr33domlover
e78f043f49 C2S & UI: Allow creation of a new Repo 2022-09-16 10:34:44 +00:00
fr33domlover
8ec98e2a59 S2S: Invite->Accept->Grant (for Repo, Deck, Loom and Person, not for Group)
Person inbox handler:
    - Invite: Parse and insert to inbox
    - Grant: Parse and insert to inbox

Repo/Deck/Loom inbox handler:
    - Invite: Parse and remember as Collab record in DB for later
    - Accept: Send a Grant (and remember it in DB)

Along with inviteC and acceptC, the Invite->Accept->Grant flow is now fully
federated, yay!

What's missing is UI for actually using it. Coming soon.
2022-09-08 12:00:14 +00:00
fr33domlover
00a39475eb S2S: Prepare inbox handler for Group as well 2022-09-06 17:41:09 +00:00
fr33domlover
9dddc7d846 S2S: Prepare inbox handlers for Repo, Deck and Loom 2022-09-06 10:52:14 +00:00
fr33domlover
cdcf3a3326 Control.Applicative.Local: Rename parameter to avoid confusing name shadowing 2022-09-05 16:27:21 +00:00
fr33domlover
5a6ae76b76 Add missing signature to function in Vervis.RemoteActorStore
There are many more missing, but... just felt like fixing a warning :)
2022-09-05 16:25:59 +00:00
fr33domlover
ac867e56f2 S2S: Switch from Grant->Accept->Enable to Invite->Accept->Grant
Giving access now starts with an Invite activity, followed by Accept from the
Invite's recipient. Finally, the resource sends a Grant, which is the actual
OCap.
2022-09-05 16:19:52 +00:00
fr33domlover
0d96ee0775 DB: Add CollabTopicLocalReceive and CollabRecipLocalReceive tables
I was going to link the matching Accept tables to them, but then switched to
the Invite-Accept-Grant model and going to implement it in the next patches. So
I'm committing these new tables just in case I decide to revert to the current
model.
2022-09-01 17:44:43 +00:00
fr33domlover
4269385e15 DB: Add received::UTCTime field to InboxItem
To record *when* an activity, local or remote, was inserted into the specific
inbox. I'm surprised I haven't been keeping that data until now :P
2022-09-01 11:21:31 +00:00
fr33domlover
dd0bdaa742 S2S: Implement preparation and generic steps in person inbox post handler
The steps are:

- Parse activity ID and match with the authenticated sender
- For local activity (we got via forwarding), find in DB
- For remote activity, cache in DB
- Insert activity to recipient's inbox

What's not there yet is the actual logic of handling specific activities.
2022-08-31 13:01:04 +00:00
fr33domlover
b0576f9bf6 DB: Separate tables for CollabTopicLocalAccept and CollabTopicRemoteAccept
Previously there was just CollabTopicAccept, which worked only for local topics
but pretended to apply to both, due to directly pointing to Collab, thus
possible to insert rows even if there's a CollabTopicRemote.

The new situation is a new CollabTopicLocal table to which the local topic
things point, thus keeping the local and remote data separate and difficult to
confuse.
2022-08-30 08:28:44 +00:00
fr33domlover
9e6eb9bec6 Support delivery to Group followers collection 2022-08-29 21:41:13 +00:00
fr33domlover
b7eb7a17d2 C2S: Implement acceptC, allowing people to accept Grants given to them 2022-08-29 20:56:30 +00:00
fr33domlover
e8ed2d5f24 Remove accidental trailing space 2022-08-29 20:55:02 +00:00
fr33domlover
d741d0e918 C2S: grantC: Insert Collab records for Grants with remote topics too 2022-08-28 13:51:43 +00:00
fr33domlover
06c520f6aa C2S: Implement grantC and enable in person outbox handler 2022-08-22 16:59:22 +00:00
fr33domlover
158ad789ec C2S: In automatic Grant upon Deck creation, insert CollabTopicAccept record
Since that table being added, a Collab without a CollabTopicAccept is
considered an open proposal/invitation waiting for completion. So inserting the
CollabTopicAccept is now required for making the Grant valid and active.
2022-08-21 18:15:44 +00:00
fr33domlover
10645bf02b DB: Add Collab tables for recording Recip's and Topic's Accept activities 2022-08-21 18:10:03 +00:00
fr33domlover
0bd7568ca5 ActivityPub: Move 'fulfills' property from Grant type to Activity type 2022-08-16 14:55:21 +00:00
fr33domlover
26ec6527e2 Client, UI: Form for creating a new Deck 2022-08-16 13:17:26 +00:00
fr33domlover
a12409548f C2S: Enable creation of new decks, with automatic Grant and Follow 2022-08-15 20:21:10 +00:00
fr33domlover
87bb369120 ActivityPub: Add a PatchTracker actor type 2022-08-15 18:22:46 +00:00
fr33domlover
2e72684fd5 Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:

- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
  i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
  common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
  are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
  which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
  code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
  so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
  I haven't tested them yet on a read DB so there may be errors there; I'll fix
  them in the next patches if I find any (probably going to test on the main
  instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
  and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
  for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
  removed, I haven't removed them; that's because I wonder if at some point
  users can have a tree of inboxes much like in email; I don't have an excuse
  for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
  figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
  they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
fr33domlover
91b2d36a19 Move models and routes files from config/ to new th/ dir 2022-07-25 18:40:36 +00:00
fr33domlover
066285d3a3 Move robots.txt and favicon from config/ to new embed/ dir 2022-07-25 17:40:19 +00:00
fr33domlover
b3cd7ca28f C2S: Implement ticket tracker creation
* Publish a Create activity and respond with a Grant activity
* postProjectsR reuses that code
* No automatic following at the moment
* Workflow and role specified in new project form are ignored for now
* Can't create tracker under a group yet, just under the user
2022-07-25 17:15:22 +00:00
fr33domlover
3cda2205c5 Web.ActivityPub: Remove fake extContext, the URI doesn't work anymore anyway 2022-07-25 09:10:24 +00:00
fr33domlover
e2591734d3 Web.ActivityPub: Update representation of actor and project
Ugh, that module is such a horrible mess... I hope to turn it soon into
something sane. Is there some generic non-clumsy way restructure the AP
parser/encoder API?

For now, making these ugly changes to support the represenation of
Create {TicketTracker}, which I'm about to implement.
2022-07-24 16:52:28 +00:00
fr33domlover
88b8027572 DB: Move project inbox, outbox & followers into a new Actor table 2022-07-19 12:12:49 +00:00
fr33domlover
86b35e9b56 Style: Replace yesod favicon with Vervis icon made by ikomi (thanks <3) 2022-07-12 14:08:37 +00:00
fr33domlover
b18c0cb255 C2S: applyC: Implement the missing support for patching Git repos 2022-06-26 14:15:52 +00:00
fr33domlover
8186e64a26 S2S: repoApplyF: Implement the missing support for patching Git repos 2022-06-26 14:00:28 +00:00
fr33domlover
a6e4587281 Raise build-time error on incomplete patterns
I realized I never intend to leave patterns (e.g. pattern matching in a 'case'
clause) incomplete, i.e. some cases left missing. When I do that it means I
forgot, and I'd like GHC to highlight it by raising an error instead of just
warning. Vervis has lots of warnings so it's hard to detect among them.

I suppose in other kinds of software people sometimes leave incomplete patterns
intentionally / are okay with a runtime exception being thrown? In a web
application, I definitely want to handle all cases, and be in control of how
errors are handled and displayed in UI.
2022-06-26 13:54:37 +00:00
fr33domlover
842f27f515 C2S: Implement applyC, works only for Darcs right now 2022-06-25 19:59:26 +00:00
fr33domlover
61b9710e38 S2S: repoApplyF: Support local sharer-hosted proposals 2022-06-24 05:39:24 +00:00
fr33domlover
02734d02f2 S2S: repoApplyF: Support local repo-hosted proposals 2022-06-24 05:02:54 +00:00
fr33domlover
c3ff3c40eb S2S: repoApplyF, for now only on remotely hosted patches 2022-06-23 09:09:02 +00:00
fr33domlover
bc7806b100 In migration code, rename Apply to Run to avoid confusion with Apply activity 2022-06-22 07:45:35 +00:00
fr33domlover
1e759698c1 Web.ActivityPub: Add capability URI field to Activity type 2022-06-22 07:39:38 +00:00
fr33domlover
bfa9774f83 DB: Switch to more flexible collaborator model 2022-06-22 06:19:37 +00:00
fr33domlover
bf2e172f6e C2S: addBundleC for adding a new patch bundle version to a Ticket 2020-09-13 12:48:03 +00:00
fr33domlover
1b304994d0 S2S: Add 'Add' activity, adds a new version of the patch bundle to a Ticket 2020-09-10 10:57:02 +00:00
fr33domlover
e2ac053d2b No CSRF token check for Dvara routes, they do it for themselves when needed 2020-09-01 14:11:47 +00:00
fr33domlover
7415175bea Fix pattern matching missing case 2020-08-31 09:19:34 +00:00
fr33domlover
201736427e Client: Add form to submit a patch via Offer activity 2020-08-17 13:30:43 +00:00
fr33domlover
7812fa6e8f Client: Add form for submitting a patch to a repo 2020-08-17 13:01:29 +00:00
fr33domlover
32adee0a75 Don't accept Darcs MRs with more than one patch bundle file 2020-08-17 09:01:14 +00:00
fr33domlover
cb11ea6447 DB: Add media type field to 'Patch' entity
This patch (haha) also adds a VCS field to the AP representation of repos
2020-08-14 21:16:33 +00:00
fr33domlover
b16c9505af S2S & C2S: Switch from single-patch MR version to multi-patch bundle support 2020-08-13 10:26:20 +00:00
fr33domlover
da01fcf451 S2S: Fix bug: in *UndoF, when unresolving ticket, ticketStatus wasn't updated 2020-08-06 13:18:38 +00:00
fr33domlover
be3cf50283 C2S: Fix bug: undoC: When deleting TicketResolve, ticketStatus wasn't updated 2020-08-06 07:14:06 +00:00
fr33domlover
9f34106a87 Client: Add forms for resolving and unresolving a ticket/MR 2020-08-05 20:41:33 +00:00
fr33domlover
5a0c46ad5c GET ticket handlers: Provide 'resolvedBy', set to the Resolve activity's ID URI 2020-08-05 12:43:04 +00:00
fr33domlover
de5d24edca When grabbing ticket/patch from DB, grab the TicketResolve* record too 2020-08-05 11:04:00 +00:00
fr33domlover
7a74dcc55e Web.ActivityPub: Allow to specify 'resolved' and 'resolvedBy' for 'Ticket' 2020-08-05 10:11:16 +00:00
fr33domlover
9317e514b2 S2S unresolve, C2S resolve & unresolve, use C2S in the UI buttons 2020-08-05 08:28:58 +00:00
fr33domlover
7f106023b0 S2S: Implement inbox handlers for Resolve activity 2020-07-28 09:35:27 +00:00
fr33domlover
58c0719370 Web.ActivityPub: Add a Resolve activity 2020-07-23 14:27:11 +00:00
fr33domlover
1bd7995bb5 DB: Fix migration 173 for future instances to avoid the RemoteCollection bug 2020-07-23 13:38:46 +00:00
fr33domlover
ac9c79c761 DB: RemoteCollection was referring to itself accidentally, add migration to fix 2020-07-23 13:33:54 +00:00
fr33domlover
b050c9225d Web.ActivityPub: Add 'currentVersion' property to 'Patch' type 2020-07-23 10:47:35 +00:00
fr33domlover
c1f0722c21 C2S: createTicketC: Allow to submit MRs i.e. Ticket with a Patch attached 2020-07-22 13:00:48 +00:00
fr33domlover
fd8405e741 S2S: repoCreateTicketF: Store a Patch record in DB, to have a local copy 2020-07-21 10:03:51 +00:00
fr33domlover
029fce58a4 S2S: Repos now accept remotely hosted patches via Create/Ticket 2020-07-21 09:39:36 +00:00
fr33domlover
f286f35a87 S2S: Add repo patch support to checkCreateTicket 2020-07-19 12:48:39 +00:00
fr33domlover
f7c0807775 C2S: offerTicketC: Support offering a patch to a repo 2020-07-16 11:30:22 +00:00
fr33domlover
3e7e885300 S2S: Implement patch submission via repoOfferTicketF 2020-07-16 08:22:13 +00:00
fr33domlover
6d4d77255f S2S: Prepare Offer/Ticket parsing code for handling a remote patch/MR 2020-07-15 13:00:58 +00:00
fr33domlover
c78becaf5e S2S: projectCreateTicketF: Refactor to use new utils 2020-07-15 11:20:11 +00:00
fr33domlover
e46bcac559 S2S: sharerCreateTicketF: Tweak to use the new utils 2020-07-15 10:14:41 +00:00
fr33domlover
1a8ecb5995 S2S: Refactor projectOfferTicketF to use the new utils 2020-07-15 09:58:59 +00:00
fr33domlover
58e88d1e1b Upgrade sharerOfferTicketF to new utils 2020-07-15 08:00:08 +00:00
fr33domlover
75c0bc0939 Web.ActivityPub: Ticket attachment's Offer object can be either URI or a Patch
This will allow to use this representation for Offer and Create activities.
When creating a new MR, the inner Offer's 'object' is a 'Patch' object. When
serving an existing hosted MR, the inner Offer's 'object' is just a URI
pointing to the patch.
2020-07-14 11:25:37 +00:00
fr33domlover
6d80b1e4f1 Web.ActivityPub: In MR, the 'object' of the 'Offer' is a 'Patch' URI
Instead of an 'OrderedCollection' of the versions
2020-07-14 11:10:43 +00:00
fr33domlover
216aaa72ee Web.ActivityPub: Add PatchLocal type similar to TicketLocal 2020-07-14 09:56:13 +00:00
fr33domlover
fa3348513a For latest-version patches, provide a 'previousVersions' list 2020-07-14 08:50:57 +00:00
fr33domlover
a06d273107 C2S: Implement offerDepC, allowing to create ticket dependencies 2020-07-13 13:43:20 +00:00
fr33domlover
90086f1329 In audience parsing, provide version without bcc & list hosts for inbox fwding 2020-07-12 11:17:12 +00:00
fr33domlover
2a6bba89d5 C2S: Reimplement offerTicketC using the new tools 2020-07-07 07:26:51 +00:00
fr33domlover
511c3c60db C2S: In yesod authorization check, support OAuth2 as login method 2020-07-06 08:01:02 +00:00
fr33domlover
d392a37707 Rename InboxR to InboxDebugR, much clearer that way 2020-07-02 13:34:38 +00:00