Commit graph

1128 commits

Author SHA1 Message Date
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
fr33domlover
5d25aba239 C2S: Implement real C2S access via outbox POSTing and OAuth2 2020-07-02 13:21:59 +00:00
fr33domlover
a0325da028 S2S: Implement projectOfferDepF and repoOfferDepF 2020-06-22 11:29:30 +00:00
fr33domlover
5cf105fafb Move checkDepAndTarget from Vervis.Federation.Ticket to Vervis.Ticket
I'm moving it there because it's going to be used in C2S too, in offerDepC.
2020-06-21 12:31:11 +00:00
fr33domlover
4fc50f0870 Move hostIsLocal from Vervis.ActivityPub to Yesod.ActivityPub 2020-06-21 12:29:37 +00:00
fr33domlover
2cddadd679 sharerOfferDepF: If parent is remote and child is mine, record TicketDepOffer 2020-06-21 09:06:02 +00:00
fr33domlover
bc4248d7ca S2S: Handle remote dep in sharerAcceptF
If sharer receives Accept on an Offer/Dep where the sharer hosts the child
ticket, it records a RemoteTicketDependency and runs inbox forwarding to ticket
followers. But this relies on a TicketDependencyOffer record already existing.
I'll take care of that in the next patches.

sharerAcceptF and sharerRejectF now use the insertToInbox from
Vervis.Federation.Util instead of their own copies of it, which were identical
anyway. Perhaps gradually all the inbox insertion in all S2S handlers will
switch to using that function.
2020-06-21 08:02:05 +00:00
fr33domlover
a2468c52fd Prepare for ticket dependency federation
To be honest, this is a huge patch that changes tons of stuff and probably
should have been broken up into small changes. But I already had the codebase
not building, so... just did all of this at once :P

Basically this patch does the following:

- DB migrations for ticket dependency related tables, e.g. allowing a remote
  author and a remote child
- Allowing S2S handlers to provide an async continued processing function,
  which is executed and the result then added to the debug page
- Most UI and functionality related to ticket deps is disabled, new
  implementation being added gradually via ActivityPub
- Improvements to AP tools, e.g. allow to specify multiple hosts for approved
  forwarding when sending out an activity, and allow to specify audience of
  software-authored activities using a convenient human-friendly structure
- Implementation of S2S sharerOfferDepF which creates a dependency under a
  sharer-hosted ticket/patch and sends back an Accept
2020-06-18 10:38:04 +00:00
fr33domlover
854d35fd9b C2S: Support following a sharer-patch and repo-patch 2020-05-28 07:48:39 +00:00
fr33domlover
3fb529325d S2S: Support commenting on sharer-patch and repo-patch 2020-05-27 14:07:02 +00:00
fr33domlover
cf946e0326 S2S: Support unfollowing sharer-patch and repo-patch
- Sharer-patch was already working due to the shared DB tabled
- Repo-patch support added
- Fixed a bug in following project-tickets: It allowed to follow a
  sharer-ticket by sending the Follow to the project. Now, the project allows
  to follow only the project-tickets, and refuses to handle a sharer-ticket.
2020-05-27 11:59:53 +00:00
fr33domlover
c7b6ad643b S2S: Support following sharer-patch and repo-patch
Also fixed a bug in which trying to follow a ticket with nonexistent
ltkhid/talkhid would result with 404 as if the actor inbox is nonexistent. Now,
there's a friendly message reported.
2020-05-27 11:39:19 +00:00
fr33domlover
06a051d2e5 Support addressing, delivery and forwarding for sharer-patches and repo-patches 2020-05-27 10:38:28 +00:00
fr33domlover
d9c00cba1f Add repo-hosted patch routes and GET handlers 2020-05-26 14:51:11 +00:00
fr33domlover
e29233a59f Rename RepoPatchR to RepoCommitR, we'll use the old name for merge requests 2020-05-26 08:54:21 +00:00
fr33domlover
ad8c0ce8b4 Return sorted PatchId list from the get*Patch functions 2020-05-26 08:41:02 +00:00
fr33domlover
e68a659221 Support forwarding activities from repo actors 2020-05-25 13:36:34 +00:00
fr33domlover
17e59af1c4 AP: In getSharerPatchR, provide the list of patch versions, latest first 2020-05-25 12:39:25 +00:00
fr33domlover
c63479470e Add patch version route and GET handler, serving a specific patch file 2020-05-25 09:40:48 +00:00
fr33domlover
55c87b8a54 AP: Recognize "CryptographicKey" as a type of http sig keys
The examples in the security vocabulary's spec use "Key" but the JSON-LD
context doesn't define that term. From now on, just in case, recognizing both
"Key" and "CryptographicKey" as indication that the object is a key.

zPlus, thanks for finding this bug!
2020-05-25 09:37:15 +00:00
fr33domlover
417fcd3e94 S2S: If sharer inbox handler fails, return and log the error message 2020-05-24 13:53:31 +00:00
fr33domlover
d56a7411fc Refactor sharer-ticket and sharer-patch GET handler code to reuse similar parts 2020-05-24 13:31:58 +00:00
fr33domlover
02c42029d2 Add GET routes and handlers for sharer-hosted patches 2020-05-24 09:17:49 +00:00
fr33domlover
bb6785de75 DB: Generalize TicketProjectLocal into TicketContextLocal
This is the first step preparing for patches and merge requests.

The work-item aspect of MRs will reuse the Ticket related tables, except MRs
will live under repos. So, the context of tickets will no longer be just
projects, but will also be repos.

So, TicketProjectLocal turns into TicketContextLocal, and there are 2 new
tables that refer to it: TicketProjectLocal and TicketRepoLocal. Tickets will
have the former, MRs will have the latter.
2020-05-18 10:28:43 +00:00
fr33domlover
77e576ccb2 Startup: Sort the repo-tree-from-filesystem, it's not sorted by default 2020-05-14 12:33:51 +00:00
fr33domlover
2063c7313b Startup: If repo dir check fails, print both versions of repo tree 2020-05-14 12:11:31 +00:00
fr33domlover
cac4edc8eb getProjectTicketsR: In AS2, list remote tickets too 2020-05-14 11:13:04 +00:00
fr33domlover
d29ba23bfb In getProjectTicket, return TUP alongside TAL to prove it exists 2020-05-14 09:09:57 +00:00
fr33domlover
036c60171b In getSharerTicket, support remote project 2020-05-14 08:59:34 +00:00
fr33domlover
003adcbf7b Comment out more uses of ticket team collection 2020-05-14 08:58:37 +00:00
fr33domlover
a5348245f6 Comment out some usage of ticket team collection for addressing
Removed its usage in pseudo-client when publishing a comment, and removed it
from inbox forwarding when handling a remote comment.

Very possibly, the ticket team collection will be entirely removed. For now
leaving it there as-is. Just not using it for addressing in activities.
2020-05-13 14:00:38 +00:00
fr33domlover
a548dc8c5b S2S: sharerCreateNoteF: If ctx is sharer-ticket of another user, store to inbox 2020-05-13 13:49:22 +00:00
fr33domlover
f296dc173c C2S: In followC, return friendly message if already following the target object 2020-05-13 13:29:39 +00:00
fr33domlover
43cd1a95f3 S2S: sharerCreateNoteF caches note and does inbox fwd if sharer is ticket owner 2020-05-13 13:06:28 +00:00
fr33domlover
c91908941b S2S: sharerCreateNoteF & projectCreateNoteF can handle sharer-hosted tickets 2020-05-11 18:59:29 +00:00
fr33domlover
edaa3c49b2 C2S: Rewrite createNoteC based on createTicketC 2020-05-01 17:48:01 +00:00
fr33domlover
23056b3b3c DB: Attach a RemoteDiscussion to each RemoteTicket, for caching comments 2020-04-14 18:24:19 +00:00
fr33domlover
6c8b9664a2 When HTTP-fetching actors, remember their 'followers' as a LocalURI
The implementation felt quite weird, had to add an extra field to Fetched and
to VerifKeyDetail. Should probably figure out the whole mess in that code, have
something clean there. Easily add fields. Easily and safely re-fetch an actor
or key.
2020-04-11 14:58:38 +00:00
fr33domlover
7dc0ba2bf1 Fix error message for HTTP inbox forwarding 2020-04-11 14:03:54 +00:00
fr33domlover
04fc94cedb S2S: Write Create/Ticket project inbox handler: list ticket & do inbox fwding 2020-04-11 13:57:43 +00:00
fr33domlover
40a5b336a4 S2S: In Undo handler for sharer inbox, support unfollowing sharer tickets 2020-04-10 10:47:43 +00:00
fr33domlover
e406b08f44 S2S: In Follow handler for sharer inbox, support following of sharer tickets 2020-04-10 10:34:22 +00:00
fr33domlover
f4ab99f7bb C2S: In Follow handler, support following sharer-hosted tickets 2020-04-09 20:04:21 +00:00
fr33domlover
90bac5c34e Support sharer-hosted tickets in AP local dispatch and delivery 2020-04-09 17:39:36 +00:00
fr33domlover
ef4a8f4015 Write S2S Create/Ticket handler for sharer inbox 2020-04-09 12:21:17 +00:00
fr33domlover
f18c15f038 Rename the TicketR routes to ProjectTicketR for clarity
Now it's much clearer when looking at the code, that these routes are about
project-hosted tickets, and it's easier to see where the author-hosted
equivalents are missing.
2020-04-09 07:36:01 +00:00
fr33domlover
4a362632be Update S2S Accept handler to handle Accept on a Create/Ticket 2020-04-08 17:02:04 +00:00
fr33domlover
318f182245 Add OAuth2 subsite 2020-03-28 14:28:24 +00:00
fr33domlover
ac477ab739 Add OAuth2 tables to database, and run their migrations 2020-03-28 14:18:00 +00:00
fr33domlover
8f3ac50963 Verify TUP existence (when relevant) in all project-hosted ticket routes 2020-02-24 15:36:43 +00:00
fr33domlover
bf4a0e4c95 getTicketsR: Deduce ticket URL correctly for HTML output too 2020-02-23 15:41:08 +00:00
fr33domlover
ca0c7124c1 In C2S Offer{Ticket} on local project, insert a TicketUnderProject record 2020-02-23 15:38:22 +00:00
fr33domlover
f6903364f4 getTicketsR: Deduce ticket URLs correctly for JSON output 2020-02-23 13:22:32 +00:00
fr33domlover
a00c45a444 Implement C2S Create{Ticket}, available in PublishR and in postTicketsR
IMPORTANT: Since a lot of ticket code still doesn't use TicketUnderProject,
creating tickets now appears to be failing. Usage of this patch as is, is at
your own risk ^_^ the next patches will update the ticket handlers to fix this
problem.
2020-02-22 19:45:27 +00:00
fr33domlover
e0300ba0fa Write recipient filtering utility function 2020-02-19 10:59:38 +00:00
fr33domlover
a53fbcf1c0 Vervis.ActivityPub: Implement general-purpose full local delivery
Delivery of an activity into local inboxes is being done using custom local
functions. Each C2S or S2S handler has its own specific variant for this.

As part of the ongoing refactoring and evolution of the federation code, I
implemented a general-purpose local delivery function: It takes a
LocalRecipientSet and simply delivers to everyone, no handler-specific
assumptions or limitations.

To limit the recipient set according to handler specific rules, just
filter/adapt/edit it before passing to the delivery function.

The function isn't exported yet, but the existing 'deliverLocal' that delivers
only to actors and to author's followers is now implemented via the new
general-purpose function. I hope that's a step towards doing all the local
delivery using this one function, simplifying the complicated federation
code.
2020-02-18 13:34:34 +00:00
fr33domlover
adc107bb4c Web.ActivityPub: Add createTarget field
I'll use this for C2S to allow client to state who the tracker actor is. It's
still possible to do without it, by HTTP GETing the ticket's context and
checking whether we got an actor, or a non-actor with ticketsTrackedBy. Tbh I'm
adding createTarget simply because it's easier for coding, no need for a custom
variant of actor fetching :P
2020-02-18 13:26:28 +00:00
fr33domlover
257a811a8b Remove some unused imports from Vervis.Foundation 2020-02-18 13:25:26 +00:00
fr33domlover
1a650a783f Web.ActivityPub: Move ticketContext from TicketLocal to Ticket
This allows the context to be specified even when replies/followers/deps/etc.
aren't. This is needed for Create-ing a Ticket. Also, it allows a ticket's
context to be on a different host than where it's hosted, which is also needed
for the Create flow.
2020-02-11 14:14:52 +00:00
fr33domlover
6d25d7ec2c Web.ActivityPub: Allow Create object to be a Ticket 2020-02-10 14:51:32 +00:00
fr33domlover
0de98a9cdd Implement sharer ticket JSON view, including discussion, followers, deps etc. 2020-02-10 14:10:01 +00:00
fr33domlover
00e0f7c14f DB: Switch RemoteMessage to use RemoteObject 2020-02-10 14:07:00 +00:00
fr33domlover
c03dacdb11 In getTicketR, if author is local, make sure a TicketUnderProject exists 2020-02-08 15:42:55 +00:00
fr33domlover
32173fe0c0 Add tickets-under-sharer route, just plain JSON view 2020-02-08 15:24:36 +00:00
fr33domlover
5e9dd3555d DB: Add and populate TicketUnderProject table
A row in this table will be required for local-project-local-author tickets
hosted under the project, and non-existence of a row will be required for such
tickets hosted by the author. So I'll need to CAREFULLY update all the ticket
route handler code and all the ticket related AP code. The latter includes C2S
and S2S for tickets, ticket deps, ticket discussion... everything that is under
tickets.
2020-02-08 11:49:30 +00:00
fr33domlover
7612b4e01e DB: Switch RemoteDiscussion to use RemoteObject instead of instance+ident 2020-02-08 10:55:19 +00:00
fr33domlover
fb9e2dd4dd DB: In TAL and TAR, rename 'offer' to 'open'
That's because with the Create flow added, the activity that reports a ticket
can be either Create or Offer, maybe later Announce too.

The old TAL unique name mentioned in the migration has what may look like a
typo, "Locale" instead of "Local". That's because I made a typo in migration
115, and now needed to specify the typoed name I used then. I verified in dev
DB and on dev.angeley.es DB that the typo is reflected in the PostgreSQL
database side and fixed by the new migrations.
2020-02-08 09:35:35 +00:00
fr33domlover
6fa0a9cb46 Fix bug in DB query in getTicketsR 2020-02-08 08:55:28 +00:00
fr33domlover
6e2445a31f DB: Remove unnecessary fkey from TicketAuthorRemote to Ticket
Since it points to TicketProjectLocal which in turn points to Ticket.
2020-02-07 23:05:42 +00:00
fr33domlover
5b57039447 DB: Point from TicketAuthorRemote to TicketProjectLocal 2020-02-07 19:42:02 +00:00
fr33domlover
ea7d806233 DB: Remove 'project' and 'accept' from Ticket, use TicketProjectLocal instead 2020-02-06 17:25:09 +00:00
fr33domlover
7809512117 DB: Add TicketProjectLocal table, pointing to Ticket but not in use yet 2020-02-06 04:18:19 +00:00
fr33domlover
813869755a DB: Remove foreign key from TicketAuthorLocal to Ticket, not needed anymore
Since TicketAuthorLocal now points to LocalTicket, which in turn points to
Ticket.
2020-02-06 03:41:16 +00:00
fr33domlover
fd704e231f DB: Add foreign key from TicketAuthorLocal to LocalTicket
Right now it's in addition to the Ticket one. The next patch will remove the
Ticket old, so TicketAuthorLocal will point only to the LocalTicket.
2020-02-06 03:17:00 +00:00
fr33domlover
443ff6daa1 Switch ticket routes to use the KeyHashid of LocalTicket instead of Ticket 2020-02-06 00:52:15 +00:00
fr33domlover
cd5180a1d5 DB: Remove did and fsid from Ticket, get them from LocalTicket
Everywhere Ticket is found, a matching LocalTicket is now expected to be found
too. Ticket doesn't point at LocalTicket because there will be remote cached
tickets too. Also, ticket URLs are going to switch the khid from Ticket to
LocalTicket (much like it's already the case for MessageR).
2020-02-05 14:09:12 +00:00
fr33domlover
deeac7e760 DB: Add LocalTicket table
This is a step preparing for the Create flow for tickets. Each Ticket now gets
a matching LocalTicket that points to it. But otherwise the LocalTicket isn't
in use yet.
2020-02-05 12:08:39 +00:00
fr33domlover
1a5654f8ae Stop assigning ticket numbers, allow them to be NULL 2020-02-03 15:44:16 +00:00
fr33domlover
c5996bd226 Re-enable UI for removing ticket deps 2020-02-03 15:10:13 +00:00
fr33domlover
1cb3812ef5 Remove ticket numbers from UI and from URLs, use KeyHashid instead 2020-02-03 14:53:12 +00:00
fr33domlover
fc0f694289 When comparing repo dir to DB, compare the VCS type of each repo as well 2020-01-18 11:49:07 +00:00
fr33domlover
54ea66878f Compare repos dir and repos in DB when launching Vervis 2020-01-18 11:00:08 +00:00
fr33domlover
59d08782ba Don't html-escape ticket title, it's already escaped 2020-01-17 21:52:29 +00:00
fr33domlover
f4a5866dec Very basic support for ticket label colors
- WorkflowField now has a color, it's a simple `Maybe Int` for now. Valid
  values are only 1-4
- That color is used for displaying ticket class params a.k.a labels in ticket
  list view
- Ticket list now also serves a paged OrderedCollection

I tried to use a single SQL query to grab the tickets along with their labels,
but couldn't figure out a way to aggregate tuples/rows into an array (it seems
only single values are supported in Esqueleto). Instead of doing manual SQL or
adding Esqueleto functions, I just switched from 1 query to O(n) queries: Each
ticket has its own query selecting its labels. I guess it's slower, but also,
ticket list is paged now with fixed page size so it's really O(1) ^_^
2020-01-16 10:29:47 +00:00
fr33domlover
031a4c0930 Display ticket class params AKA labels in ticket list view 2020-01-11 17:28:53 +00:00
fr33domlover
d01bc5bad7 Implement ticket class params 2020-01-05 14:33:10 +00:00
fr33domlover
8fc5e4b3c1 DB: Rename entity WorkflowFieldEnum to WorkflowEnum 2020-01-05 12:04:17 +00:00
fr33domlover
b78a0fa116 Allow to create and set ticket params of enum type, fixes #111 2020-01-04 10:49:44 +00:00
fr33domlover
64cf836b47 UI: When selecting ticket dep, display the list sorted by ticket number 2020-01-03 18:42:29 +00:00
fr33domlover
878e8f4056 In /browse, add repo-less project table, so that all projects are listed 2019-12-28 18:04:05 +00:00
fr33domlover
d8fabbdfc5 Display project/repo sharer nav, and project nav in repo page 2019-12-28 16:34:44 +00:00
fr33domlover
7654655bcf In repo source page(s), display the project it belongs to 2019-12-27 20:44:14 +00:00
Jason Harrer
955f7444f6 Discussion Tree View Improvements 2019-12-08 14:47:38 +00:00
fr33domlover
73cfaf7ceb UI: In ticket view, display filter as 3 checkboxes, default is open tickets 2019-11-07 10:46:25 +00:00
fr33domlover
0031801a74 Fix SQL error when selecting ticket summaries 2019-11-07 10:45:44 +00:00
fr33domlover
7a96d904f3 Use orderedItems in OrderedCollection 2019-11-06 20:46:21 +00:00
fr33domlover
f8dd72d052 DB: Use RemoteObject in UnfetchedRemoteActor, RemoteActor, RemoteCollection 2019-11-06 19:47:50 +00:00
fr33domlover
acb86ab621 DB: Add RemoteObject entity and use it in RemoteActivity instead of iid+lu 2019-11-05 04:08:36 +00:00
fr33domlover
027b0012a5 AP: When parsing a Follow, let "hide" not be specified, treat as false 2019-11-03 13:43:59 +00:00
fr33domlover
deba50f835 UI: Display all messages in defaultLayout, not just one 2019-11-03 13:20:48 +00:00
fr33domlover
4dcd6eb1b2 UI: Some tweaks, following ikomi's suggestions, thank you ikomi :) 2019-10-31 11:29:00 +00:00
fr33domlover
b95e9a8006 Weird initial (but complete) display of Darcs patches 2019-10-31 10:11:13 +00:00
fr33domlover
e9f17ff220 UI: Change RepoPatchR breadcrumb parent from RepoR to RepoHeadChangesR 2019-10-31 10:10:17 +00:00
fr33domlover
bdc48f4ca2 When parsing a Darcs repo's patch file, fail with error detail in the message
I'm not sure this will improve much, because the error messages come from
attoparsec, but at least the message text won't be constant, which was the
previous situation.
2019-10-23 09:31:37 +00:00
fr33domlover
ff73433bc1 UI: Change the default page parent from Nothing to Just HomeR
That way, it's a bit easier to navigate from a weird "PAGE TITLE HERE" page to
the homepage. Breadcrumbs still need work though.
2019-10-22 11:00:35 +00:00
fr33domlover
b23741f1fe S2S: Store relevant Push activities in recipient's inbox
Before, Push activities were being ignored by all inboxes. I just forgot to add
code to handle them. Now, person inboxes accept them if they're about a
relevant repo (i.e. a repo of which the user is a remote follower; remote
collaboration would be relevant too, but it's not implemented yet).
2019-10-22 10:28:35 +00:00
fr33domlover
0673ed0bb4 DB: Remove the "manual" fields from follow records
Follows used to be added automatically, without a Follow activity sent by the
client. They aren't added automatically anymore, so there's no need for those
"manual" boolean fields.
2019-10-22 10:25:33 +00:00
fr33domlover
a700dc4208 Make the hook config file path include the instance host
Before this patch, if you ran more than 1 instance as the same OS user, they'd
use the same config file path and overwrite it and cause post hooks to have
errors due to wrong config being used.
2019-10-20 09:19:49 +00:00
fr33domlover
552e2b3001 UI: Remove link to FEDERATION.md
It's getting outdated and with demo instructions you don't need that file
anyway. Removing it to reduce visual clutter in the UI.
2019-10-19 09:49:09 +00:00
fr33domlover
96c6904b46 When parsing actor, allow missing sshKey, treat it the same as [] 2019-10-19 09:38:05 +00:00
fr33domlover
bc379a864f Provide 'following' collections and link in page header 2019-10-19 08:15:48 +00:00
fr33domlover
e0d7612908 Display SSH key example as a placeholder, not a default value (thanks zPlus!) 2019-10-19 06:35:28 +00:00
fr33domlover
339c2253f9 If Git repo is empty (no branches), don't 404, just show basic repo page 2019-10-19 06:01:14 +00:00
fr33domlover
0be7f05d31 If an actor doesn't have SSH keys, don't list an "sshKey":[] property 2019-10-19 04:16:09 +00:00
fr33domlover
1c56f63e86 Default actor name display is now its URL, not the string "(?)" 2019-10-19 04:10:33 +00:00
fr33domlover
c2cd32f020 When creating a repo, redirect to the page of the new repo 2019-10-19 02:43:24 +00:00
fr33domlover
b030320964 C2S: Process the HTML forms in postPublishR, not postSharerOutboxR 2019-10-19 02:41:36 +00:00
fr33domlover
af9f207b78 S2S: In repo inbox POST, don't check for CSFR token 2019-10-19 00:13:48 +00:00
fr33domlover
9f063fb349 Fix missing logs of fixRunningDeliveries 2019-10-18 23:51:55 +00:00
fr33domlover
d5063eaef9 S2S: FIx bug in parsing Follow object 2019-10-18 23:45:13 +00:00
fr33domlover
1e8dd71f23 Fix handling of forwarded activities from local repos 2019-10-18 23:20:48 +00:00
fr33domlover
271bc3dbd0 UI: List projectless repos and "Create New" link in personal overview page 2019-10-17 11:45:06 +00:00
fr33domlover
02337c39e1 UI: Take SSH public key in 1 field, then split into key type and content 2019-10-17 09:57:46 +00:00
fr33domlover
a419db5b5b Publish AS2 representation of SSH keys and list SSH keys in actor documents 2019-10-17 08:37:48 +00:00
fr33domlover
0be7fa05f8 In Push activity summary, list the titles of the pushed commits 2019-10-13 19:19:24 +00:00
fr33domlover
6c81a46a02 List repo in Push recipients, it was accidentally not listed 2019-10-12 19:38:29 +00:00
fr33domlover
16cde4b4c2 Fix typo in context property name for Commit objects 2019-10-10 16:48:57 +00:00
fr33domlover
59ce05694e In darcs post-apply hook, send a Push object to Vervis 2019-10-10 16:41:34 +00:00
fr33domlover
6cb86ebbf1 Install darcs post-apply hooks in darcs repos, no-op hook for now
In Darcs, any command can have a post hook (and a pre hook), and the hook
command can be set using a command-line option to the darcs command that you
run. So, in the Vervis SSH server, if we add a --posthook option when running
`darcs apply` to apply remotely received patches, we get a chance to process
the patch data much like in the git post-receive hook.

The setup this patch creates is similar to the git one: It writes a
_darcs/prefs/defaults file to all Darcs repos, and that defaults file sets the
posthook line for `darcs apply`. The posthook line simply executes the actual
hook program written in Haskell.

The current hook program is a one-liner that prints a line to stdout, so every
time you `darcs push` you can tell the hook got executed. The next step is to
implement the actual hook logic, by reading patch data from the environment
variable in which Darcs puts it.
2019-10-07 14:05:52 +00:00
fr33domlover
c529722b5a Implement S2S unfollowing using Undo{Follow} 2019-10-05 16:22:27 +00:00
fr33domlover
bbe6f159d0 Implement C2S unfollowing, using Undo{Follow} 2019-10-05 14:10:29 +00:00
fr33domlover
6a4975a52c Add "Follow" button to person, repo, project and ticket pages 2019-10-02 08:07:26 +00:00
fr33domlover
c91599b989 When successfully submitting a ticket comment, submit Follow activity too 2019-09-30 09:00:44 +00:00
fr33domlover
77678fc8f6 Move postTicketsR to Vervis.Handler.Client & submit Follow activity on success 2019-09-30 08:00:05 +00:00
fr33domlover
72cba96958 Move reply authoring code from Vervis.Handler.Discussion to Vervis.Client 2019-09-30 06:27:42 +00:00
fr33domlover
5a7700ffe4 Implement remote following, disable automatic following
This patch contains migrations that require that there are no follow records.
If you have any, the migration will (hopefully) fail and you'll need to
manually delete any follow records you have. In the next patch I'll try to add
automatic following on the pseudo-client side by running both e.g. createNoteC
and followC in the same POST request handler.
2019-09-25 10:43:05 +00:00
fr33domlover
1673851db0 In S2S Follow, projects allow following their tickets 2019-09-16 16:01:43 +00:00
fr33domlover
612dfa1fce Implement S2S Follow for sharers, projects and repos 2019-09-16 15:18:18 +00:00
fr33domlover
525a722439 Implement C2S Follow activity and add form on /publish page 2019-09-11 08:12:20 +00:00
fr33domlover
3a68a3e7e6 Don't list non-public follows in follower collections 2019-09-09 01:20:02 +00:00
fr33domlover
544ebae3fd Specify visibility in Follow records 2019-09-09 00:33:36 +00:00
fr33domlover
68e8b094a0 Handle post-receive hook, publish a Push activity 2019-09-09 00:27:45 +00:00
fr33domlover
3c01f4136c Mechanism for reporting git pushes to Vervis via post-receive hooks
Here's how it works:

- When Vervis starts, it writes a config file and it writes post-receive hooks
  into all the repos it manages
- When a git push is accepted, git runs the post-receive hook, which is a
  trivial shell script that executes the actual Haskell program implementing
  the hook logic
- The Haskell hook program generates a Push JSON object and HTTP POSTs it to
  Vervis running on localhost
- Vervis currently responds with an error, the next step is to implement the
  actual publishing of ForgeFed Push activities
2019-09-05 12:02:42 +00:00
fr33domlover
29354ff1ed Provide darcs log in ActivityPub format 2019-09-02 02:41:50 +00:00
fr33domlover
6ffc2c9872 Provide git log in ActivityPub format
Currently it's a paged Collection where the items are merely URIs. This could
be changed to have actual Commit objects as items; for that we need to examine
the whole thing with the LogEntry type and the Patch type and have an
AP-friendly log item representation, but without commit diffs.
2019-09-01 14:19:14 +00:00
fr33domlover
7b26d5d918 Use 'context' for Commit's repo, instead of 'repository' 2019-08-28 16:20:19 +00:00
fr33domlover
d4d45c6fe7 AP representation of git repo branches & preparation for Push activities 2019-08-28 15:31:40 +00:00
fr33domlover
2c18660a3b Provide AP representation of commits, and support committer field 2019-08-06 13:23:11 +00:00
fr33domlover
072039f5d8 On "See JSON" pages, display a link back to "regular HTML" version of the page 2019-07-23 18:17:15 +00:00
fr33domlover
655a2ebe18 Provide AP Collection representations for ticket deps/rdeps pages 2019-07-23 18:15:51 +00:00
fr33domlover
8fc5c80dd6 New Network.FedURI with separate URI modes for dev and for fediverse
FedURIs, until now, have been requiring HTTPS, and no port number, and DNS
internet domain names. This works just fine on the forge fediverse, but it
makes local dev builds much less useful.

This patch introduces URI types that have a type tag specifying one of 2 modes:

- `Dev`: Works with URIs like `http://localhost:3000/s/fr33`
- `Fed`: Works with URIs like `https://dev.community/s/fr33`

This should allow even to run multiple federating instances for development,
without needing TLS or reverse proxies or editing the hosts files or anything
like that.
2019-07-23 13:59:48 +00:00
fr33domlover
84765e2b94 Represent a ticket dep using a dedicated TicketDependency AP type 2019-07-11 22:18:30 +00:00
fr33domlover
65edc77747 Specify deps and rdeps in Ticket as URIs of Collections 2019-07-11 15:53:55 +00:00
fr33domlover
81a05a950f Implement getTicketDepR, not used anywhere else yet
This patch also disables the ability to specify deps when creating a ticket,
because those deps won't be in the ticket object anymore. Instead of coding a
workaround and getting complications later, I just disabled that thing. It
wasn't really being used by anyone anyway.
2019-07-11 15:14:16 +00:00
fr33domlover
828e015c54 Rename TicketDepR to TicketDepOldR; we're going to use TicketDepR in a new way 2019-07-08 15:54:41 +00:00
fr33domlover
d2e64d2920 Fix outbox item pretty display, it was highlighted but not pretty-encoded 2019-06-30 16:53:53 +00:00
fr33domlover
deedc961c5 If highlight backend not set for pretty JSON, assume Skylighting
Highlighter2 doesn't work for JSON anyway (not sure why yet).
2019-06-30 14:38:23 +00:00
fr33domlover
31d7e9eac7 Display times and link to activity in inbox, outbox and notifications 2019-06-30 14:04:28 +00:00
fr33domlover
dc631a98c5 Fix typo in Create Note summary text formatting 2019-06-30 11:20:43 +00:00
fr33domlover
a09585f074 Specify noteSource when inserting C2S ticket comment 2019-06-30 02:52:40 +00:00
fr33domlover
4b045118f9 Address project followers when posting ticket comment in regular UI 2019-06-30 02:23:58 +00:00
fr33domlover
d8da1f2abf Display summary and pretty JSON for notifications and for outboxes 2019-06-30 01:41:54 +00:00
fr33domlover
2109974709 Publish project outbox URL in project AP JSON 2019-06-30 01:18:52 +00:00
fr33domlover
add8a3a23b Display pretty JSON on user page 2019-06-30 01:17:47 +00:00
fr33domlover
2376cbd479 When receiving Offer in inbox, expect ticket's 'published' NOT to be set 2019-06-29 23:32:34 +00:00
fr33domlover
d73c3928a0 In inbox display, show summary when available, otherwise show highlighted JSON 2019-06-29 23:16:52 +00:00
fr33domlover
f7b7a417eb Highlight JSON with Skylighting by default, Highligher2 isn't working on it 2019-06-29 23:15:41 +00:00
fr33domlover
90cb4fcd88 Data.Aeson.Encode.Pretty.ToEncoding: Use encodePrettyToTextBuilder as base
aeson-pretty implements by formatting using a text Builder, and the ByteString
is encoded from that. So instead of decoding the ByteString to produce Text or
Builder, use the Builder as the starting point, to match how aeson-pretty works
and save computation and weird backwards-decoding stuff.
2019-06-29 22:39:42 +00:00
fr33domlover
183e9a7754 Encode pretty JSON using encodePretty, highlighting doesn't do formatting! 2019-06-29 22:38:42 +00:00
fr33domlover
685b7ec2bc Add option to render pretty AP JSON using Skylighting
highligher2 doesn't have a JSON syntax and the JS lexer seems to be failing,
not sure exactly why yet. To have an alternative, I'm adding a Skylighting
option.
2019-06-29 20:31:01 +00:00
fr33domlover
590e3928a5 Vervis.Migration: Replace fromJust in migration #109 with informative error 2019-06-29 17:18:48 +00:00
fr33domlover
6d72d676e7 Switch OutboxItem's Activity from plain BL to an upgraded PersistJSONObject 2019-06-29 03:19:00 +00:00
fr33domlover
e10b4d452a Treat outbox items in DB as bytestrings to avoid depending on JSON parsing 2019-06-28 23:15:08 +00:00
fr33domlover
e5f9b34ad2 Unset ticket closer PersonId for tickets that aren't closed 2019-06-27 12:19:37 +00:00
fr33domlover
63689aef1a Fix SQL query that selects ticket summary data, was making getTicketsR fail 2019-06-27 11:47:23 +00:00
fr33domlover
9f3e45c113 When Accepting an Offer{Ticket}, automatically add author as ticket follower 2019-06-26 01:37:29 +00:00
fr33domlover
07f76d2a6f Publish Accept activity when creating a new ticket from the Offer 2019-06-26 01:12:11 +00:00
fr33domlover
0a4c2ad817 Add a new-ticket form to /publish page, and handle in sharer outbox 2019-06-23 12:39:44 +00:00
fr33domlover
4be444f5ab Bring back postTicketsR, now implemented using offerTicketC 2019-06-23 10:00:11 +00:00
fr33domlover
55fdb5437c Write C2S Offer{Ticket} handler, not used in any route handlers yet
This patch doesn't just add the handler code, it also does lots of refactoring
and moves around pieces of code that are used in multiple places. There is
still lots of refactoring to make though. In this patch I tried to make minimal
changes to the existing Note handler to avoid breaking it. In later patches
I'll do some more serious refactoring, hopefully resulting with less mess in
the code.
2019-06-22 18:03:20 +00:00
fr33domlover
d6b999eaf3 C2S: Handle recipient grouping in dedicated Vervis.API.Recipient module 2019-06-20 23:22:25 +00:00
fr33domlover
7c30ee2d52 Switch activityId from LocalURI to Maybe LocalURI, for C2S posting without ID 2019-06-19 08:53:31 +00:00
fr33domlover
1ae924558f Use updateGet for atomic access to projectNextTicket
`updateGet` isn't atomic by default. In PostgreSQL the default isolation level
if committed read, and an `update` followed by a `get` doesn't guarantee you
get the same value you sent. However I'm making a patch for `persistent` to
make `updateGet` atomic for PostgreSQL.
2019-06-18 10:47:01 +00:00
fr33domlover
fb909adf2e Handle Offer{Ticket} in project inbox, and turn DB ticketTitle into HTML 2019-06-17 19:55:03 +00:00
fr33domlover
4d5fa0551f Refactor the types used in activity authentication and handle project recipient
- The data returned from activity authentication has nicer types now, and no
  mess of big tuples.
- Activity authentication code has its own module now, Vervis.Federation.Auth.
- The sharer inbox handler can now handle and store activities by a local
  project actor, forwarded from a remote actor. This isn't in use right now,
  but once projects start publishing Accept activities, or other things, it may
  be needed.
2019-06-16 21:39:50 +00:00
fr33domlover
e1ae75b50c Add project outbox and outbox item routes 2019-06-16 21:37:31 +00:00
fr33domlover
a65979f5af Give Project an Outbox in the DB 2019-06-16 21:34:06 +00:00
fr33domlover
64a377b12f Use syntax highlighting in outbox item JSON display 2019-06-16 21:32:18 +00:00
fr33domlover
5aaf2ba8a9 Rename OutboxR to SharerOutboxR, because projects will have outboxes too 2019-06-16 14:58:00 +00:00
fr33domlover
ade24bb534 Pretty JSON display for getActorKey1/2 and getOutboxItemR 2019-06-15 19:03:39 +00:00
fr33domlover
499479b662 Decouple OutboxItem from Person via a new table named Outbox 2019-06-15 18:51:26 +00:00
fr33domlover
6452d239f2 Optional activity summary, set it when handling a Note in C2S 2019-06-15 16:24:34 +00:00
fr33domlover
68bdaf65a7 S2S sharer inbox: Handle Offer{Ticket} yay! 2019-06-15 14:51:48 +00:00
fr33domlover
2abb6a44a4 Load settings from default settings filename, not reading it from command line 2019-06-15 08:58:20 +00:00
fr33domlover
057f57ff0d Load settings only at run time, not using compile time settings at all 2019-06-15 08:56:20 +00:00
fr33domlover
4b20ed23b6 Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
fr33domlover
7686f3777e New module structure for ActivityPub C2S and S2S code 2019-06-15 04:39:13 +00:00
fr33domlover
1fb1829f6e Generate an Offer Ticket for every ticket, including project inbox item
CRITICAL: Due to the requirement that each new ticket points to its Offer
activity, ticket creation has been disabled! The next patches should implement
C2S submission of Offer Ticket, and then ticket creation will work again. Sorry
for that.
2019-06-14 17:45:37 +00:00
fr33domlover
4d61672f94 Add a MonadUnliftIO constraint in RemoteActorStore, was removed from MonadSite
Since MonadSite now requires MonadIO, and not MonadUnliftIO, to allow for more
instances, the MonadUnliftIO constraint may need to be added manually
sometimes.
2019-06-14 17:40:57 +00:00
fr33domlover
698059763a When building with dev flag, disable the approot host check middleware
This allows to browse via e.g. localhost:3000 even if the instance host is
something else and the rendered URLs don't have a port number. It still makes
many things impossible or inconvenient, but at least you can launch Vervis
locally for development and see pages. Right now even CSS doesn't work because
of the URLs not matching the actual localhost:3000 access. Maybe gradually I'll
figure it out.
2019-06-14 17:36:31 +00:00
fr33domlover
f8f3a31a8d Yesod.FedURI and Yesod.Hashids switch from MonadHandler to MonadSite 2019-06-14 17:21:38 +00:00
fr33domlover
6df2200f47 Yesod.MonadSite module gets some nice upgrades
- Fork and async are no longer class methods, which simplifies things a lot and
  allows for many more trivial instances, much like with MonadHandler. Fork and
  async are still available, but instead of unnecessarily being class methods,
  they are now provided as follows: You can fork and async a worker (no more
  fork/async for handler, because I never actually need that, and not sure
  there's ever a need for that in general), and you can do that from any
  MonadSite. So, you can fork or async a worker from a Handler, from a Worker,
  from a ReaderT on top of them e.g. inside runDB, and so on.
- Following the simplification, new MonadSite instances are provided, so far
  just the ones in actual use in the code. ReaderT, ExceptT and lazy RWST. More
  can be added easily. Oh, and WidgetFor got an instance too.

In particular, this change means there's no usage of `forkHandler` anymore, at
all. I wonder if it ever makes a difference to `forkWorker` versus
`forkHandler`. Like, does it cause memory leaks or anything. I guess could
check why `forkResource` etc. is good for in `forkHandler` implementation. I
suppose if needed, I could fix possible memory leaks in `forkWorker`.
2019-06-14 17:10:12 +00:00
fr33domlover
42febca91f Run DB migrations in Worker monad, to allow convenient MonadSite access 2019-06-12 22:17:06 +00:00
fr33domlover
b40ef116b1 For tickets by remote authors, link in the DB to the RemoteActivity, the Offer 2019-06-12 22:14:19 +00:00
fr33domlover
5df8965488 Some cleanup and term updates in Web.ActivityPub to match the spec and plans
* No more full URIs, all terms are used as short non-prefixed names
* Some terms support parsing full URI form for compatibility with objects in DB
* No more @context checking when parsing
* Use the new ForgeFed context URI specified in the spec draft
* Use an extension context URI for all custom properties not specific to forges
* Rename "events" property to "history", thanks cjslep for suggesting this name
2019-06-12 00:11:24 +00:00
fr33domlover
61d1029926 Project team and followers
* Have a project team collection, content is the same as ticket team (but
  potentially ticket team allows people to opt out of updates on specific
  tickets, while project team isn't tied to any specific ticket or other child
  object)
* Have a project followers collection, and address it in ticket comments in
  addition to the already used recipients (project, ticket team, ticket
  followers)
2019-06-11 12:19:51 +00:00
fr33domlover
970fa240fc Deliver to project inbox in postOutboxR and postProjectInboxR 2019-06-09 21:06:26 +00:00
fr33domlover
322d09658e (Hopefully correctly) fill project inboxes with ticket comment Create Notes 2019-06-09 18:41:37 +00:00
fr33domlover
bad1844cfc Reuse the getSharerInboxR code to implement getProjectInboxR 2019-06-09 16:45:53 +00:00
fr33domlover
f4e324e587 Give each project an inbox in DB 2019-06-09 16:21:23 +00:00
fr33domlover
f70aa42060 Add UniquePersonInbox to persistent model; each user has their own unique inbox 2019-06-09 15:56:42 +00:00
fr33domlover
71ab1c4459 Syntax-highlight the pretty JSON display of AP objects 2019-06-09 14:32:57 +00:00
fr33domlover
090c562553 Add an Inbox table in DB, make inbox related tables use it instead of Person
This allows the inbox system to be separate from Person, allowing other kinds
of objects to have inboxes too. Much like there's FollowerSet which works
separately from Tickets, and will allow to have follower sets for projects,
users, etc. too.

Inboxes are made independent from Person users because I'm going to give
Projects inboxes too.
2019-06-09 13:16:32 +00:00
fr33domlover
b1897a20c0 Allow ticket author to be a remote actor 2019-06-07 04:26:32 +00:00
fr33domlover
d73b113b4f Wrap AP Ticket in an Offer activity, this is how tickets will be created 2019-06-06 14:16:48 +00:00
fr33domlover
b69442b448 Move AP Ticket local URI fields into a dedicated TicketLocal type 2019-06-06 10:25:16 +00:00
fr33domlover
e31c8c600b Turn some AP ticket fields into Maybes 2019-06-04 09:36:14 +00:00
fr33domlover
04a2e9a817 In HTML pages with AP support, display link to pretty formatted JSON 2019-06-03 22:22:32 +00:00
fr33domlover
708f626294 Provide ActivityPub representation of tickets in getTicketR 2019-06-03 21:52:34 +00:00
fr33domlover
f7432e515c Add ticketDescription DB entity field, containing pandoc-rendered HTML 2019-06-03 12:45:02 +00:00
fr33domlover
17fe163c09 Rename ticketDesc to ticketSource 2019-06-03 11:02:28 +00:00
fr33domlover
5111cd9bc7 Forgot to record this line of code when renamed ProjectRole entity to Role 2019-06-03 11:01:21 +00:00
fr33domlover
46f116da60 In new comment form, turn CRLF into LF when running the form 2019-06-02 14:59:47 +00:00
fr33domlover
c7dccbb7fe Render in advance and store comment content as HTML alongside Markdown source 2019-06-02 14:41:51 +00:00
fr33domlover
facf4d7f3e Rename messageContent field to messageSource; content will soon be HTML 2019-06-02 12:04:35 +00:00
fr33domlover
21b7325c1b Rename role related tables to reflect the role unification
There used to be project roles and repo roles, and they were separate. A while
ago I merged them, and there has been a single role system, used with both
repos and projects. However the table names were still "ProjectRole" and things
like that. This patch renames some tables to just refer to a "Role" because
there's only one kind of role system.
2019-05-31 15:02:57 +00:00
fr33domlover
eb514b8c3f Use path segment in HighlightStyleR, addStylesheet doesn't support query params 2019-05-27 19:54:11 +00:00
fr33domlover
e02a0fa4db Make pandoc highlight style configurable in settings and in query parameter 2019-05-27 18:30:48 +00:00
fr33domlover
b8b226d15c Highlight code segments in pandoc rendered source file views 2019-05-27 13:28:57 +00:00
fr33domlover
18e9c16afb Define breadcrumbs for TicketTeamR and TicketParticipantsR 2019-05-26 10:32:56 +00:00
fr33domlover
70d51faa70 In notifications page, remove accidental display of hidden field labels 2019-05-25 22:27:20 +00:00
fr33domlover
b7e2776e6a Implement getTicketTeamR & getTicketParticipantsR (AS2 & HTML showing the JSON) 2019-05-25 22:05:59 +00:00
fr33domlover
ae1e10cab2 Vervis.Handler.Ticket: Import esqueleto qualified 2019-05-25 22:04:06 +00:00
fr33domlover
9689e9d471 Fix redirection bug in SharerInboxR 2019-05-25 20:24:13 +00:00
fr33domlover
95a0806ef3 Fix MessageR, setting audience to the one specified in the Create activity 2019-05-25 13:01:15 +00:00
fr33domlover
e848fe5fed Add unique UniqueLocalMessageCreate 2019-05-25 12:59:54 +00:00
fr33domlover
2eade80cfb Rewrite the localMessageCreate migration to insert real activities
A thing still missing there is that it sets empty audience for comments on
remote tickets, but that's fine because dev.angeley.es doesn't have such
comments in the database.
2019-05-25 12:44:09 +00:00
fr33domlover
e81eb80b8b Add field localMessageCreate, pointing to the OutboxItem that created it
I added a migration that creates an ugly fake OutboxItem for messages that
don't have one. I'll try to turn it into a real one. And then very possibly
remove the whole ugly migration, replacing it with addFielfRefRequiredEmpty,
which should work for empty instances.
2019-05-25 03:23:57 +00:00
fr33domlover
d77877eba5 In persistent models for migrations, suffix the names of uniques too 2019-05-25 03:20:01 +00:00
fr33domlover
5479c99e1c Serve trivial HTML (that just displays the JSON object) in getMessageR 2019-05-24 16:09:58 +00:00
fr33domlover
bd99729656 Loading settings was using deprecated functions, switch to new ones 2019-05-24 15:45:36 +00:00
fr33domlover
23e760e373 Build with LTS 13, GHC 8.6 2019-05-24 11:49:39 +00:00
fr33domlover
b64984495f Switch all HandlerT/WidgetT uses to HandlerFor/WidgetFor 2019-05-23 09:12:24 +00:00
fr33domlover
c531f41565 Implement basic notifications in DB and UI 2019-05-22 21:50:30 +00:00
fr33domlover
6d55b8c5d7 Display remote actor name in remote message view 2019-05-21 09:11:13 +00:00
fr33domlover
d1fea9eb51 Store names of remote actors in DB for display 2019-05-21 08:44:11 +00:00
fr33domlover
2573ff1d93 Parse and publish actor outboxes 2019-05-21 00:36:05 +00:00
fr33domlover
40d9a0990d Serve AS2 in getSharerInboxR 2019-05-21 00:14:49 +00:00
fr33domlover
7bcbe52274 Implement getOutboxR, both (trivial) HTML and AS2 2019-05-20 23:51:06 +00:00
fr33domlover
f07b56c259 Implement getOutboxItemR, serving AS2 and basic HTML 2019-05-18 10:09:47 +00:00
fr33domlover
6d304b9307 Smarter treatment of recipients that are collections
- Allow client to specify recipients that don't need to be delivered to
- When fetching recipient, recognize collections and don't try to deliver to
  them
- Remember collections in DB, and use that to skip HTTP delivery
2019-05-17 22:42:01 +00:00
fr33domlover
48882d65ad Allow AP C2S client to list recipients that aren't actors to deliver to 2019-05-17 10:47:53 +00:00
fr33domlover
07281f6900 Fix infinite loop in ActivityPub audience parsing 2019-05-16 21:22:45 +00:00
fr33domlover
b12ad49b62 Remove unused accidentally left line 2019-05-16 21:21:51 +00:00
fr33domlover
ebc3f016b6 In outbox POST handler logging, fix the display of OutboxItemId number 2019-05-12 20:24:33 +00:00
fr33domlover
d70d34bb6b Debug logs for periodic delivery 2019-05-11 22:26:06 +00:00
fr33domlover
48cfccd3d2 Use forkFinally in ResultShare to be sure we always catch exceptions & set MVar 2019-05-10 21:33:08 +00:00
fr33domlover
f88dcef0d7 Do some debug logging during delivery in outbox POST handler 2019-05-10 20:38:55 +00:00
fr33domlover
770983e829 In outbox POST handler, run async delivery using Worker instead of Handler
Worker is enough and seems much simpler. forkHandler does stuff with
forkResourceT and more stuff that I don't exactly understand and which may
involve more resource allocation. I guess forkWorker would generally be the
preferred approach, and there are bugs with delivery leading to sudden
CPU/memory peaks forcing me to kill the process. Maybe not related, just
mentioning it ^_^
2019-05-10 04:36:21 +00:00
fr33domlover
e29053145f Log errors for linked delivery from outbox, both in handler and periodic 2019-05-09 23:09:34 +00:00
fr33domlover
635952a797 When parsing a LocalURI, use a *valid* dummy host
The previous dummy host was "h", which doesn't contain periods, so the `FedURI`
parser rejects it.
2019-05-09 22:03:19 +00:00
fr33domlover
273fcf972f When delivering activities, sign the Digest header
Looks like I forgot to add it to the list of headers to sign
2019-05-09 21:26:33 +00:00
fr33domlover
ddb6bb0472 When publishing a comment via PublishR, don't specify 'published' time
The server expects not to see it, and wants to set it by itself
2019-05-07 03:12:47 +00:00
fr33domlover
0e4070db75 In ticket discussion, have links to the individual messages (MessageR route) 2019-05-07 02:54:45 +00:00
fr33domlover
9bc78bf303 When posting ticket comment in regular UI, don't specify published time
The outbox handler wants to set it, and it expects it not be set by the client.
2019-05-07 01:51:21 +00:00
fr33domlover
a6bfb0cf36 Show note about federation being disabled, and list other known instances 2019-05-05 22:00:26 +00:00
fr33domlover
6bba8ff47f Fix breadcrumb of TicketMessageR 2019-05-05 21:02:26 +00:00
fr33domlover
67a77b1897 In layout header, link to federation status info page 2019-05-05 11:36:10 +00:00
fr33domlover
8303baa69d Implement GETing the personal inbox 2019-05-05 10:20:55 +00:00
fr33domlover
f6eaca2fa8 When project receives remote ticket comment, add author to followers 2019-05-03 23:55:49 +00:00
fr33domlover
5770c62692 Plug the project inbox handler code into the actual POST handler function 2019-05-03 23:18:57 +00:00
fr33domlover
b0a26722d3 Do inbox forwarding in project inbox handler 2019-05-03 21:04:53 +00:00
fr33domlover
5d5c56695e Remember for deliveries in the DB, whether they should sign forwarding 2019-05-02 09:31:56 +00:00
fr33domlover
93cf861ed0 When delivering a comment on a remote ticket, enable inbox forwarding
In the new inbox forwarding scheme, we use an additional special HTTP signature
to indicate that we allow or expect forwarding, and to allow that forwarding to
later be verified. When delivering a comment on a remote ticket, we'd like the
project to do inbox forwarding. Based on the URI alone, it's impossible to tell
which recipient is the project, and I guess there are various tricks we could
use here, but for now a very simple solution is used: Enable forwarding for all
remote recipients whose host is the same as the ticket's host.
2019-05-02 02:06:47 +00:00
fr33domlover
3d9438714b In sharer inbox, accept forwarded activities, including ones of local users 2019-05-01 23:13:22 +00:00
fr33domlover
f789a773e4 Stop using YesodHttpSig, move code from Foundation to Federation 2019-04-29 07:39:20 +00:00
fr33domlover
951364036f Update activity POSTing code to use the new forwarding mechanism
It's not documented yet, but basically I replaced the custom input string with
an HTTPSig based one.
2019-04-28 10:18:50 +00:00
fr33domlover
1fcec035f0 Do some checks on the host in FedURI parsing
Until now, there were some simple host checks when verifying the HTTP sig,
meant to forbid hosts that are IP addresses, local hosts, and maybe other weird
cases. These checks moved to Network.FedURI, so now FedURIs in general aren't
allowed to have such hosts. The host type is still `Text` though, for now.
2019-04-28 09:47:32 +00:00
fr33domlover
342467297a Put inbox activity auth code in a dedicated function in Vervis.Federation 2019-04-26 21:41:01 +00:00
fr33domlover
9d5399d636 Give project actors signing keys, just like user actors, needed for forwarding
Since project actors are the ones sending inbox forwards, they need to announce
keys and allow their HTTP Signatures to be verified.
2019-04-26 13:04:00 +00:00
fr33domlover
811217fd17 Return keyid and digest after inbox verification, for use in forwarding 2019-04-26 04:15:07 +00:00
fr33domlover
f346da9106 New module Yesod.ActivityPub, use it in Vervis.Federation for delivery POSTing 2019-04-26 03:23:49 +00:00
fr33domlover
71d21ad459 In httpPostAP, support the new signature headers 2019-04-26 00:25:50 +00:00
fr33domlover
46fb4d1512 Add settings switch for activity debug reports 2019-04-25 22:46:27 +00:00
fr33domlover
d24710c46a When receiving activity to inbox, verify the body digest
This patch does a small simple change, however at the cost of the request body
not being available for display in the latest activity list, unless processing
succeeds. I'll fix this situation in a separate patch.
2019-04-25 18:05:02 +00:00
fr33domlover
57374ec816 When POSTing activities, set a Digest header using SHA-256 2019-04-25 15:49:15 +00:00
fr33domlover
825a91d185 Incomplete project inbox handler 2019-04-24 00:47:21 +00:00
fr33domlover
f462a67680 Implement sharer inbox handler
It runs checks against all the relevant tables, but ultimately just inserts the
activity into the recipient's inbox and nothing more, leaving the RemoteMessage
creation and inbox forwarding to the project inbox handler.
2019-04-23 02:57:53 +00:00
fr33domlover
e06f40b665 Switch from single inbox to individual inbox URIs; disable inbox post for now
Inbox post is disabled but in the next patches I'll code and integrate a fixed
complete one, hopefully finally getting ticket comment federation ready for
testing.

I'm making this change because if an actor receives an activity due to being
addressed in bto, ot bcc, or being listed in some remote collection, the server
doesn't have a way to tell which actor(s) are the intended recipients, without
having an individual inbox URL for each actor. I could use a different hack for
this, but it wouldn't be compatible with other AP servers (unless the whole
fediverse agrees on a method).

I wasn't using sharedInbox anyway, and it's an optimization either way.
2019-04-21 10:58:57 +00:00
fr33domlover
f7f15e0f63 When sending ticket comment in regular Vervis UI, deliver it using ActivityPub 2019-04-20 21:34:45 +00:00
fr33domlover
4f5c6532ee Switch postOutboxR to the new handler 2019-04-19 03:14:12 +00:00
fr33domlover
fc2ace3370 Insert ticket commenter to ticket followers, and never deliver to themselves 2019-04-18 23:37:33 +00:00
fr33domlover
47a9e0b5a0 Group by sharer ID too, hopefully this time it's enough 2019-04-18 20:20:58 +00:00
fr33domlover
4386e0f8af If federation is disabled, don't run periodic delivery 2019-04-18 19:50:31 +00:00
fr33domlover
50f12f855d In ticket summary SQL query, group by ticket ID, not by discussion ID
Each ticket has a single discussion ID, and each ticket has a unique one, so,
given an inner join of tickets and discussions, I think there should be exactly
1 way select a (ticket, discussion) pair given any of these.

But for some reason, PostgreSQL started complaining. Not sure what changed.
Anyway, for now, I switched the groupBy from discussion.id to ticket.id, which
is essentially the same, but for some reason makes PostgreSQL happy. It can't
tell that given a discussion ID, there's exactly 1 way to choose the ticket. Or
something like that. I wonder if I messed up something in DB migrations.
2019-04-18 19:35:04 +00:00
fr33domlover
b8c669f6fc New outbox post: Raise error if federation disabled but remote recipients found 2019-04-18 11:43:33 +00:00
fr33domlover
f37b9b3f52 Run the delivery worker priodically, settings control how often to run 2019-04-18 10:38:01 +00:00