2016-02-17 21:53:53 +00:00
|
|
|
{- This file is part of Vervis.
|
|
|
|
-
|
2023-04-29 10:40:44 +00:00
|
|
|
- Written in 2016, 2019, 2022, 2023 by fr33domlover <fr33domlover@riseup.net>.
|
2016-02-17 21:53:53 +00:00
|
|
|
-
|
|
|
|
- ♡ Copying is an act of love. Please copy, reuse and share.
|
|
|
|
-
|
|
|
|
- The author(s) have dedicated all copyright and related and neighboring
|
|
|
|
- rights to this software to the public domain worldwide. This software is
|
|
|
|
- distributed without any warranty.
|
|
|
|
-
|
|
|
|
- You should have received a copy of the CC0 Public Domain Dedication along
|
|
|
|
- with this software. If not, see
|
|
|
|
- <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
|
|
-}
|
|
|
|
|
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
|
|
|
module Vervis.Handler.Deck
|
|
|
|
( getDeckR
|
|
|
|
, getDeckInboxR
|
|
|
|
, postDeckInboxR
|
|
|
|
, getDeckOutboxR
|
|
|
|
, getDeckOutboxItemR
|
|
|
|
, getDeckFollowersR
|
|
|
|
, getDeckTicketsR
|
|
|
|
|
|
|
|
, getDeckTreeR
|
|
|
|
|
2022-10-16 11:26:24 +00:00
|
|
|
, getDeckMessageR
|
|
|
|
|
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
|
|
|
, getDeckNewR
|
|
|
|
, postDeckNewR
|
|
|
|
, postDeckDeleteR
|
|
|
|
, getDeckEditR
|
|
|
|
, postDeckEditR
|
|
|
|
, postDeckFollowR
|
|
|
|
, postDeckUnfollowR
|
|
|
|
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
, getDeckStampR
|
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
|
|
|
|
2022-10-20 12:53:54 +00:00
|
|
|
, getDeckCollabsR
|
2023-06-16 20:12:40 +03:00
|
|
|
, getDeckInviteR
|
|
|
|
, postDeckInviteR
|
2022-10-20 12:53:54 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{-
|
|
|
|
, getProjectsR
|
2016-02-17 21:53:53 +00:00
|
|
|
, getProjectR
|
2016-06-05 10:43:28 +00:00
|
|
|
, putProjectR
|
2016-06-01 08:52:14 +00:00
|
|
|
, postProjectDevsR
|
|
|
|
, getProjectDevNewR
|
|
|
|
, getProjectDevR
|
|
|
|
, deleteProjectDevR
|
|
|
|
, postProjectDevR
|
2019-06-11 12:19:51 +00:00
|
|
|
, getProjectTeamR
|
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
|
|
|
-}
|
2016-02-17 21:53:53 +00:00
|
|
|
)
|
|
|
|
where
|
|
|
|
|
2022-07-25 17:15:22 +00:00
|
|
|
import Control.Monad
|
|
|
|
import Control.Monad.Trans.Except
|
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
|
|
|
import Data.Aeson
|
2022-10-20 12:53:54 +00:00
|
|
|
import Data.Bitraversable
|
2022-09-06 10:52:14 +00:00
|
|
|
import Data.ByteString (ByteString)
|
2022-09-17 10:14:27 +00:00
|
|
|
import Data.Default.Class
|
2022-06-22 06:19:37 +00:00
|
|
|
import Data.Foldable
|
2016-05-14 11:36:45 +00:00
|
|
|
import Data.Maybe (fromMaybe)
|
|
|
|
import Data.Text (Text)
|
2022-06-22 06:19:37 +00:00
|
|
|
import Data.Time.Clock
|
|
|
|
import Data.Traversable
|
2016-05-14 11:36:45 +00:00
|
|
|
import Database.Persist
|
|
|
|
import Text.Blaze.Html (Html)
|
2022-07-25 17:15:22 +00:00
|
|
|
import Yesod.Auth (requireAuth)
|
2019-03-20 12:01:10 +00:00
|
|
|
import Yesod.Core
|
2016-06-01 08:52:14 +00:00
|
|
|
import Yesod.Core.Handler (redirect, setMessage, lookupPostParam, notFound)
|
2022-09-17 10:14:27 +00:00
|
|
|
import Yesod.Form.Functions (runFormPost, runFormGet)
|
2016-05-14 11:36:45 +00:00
|
|
|
import Yesod.Form.Types (FormResult (..))
|
2016-08-08 19:05:22 +00:00
|
|
|
import Yesod.Persist.Core (runDB, get404, getBy404)
|
2016-05-14 11:36:45 +00:00
|
|
|
|
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
|
|
|
import qualified Data.ByteString.Lazy as BL
|
2016-05-14 11:36:45 +00:00
|
|
|
import qualified Database.Esqueleto as E
|
2016-02-17 21:53:53 +00:00
|
|
|
|
2022-06-22 06:19:37 +00:00
|
|
|
import Database.Persist.JSON
|
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
|
|
|
import Development.PatchMediaType
|
2019-03-20 12:01:10 +00:00
|
|
|
import Network.FedURI
|
2022-07-24 16:52:28 +00:00
|
|
|
import Web.ActivityPub hiding (Project (..), Repo (..), Actor (..), ActorDetail (..), ActorLocal (..))
|
2019-06-11 12:19:51 +00:00
|
|
|
import Yesod.ActivityPub
|
2019-03-20 12:01:10 +00:00
|
|
|
import Yesod.FedURI
|
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
|
|
|
import Yesod.Hashids
|
2022-06-22 06:19:37 +00:00
|
|
|
import Yesod.MonadSite
|
2019-03-20 12:01:10 +00:00
|
|
|
|
2019-06-11 12:19:51 +00:00
|
|
|
import qualified Web.ActivityPub as AP
|
|
|
|
|
2022-07-25 17:15:22 +00:00
|
|
|
import Control.Monad.Trans.Except.Local
|
2019-06-11 12:19:51 +00:00
|
|
|
import Data.Either.Local
|
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
|
|
|
import Data.Paginate.Local
|
2019-06-11 12:19:51 +00:00
|
|
|
import Database.Persist.Local
|
2022-09-16 10:34:44 +00:00
|
|
|
import Yesod.Form.Local
|
2019-06-11 12:19:51 +00:00
|
|
|
import Yesod.Persist.Local
|
|
|
|
|
2022-09-08 12:00:14 +00:00
|
|
|
import Vervis.Access
|
2019-06-15 04:39:13 +00:00
|
|
|
import Vervis.API
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.Federation.Auth
|
2022-09-08 12:00:14 +00:00
|
|
|
import Vervis.Federation.Collab
|
2022-10-16 12:14:30 +00:00
|
|
|
import Vervis.Federation.Discussion
|
2022-10-25 19:02:07 +00:00
|
|
|
import Vervis.Federation.Offer
|
2022-09-23 15:58:54 +00:00
|
|
|
import Vervis.Federation.Ticket
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.FedURI
|
2022-09-17 10:14:27 +00:00
|
|
|
import Vervis.Form.Ticket
|
2022-10-17 15:08:00 +00:00
|
|
|
import Vervis.Form.Tracker
|
2016-05-14 11:36:45 +00:00
|
|
|
import Vervis.Foundation
|
|
|
|
import Vervis.Model
|
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
|
|
|
import Vervis.Paginate
|
2022-10-20 12:53:54 +00:00
|
|
|
import Vervis.Persist.Actor
|
|
|
|
import Vervis.Persist.Collab
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.Recipient
|
2016-05-14 11:36:45 +00:00
|
|
|
import Vervis.Settings
|
2022-09-17 10:14:27 +00:00
|
|
|
import Vervis.Ticket
|
|
|
|
import Vervis.TicketFilter
|
2022-10-20 12:53:54 +00:00
|
|
|
import Vervis.Time
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.Web.Actor
|
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
|
|
|
import Vervis.Widget.Person
|
2022-09-17 10:14:27 +00:00
|
|
|
import Vervis.Widget.Ticket
|
2022-10-17 15:08:00 +00:00
|
|
|
import Vervis.Widget.Tracker
|
2016-02-17 21:53:53 +00:00
|
|
|
|
2022-08-16 13:17:26 +00:00
|
|
|
import qualified Vervis.Client as C
|
|
|
|
|
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
|
|
|
getDeckR :: KeyHashid Deck -> Handler TypedContent
|
|
|
|
getDeckR deckHash = do
|
|
|
|
deckID <- decodeKeyHashid404 deckHash
|
2022-10-12 18:01:52 +00:00
|
|
|
(deck, repoIDs, actor, sigKeyIDs) <- runDB $ do
|
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
|
|
|
d <- get404 deckID
|
|
|
|
rs <- selectKeysList [RepoProject ==. Just deckID] [Asc RepoId]
|
2022-10-12 18:01:52 +00:00
|
|
|
let aid = deckActor d
|
|
|
|
a <- getJust aid
|
|
|
|
sigKeys <- selectKeysList [SigKeyActor ==. aid] [Asc SigKeyId]
|
|
|
|
return (d, rs, a, sigKeys)
|
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
|
|
|
|
|
|
|
encodeRouteLocal <- getEncodeRouteLocal
|
2022-10-12 18:01:52 +00:00
|
|
|
hashSigKey <- getEncodeKeyHashid
|
|
|
|
perActor <- asksSite $ appPerActorKeys . appSettings
|
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
|
|
|
let deckAP = AP.TicketTracker
|
|
|
|
{ AP.ticketTrackerActor = AP.Actor
|
|
|
|
{ AP.actorLocal = AP.ActorLocal
|
|
|
|
{ AP.actorId = encodeRouteLocal $ DeckR deckHash
|
|
|
|
, AP.actorInbox = encodeRouteLocal $ DeckInboxR deckHash
|
|
|
|
, AP.actorOutbox =
|
|
|
|
Just $ encodeRouteLocal $ DeckOutboxR deckHash
|
|
|
|
, AP.actorFollowers =
|
|
|
|
Just $ encodeRouteLocal $ DeckFollowersR deckHash
|
|
|
|
, AP.actorFollowing = Nothing
|
|
|
|
, AP.actorPublicKeys =
|
2022-10-12 18:01:52 +00:00
|
|
|
map (Left . encodeRouteLocal) $
|
|
|
|
if perActor
|
|
|
|
then map (DeckStampR deckHash . hashSigKey) sigKeyIDs
|
|
|
|
else [ActorKey1R, ActorKey2R]
|
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
|
|
|
, AP.actorSshKeys = []
|
|
|
|
}
|
|
|
|
, AP.actorDetail = AP.ActorDetail
|
|
|
|
{ AP.actorType = ActorTypeTicketTracker
|
|
|
|
, AP.actorUsername = Nothing
|
|
|
|
, AP.actorName = Just $ actorName actor
|
|
|
|
, AP.actorSummary = Just $ actorDesc actor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
, AP.ticketTrackerTeam = Nothing
|
|
|
|
}
|
|
|
|
followButton =
|
|
|
|
followW
|
|
|
|
(DeckFollowR deckHash)
|
|
|
|
(DeckUnfollowR deckHash)
|
|
|
|
(actorFollowers actor)
|
|
|
|
|
2022-10-16 22:24:41 +00:00
|
|
|
provideHtmlAndAP deckAP $ redirect $ DeckTicketsR deckHash
|
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
|
|
|
|
|
|
|
getDeckInboxR :: KeyHashid Deck -> Handler TypedContent
|
|
|
|
getDeckInboxR = getInbox DeckInboxR deckActor
|
|
|
|
|
2022-09-06 10:52:14 +00:00
|
|
|
postDeckInboxR :: KeyHashid Deck -> Handler ()
|
2023-04-29 10:40:44 +00:00
|
|
|
postDeckInboxR deckHash = do
|
|
|
|
deckID <- decodeKeyHashid404 deckHash
|
|
|
|
postInbox $ LocalActorDeck deckID
|
|
|
|
|
|
|
|
{-
|
2022-09-08 12:00:14 +00:00
|
|
|
AP.AcceptActivity accept ->
|
|
|
|
deckAcceptF now recipDeckHash author body mfwd luActivity accept
|
2022-10-16 12:14:30 +00:00
|
|
|
AP.CreateActivity (AP.Create obj mtarget) ->
|
2022-09-06 10:52:14 +00:00
|
|
|
case obj of
|
2022-10-16 12:14:30 +00:00
|
|
|
AP.CreateNote _ note ->
|
|
|
|
(,Nothing) <$> deckCreateNoteF now recipDeckHash author body mfwd luActivity note
|
2022-10-16 12:24:41 +00:00
|
|
|
_ -> return ("Unsupported create object type for decks", Nothing)
|
2022-10-25 19:02:07 +00:00
|
|
|
AP.FollowActivity follow ->
|
|
|
|
deckFollowF now recipDeckHash author body mfwd luActivity follow
|
2022-09-08 12:00:14 +00:00
|
|
|
AP.InviteActivity invite ->
|
|
|
|
topicInviteF now (GrantResourceDeck recipDeckHash) author body mfwd luActivity invite
|
2022-11-14 15:11:25 +00:00
|
|
|
AP.JoinActivity join ->
|
|
|
|
deckJoinF now recipDeckHash author body mfwd luActivity join
|
2022-09-06 10:52:14 +00:00
|
|
|
OfferActivity (Offer obj target) ->
|
|
|
|
case obj of
|
|
|
|
OfferTicket ticket ->
|
2022-09-23 15:58:54 +00:00
|
|
|
(,Nothing) <$> deckOfferTicketF now recipDeckHash author body mfwd luActivity ticket target
|
|
|
|
{-
|
2022-09-06 10:52:14 +00:00
|
|
|
OfferDep dep ->
|
|
|
|
projectOfferDepF now shrRecip prjRecip remoteAuthor body mfwd luActivity dep target
|
2022-09-23 15:58:54 +00:00
|
|
|
-}
|
|
|
|
_ -> return ("Unsupported offer object type for decks", Nothing)
|
2022-10-25 16:12:48 +00:00
|
|
|
AP.ResolveActivity resolve ->
|
|
|
|
deckResolveF now recipDeckHash author body mfwd luActivity resolve
|
2022-10-27 16:27:58 +00:00
|
|
|
AP.UndoActivity undo ->
|
|
|
|
(,Nothing) <$> deckUndoF now recipDeckHash author body mfwd luActivity undo
|
2022-09-06 10:52:14 +00:00
|
|
|
_ -> return ("Unsupported activity type for decks", Nothing)
|
2023-04-29 10:40:44 +00:00
|
|
|
-}
|
2016-02-17 21:53:53 +00:00
|
|
|
|
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
|
|
|
getDeckOutboxR :: KeyHashid Deck -> Handler TypedContent
|
2022-09-26 14:20:21 +00:00
|
|
|
getDeckOutboxR = getOutbox DeckOutboxR DeckOutboxItemR deckActor
|
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
|
|
|
|
|
|
|
getDeckOutboxItemR
|
|
|
|
:: KeyHashid Deck -> KeyHashid OutboxItem -> Handler TypedContent
|
|
|
|
getDeckOutboxItemR = getOutboxItem DeckOutboxItemR deckActor
|
|
|
|
|
|
|
|
getDeckFollowersR :: KeyHashid Deck -> Handler TypedContent
|
|
|
|
getDeckFollowersR = getActorFollowersCollection DeckFollowersR deckActor
|
|
|
|
|
|
|
|
getDeckTicketsR :: KeyHashid Deck -> Handler TypedContent
|
|
|
|
getDeckTicketsR deckHash = selectRep $ do
|
|
|
|
provideRep $ do
|
2022-10-17 15:08:00 +00:00
|
|
|
let tf = def
|
|
|
|
{-
|
|
|
|
((filtResult, filtWidget), filtEnctype) <- runFormPost ticketFilterForm
|
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
|
|
|
let tf =
|
|
|
|
case filtResult of
|
|
|
|
FormSuccess filt -> filt
|
|
|
|
FormMissing -> def
|
|
|
|
FormFailure l ->
|
|
|
|
error $ "Ticket filter form failed: " ++ show l
|
2022-10-17 15:08:00 +00:00
|
|
|
-}
|
2022-09-17 10:14:27 +00:00
|
|
|
deckID <- decodeKeyHashid404 deckHash
|
2022-10-17 15:08:00 +00:00
|
|
|
(deck, actor, (total, pages, mpage)) <- runDB $ do
|
|
|
|
deck <- get404 deckID
|
|
|
|
actor <- getJust $ deckActor deck
|
2022-09-17 10:14:27 +00:00
|
|
|
let countAllTickets = count [TicketDeckDeck ==. deckID]
|
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
|
|
|
selectTickets off lim =
|
|
|
|
getTicketSummaries
|
|
|
|
(filterTickets tf)
|
2022-09-17 10:14:27 +00:00
|
|
|
(Just $ \ t -> [E.desc $ t E.^. TicketId])
|
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
|
|
|
(Just (off, lim))
|
2022-09-17 10:14:27 +00:00
|
|
|
deckID
|
2022-10-17 15:08:00 +00:00
|
|
|
(deck,actor,) <$> getPageAndNavCount countAllTickets selectTickets
|
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
|
|
|
case mpage of
|
|
|
|
Nothing -> redirectFirstPage here
|
|
|
|
Just (rows, navModel) ->
|
|
|
|
let pageNav = navWidget navModel
|
|
|
|
in defaultLayout $(widgetFile "ticket/list")
|
|
|
|
provideAP' $ do
|
|
|
|
deckID <- decodeKeyHashid404 deckHash
|
|
|
|
(total, pages, mpage) <- runDB $ do
|
2022-09-17 10:14:27 +00:00
|
|
|
_ <- get404 deckID
|
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
|
|
|
let countAllTickets = count [TicketDeckDeck ==. deckID]
|
|
|
|
selectTickets off lim =
|
|
|
|
selectKeysList
|
|
|
|
[TicketDeckDeck ==. deckID]
|
|
|
|
[OffsetBy off, LimitTo lim, Desc TicketDeckTicket]
|
|
|
|
getPageAndNavCount countAllTickets selectTickets
|
|
|
|
|
|
|
|
encodeRouteHome <- getEncodeRouteHome
|
|
|
|
encodeRouteLocal <- getEncodeRouteLocal
|
|
|
|
hashTicket <- getEncodeKeyHashid
|
|
|
|
encodeRoutePageLocal <- getEncodeRoutePageLocal
|
|
|
|
let pageUrl = encodeRoutePageLocal here
|
|
|
|
host <- asksSite siteInstanceHost
|
|
|
|
return $
|
|
|
|
case mpage of
|
|
|
|
Nothing -> encodeStrict $ Doc host $ Collection
|
|
|
|
{ collectionId = encodeRouteLocal here
|
|
|
|
, collectionType = CollectionTypeOrdered
|
|
|
|
, collectionTotalItems = Just total
|
|
|
|
, collectionCurrent = Nothing
|
|
|
|
, collectionFirst = Just $ pageUrl 1
|
|
|
|
, collectionLast = Just $ pageUrl pages
|
|
|
|
, collectionItems = [] :: [Text]
|
|
|
|
}
|
|
|
|
Just (tickets, navModel) ->
|
|
|
|
let current = nmCurrent navModel
|
|
|
|
in encodeStrict $ Doc host $ CollectionPage
|
|
|
|
{ collectionPageId = pageUrl current
|
|
|
|
, collectionPageType = CollectionPageTypeOrdered
|
|
|
|
, collectionPageTotalItems = Nothing
|
|
|
|
, collectionPageCurrent = Just $ pageUrl current
|
|
|
|
, collectionPageFirst = Just $ pageUrl 1
|
|
|
|
, collectionPageLast = Just $ pageUrl pages
|
|
|
|
, collectionPagePartOf = encodeRouteLocal here
|
|
|
|
, collectionPagePrev =
|
|
|
|
if current > 1
|
|
|
|
then Just $ pageUrl $ current - 1
|
|
|
|
else Nothing
|
|
|
|
, collectionPageNext =
|
|
|
|
if current < pages
|
|
|
|
then Just $ pageUrl $ current + 1
|
|
|
|
else Nothing
|
|
|
|
, collectionPageStartIndex = Nothing
|
|
|
|
, collectionPageItems =
|
|
|
|
encodeRouteHome . TicketR deckHash . hashTicket <$> tickets
|
|
|
|
}
|
|
|
|
where
|
|
|
|
here = DeckTicketsR deckHash
|
|
|
|
encodeStrict = BL.toStrict . encode
|
|
|
|
|
|
|
|
getDeckTreeR :: KeyHashid Deck -> Handler Html
|
|
|
|
getDeckTreeR _ = error "Temporarily disabled"
|
|
|
|
{-
|
|
|
|
(summaries, deps) <- runDB $ do
|
|
|
|
Entity sid _ <- getBy404 $ UniqueSharer shr
|
|
|
|
Entity jid _ <- getBy404 $ UniqueProject prj sid
|
|
|
|
(,) <$> getTicketSummaries Nothing Nothing Nothing jid
|
|
|
|
<*> getTicketDepEdges jid
|
|
|
|
defaultLayout $ ticketTreeDW shr prj summaries deps
|
|
|
|
-}
|
|
|
|
|
2022-10-16 11:26:24 +00:00
|
|
|
getDeckMessageR :: KeyHashid Deck -> KeyHashid LocalMessage -> Handler Html
|
|
|
|
getDeckMessageR _ _ = notFound
|
|
|
|
|
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
|
|
|
getDeckNewR :: Handler Html
|
|
|
|
getDeckNewR = do
|
2022-10-17 15:08:00 +00:00
|
|
|
((_result, widget), enctype) <- runFormPost newDeckForm
|
|
|
|
defaultLayout $(widgetFile "deck/new")
|
2022-08-16 13:17:26 +00:00
|
|
|
|
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
|
|
|
postDeckNewR :: Handler Html
|
|
|
|
postDeckNewR = do
|
2022-10-17 15:08:00 +00:00
|
|
|
NewDeck name desc <- runFormPostRedirect DeckNewR newDeckForm
|
2022-08-16 13:17:26 +00:00
|
|
|
|
|
|
|
personEntity@(Entity personID person) <- requireAuth
|
|
|
|
personHash <- encodeKeyHashid personID
|
|
|
|
(maybeSummary, audience, detail) <- C.createDeck personHash name desc
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
(localRecips, remoteRecips, fwdHosts, action) <-
|
|
|
|
C.makeServerInput Nothing maybeSummary audience $ AP.CreateActivity $ AP.Create (AP.CreateTicketTracker detail Nothing) Nothing
|
2022-08-16 13:17:26 +00:00
|
|
|
actor <- runDB $ getJust $ personActor person
|
|
|
|
result <-
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
runExceptT $ createTicketTrackerC personEntity actor Nothing localRecips remoteRecips fwdHosts action detail Nothing Nothing
|
2022-08-16 13:17:26 +00:00
|
|
|
|
|
|
|
case result of
|
2022-07-25 17:15:22 +00:00
|
|
|
Left e -> do
|
|
|
|
setMessage $ toHtml e
|
2022-08-16 13:17:26 +00:00
|
|
|
redirect DeckNewR
|
|
|
|
Right createID -> do
|
|
|
|
maybeDeckID <- runDB $ getKeyBy $ UniqueDeckCreate createID
|
|
|
|
case maybeDeckID of
|
|
|
|
Nothing -> error "Can't find the newly created deck"
|
|
|
|
Just deckID -> do
|
|
|
|
deckHash <- encodeKeyHashid deckID
|
|
|
|
setMessage "New ticket tracker created"
|
|
|
|
redirect $ DeckR deckHash
|
2016-02-25 03:10:30 +00:00
|
|
|
|
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
|
|
|
postDeckDeleteR :: KeyHashid Deck -> Handler Html
|
|
|
|
postDeckDeleteR _ = error "Temporarily disabled"
|
2016-02-25 03:10:30 +00:00
|
|
|
|
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
|
|
|
getDeckEditR :: KeyHashid Deck -> Handler Html
|
|
|
|
getDeckEditR _ = do
|
|
|
|
error "Temporarily disabled"
|
|
|
|
{-
|
|
|
|
(sid, ep) <- runDB $ do
|
|
|
|
Entity sid _sharer <- getBy404 $ UniqueSharer shr
|
|
|
|
ep <- getBy404 $ UniqueProject prj sid
|
|
|
|
return (sid, ep)
|
|
|
|
((_result, widget), enctype) <- runFormPost $ editProjectForm sid ep
|
|
|
|
defaultLayout $(widgetFile "project/edit")
|
|
|
|
-}
|
2016-06-01 08:52:14 +00:00
|
|
|
|
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
|
|
|
postDeckEditR :: KeyHashid Deck -> Handler Html
|
|
|
|
postDeckEditR _ = do
|
|
|
|
error "Temporarily disabled"
|
|
|
|
{-
|
2019-01-29 22:24:32 +00:00
|
|
|
(sid, ep@(Entity jid _)) <- runDB $ do
|
2016-06-05 10:43:28 +00:00
|
|
|
Entity sid _sharer <- getBy404 $ UniqueSharer shr
|
2019-01-29 22:24:32 +00:00
|
|
|
eproj <- getBy404 $ UniqueProject prj sid
|
|
|
|
return (sid, eproj)
|
|
|
|
((result, widget), enctype) <- runFormPost $ editProjectForm sid ep
|
2016-06-05 10:43:28 +00:00
|
|
|
case result of
|
|
|
|
FormSuccess project' -> do
|
|
|
|
runDB $ replace jid project'
|
|
|
|
setMessage "Project updated."
|
|
|
|
redirect $ ProjectR shr prj
|
|
|
|
FormMissing -> do
|
|
|
|
setMessage "Field(s) missing."
|
|
|
|
defaultLayout $(widgetFile "project/edit")
|
|
|
|
FormFailure _l -> do
|
|
|
|
setMessage "Project update failed, see errors below."
|
|
|
|
defaultLayout $(widgetFile "project/edit")
|
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
|
|
|
-}
|
|
|
|
|
|
|
|
postDeckFollowR :: KeyHashid Deck -> Handler ()
|
|
|
|
postDeckFollowR _ = error "Temporarily disabled"
|
|
|
|
|
|
|
|
postDeckUnfollowR :: KeyHashid Deck -> Handler ()
|
|
|
|
postDeckUnfollowR _ = error "Temporarily disabled"
|
|
|
|
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
getDeckStampR :: KeyHashid Deck -> KeyHashid SigKey -> Handler TypedContent
|
|
|
|
getDeckStampR = servePerActorKey deckActor LocalActorDeck
|
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
|
|
|
|
2022-10-20 12:53:54 +00:00
|
|
|
getDeckCollabsR :: KeyHashid Deck -> Handler Html
|
|
|
|
getDeckCollabsR deckHash = do
|
|
|
|
deckID <- decodeKeyHashid404 deckHash
|
2022-11-14 15:11:25 +00:00
|
|
|
(deck, actor, collabs, invites, joins) <- runDB $ do
|
2022-10-20 12:53:54 +00:00
|
|
|
deck <- get404 deckID
|
|
|
|
actor <- getJust $ deckActor deck
|
|
|
|
collabs <- do
|
|
|
|
grants <-
|
|
|
|
getTopicGrants CollabTopicDeckCollab CollabTopicDeckDeck deckID
|
|
|
|
traverse (bitraverse getPersonWidgetInfo pure) grants
|
|
|
|
invites <- do
|
|
|
|
invites' <-
|
|
|
|
getTopicInvites CollabTopicDeckCollab CollabTopicDeckDeck deckID
|
|
|
|
for invites' $ \ (inviter, recip, time) -> (,,)
|
|
|
|
<$> (getPersonWidgetInfo =<< bitraverse grabPerson pure inviter)
|
|
|
|
<*> getPersonWidgetInfo recip
|
|
|
|
<*> pure time
|
2022-11-14 15:11:25 +00:00
|
|
|
joins <- do
|
|
|
|
joins' <-
|
|
|
|
getTopicJoins CollabTopicDeckCollab CollabTopicDeckDeck deckID
|
|
|
|
for joins' $ \ (recip, time) ->
|
|
|
|
(,time) <$> getPersonWidgetInfo recip
|
|
|
|
return (deck, actor, collabs, invites, joins)
|
2022-10-20 12:53:54 +00:00
|
|
|
defaultLayout $(widgetFile "deck/collab/list")
|
|
|
|
where
|
|
|
|
grabPerson actorID = do
|
|
|
|
actorByKey <- getLocalActor actorID
|
|
|
|
case actorByKey of
|
|
|
|
LocalActorPerson personID -> return personID
|
|
|
|
_ -> error "Surprise, local inviter actor isn't a Person"
|
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
|
|
|
|
2023-06-16 20:12:40 +03:00
|
|
|
getDeckInviteR :: KeyHashid Deck -> Handler Html
|
|
|
|
getDeckInviteR deckHash = do
|
|
|
|
deckID <- decodeKeyHashid404 deckHash
|
|
|
|
((_result, widget), enctype) <- runFormPost $ deckInviteForm deckID
|
|
|
|
defaultLayout $(widgetFile "deck/collab/new")
|
|
|
|
|
|
|
|
postDeckInviteR :: KeyHashid Deck -> Handler Html
|
|
|
|
postDeckInviteR deckHash = do
|
|
|
|
deckID <- decodeKeyHashid404 deckHash
|
|
|
|
DeckInvite recipPersonID AP.RoleAdmin <-
|
|
|
|
runFormPostRedirect (DeckInviteR deckHash) $ deckInviteForm deckID
|
|
|
|
|
|
|
|
personEntity@(Entity personID person) <- requireAuth
|
|
|
|
personHash <- encodeKeyHashid personID
|
|
|
|
recipPersonHash <- encodeKeyHashid recipPersonID
|
|
|
|
encodeRouteHome <- getEncodeRouteHome
|
|
|
|
|
|
|
|
result <- runExceptT $ do
|
|
|
|
(maybeSummary, audience, invite) <- do
|
|
|
|
let uRecipient = encodeRouteHome $ PersonR recipPersonHash
|
|
|
|
uResource = encodeRouteHome $ DeckR deckHash
|
|
|
|
C.invite personID uRecipient uResource
|
|
|
|
grantID <- do
|
|
|
|
maybeItem <- lift $ runDB $ getGrant CollabTopicDeckCollab CollabTopicDeckDeck deckID recipPersonID
|
|
|
|
fromMaybeE maybeItem "You need to be a collaborator in the Deck to invite people"
|
|
|
|
grantHash <- encodeKeyHashid grantID
|
|
|
|
let uCap = encodeRouteHome $ DeckOutboxItemR deckHash grantHash
|
|
|
|
(localRecips, remoteRecips, fwdHosts, action) <-
|
|
|
|
C.makeServerInput (Just uCap) maybeSummary audience $ AP.InviteActivity invite
|
|
|
|
let cap =
|
|
|
|
Left (LocalActorDeck deckID, LocalActorDeck deckHash, grantID)
|
|
|
|
handleViaActor
|
|
|
|
personID (Just cap) localRecips remoteRecips fwdHosts action
|
|
|
|
|
|
|
|
case result of
|
|
|
|
Left e -> do
|
|
|
|
setMessage $ toHtml e
|
|
|
|
redirect $ DeckInviteR deckHash
|
|
|
|
Right inviteID -> do
|
|
|
|
setMessage "Invite sent"
|
|
|
|
redirect $ DeckCollabsR deckHash
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-05 10:43:28 +00:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{-
|
|
|
|
getProjectsR :: ShrIdent -> Handler Html
|
|
|
|
getProjectsR ident = do
|
|
|
|
projects <- runDB $ select $ from $ \ (sharer, project) -> do
|
|
|
|
where_ $
|
|
|
|
sharer ^. SharerIdent E.==. val ident &&.
|
|
|
|
sharer ^. SharerId E.==. project ^. ProjectSharer
|
|
|
|
orderBy [asc $ project ^. ProjectIdent]
|
|
|
|
return $ project ^. ProjectIdent
|
|
|
|
defaultLayout $(widgetFile "project/list")
|
2016-06-05 10:43:28 +00:00
|
|
|
|
2016-06-01 08:52:14 +00:00
|
|
|
postProjectDevsR :: ShrIdent -> PrjIdent -> Handler Html
|
|
|
|
postProjectDevsR shr rp = do
|
2022-06-22 06:19:37 +00:00
|
|
|
(sid, jid, obid) <- runDB $ do
|
|
|
|
Entity sid _ <- getBy404 $ UniqueSharer shr
|
|
|
|
Entity jid j <- getBy404 $ UniqueProject rp sid
|
2022-07-19 12:12:49 +00:00
|
|
|
a <- getJust $ projectActor j
|
|
|
|
return (sid, jid, actorOutbox a)
|
2016-06-06 17:29:54 +00:00
|
|
|
((result, widget), enctype) <- runFormPost $ newProjectCollabForm sid jid
|
2016-06-01 08:52:14 +00:00
|
|
|
case result of
|
|
|
|
FormSuccess nc -> do
|
2022-06-22 06:19:37 +00:00
|
|
|
now <- liftIO getCurrentTime
|
|
|
|
host <- asksSite siteInstanceHost
|
2016-06-01 08:52:14 +00:00
|
|
|
runDB $ do
|
2022-06-22 06:19:37 +00:00
|
|
|
obiid <-
|
|
|
|
insert $
|
|
|
|
OutboxItem
|
|
|
|
obid
|
|
|
|
(persistJSONObjectFromDoc $ Doc host emptyActivity)
|
|
|
|
now
|
|
|
|
cid <- insert Collab
|
|
|
|
for_ (ncRole nc) $ \ rlid -> insert_ $ CollabRoleLocal cid rlid
|
|
|
|
insert_ $ CollabTopicLocalProject cid jid
|
|
|
|
insert_ $ CollabSenderLocal cid obiid
|
|
|
|
insert_ $ CollabRecipLocal cid (ncPerson nc)
|
2016-06-01 08:52:14 +00:00
|
|
|
setMessage "Collaborator added."
|
|
|
|
redirect $ ProjectDevsR shr rp
|
|
|
|
FormMissing -> do
|
|
|
|
setMessage "Field(s) missing"
|
|
|
|
defaultLayout $(widgetFile "project/collab/new")
|
|
|
|
FormFailure _l -> do
|
|
|
|
setMessage "Operation failed, see errors below"
|
|
|
|
defaultLayout $(widgetFile "project/collab/new")
|
|
|
|
|
|
|
|
getProjectDevNewR :: ShrIdent -> PrjIdent -> Handler Html
|
|
|
|
getProjectDevNewR shr rp = do
|
2016-06-06 17:29:54 +00:00
|
|
|
(sid, jid) <- runDB $ do
|
2016-06-01 08:52:14 +00:00
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
2016-06-06 17:29:54 +00:00
|
|
|
Entity j _ <- getBy404 $ UniqueProject rp s
|
|
|
|
return (s, j)
|
|
|
|
((_result, widget), enctype) <- runFormPost $ newProjectCollabForm sid jid
|
2016-06-01 08:52:14 +00:00
|
|
|
defaultLayout $(widgetFile "project/collab/new")
|
|
|
|
|
|
|
|
getProjectDevR :: ShrIdent -> PrjIdent -> ShrIdent -> Handler Html
|
2019-01-28 14:43:07 +00:00
|
|
|
getProjectDevR shr prj dev = do
|
|
|
|
mrl <- runDB $ do
|
2016-06-06 17:29:54 +00:00
|
|
|
jid <- do
|
2016-06-01 08:52:14 +00:00
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
2019-01-28 14:43:07 +00:00
|
|
|
Entity j _ <- getBy404 $ UniqueProject prj s
|
2016-06-06 17:29:54 +00:00
|
|
|
return j
|
2016-06-01 08:52:14 +00:00
|
|
|
pid <- do
|
|
|
|
Entity s _ <- getBy404 $ UniqueSharer dev
|
|
|
|
Entity p _ <- getBy404 $ UniquePersonIdent s
|
|
|
|
return p
|
2022-06-22 06:19:37 +00:00
|
|
|
l <- E.select $ E.from $ \ (topic `E.InnerJoin` recip) -> do
|
|
|
|
E.on $ topic E.^. CollabTopicLocalProjectCollab E.==. recip E.^. CollabRecipLocalCollab
|
|
|
|
E.where_ $
|
|
|
|
topic E.^. CollabTopicLocalProjectProject E.==. E.val jid E.&&.
|
|
|
|
recip E.^. CollabRecipLocalPerson E.==. E.val pid
|
|
|
|
return $ recip E.^. CollabRecipLocalCollab
|
|
|
|
cid <-
|
|
|
|
case l of
|
|
|
|
[] -> notFound
|
|
|
|
[E.Value cid] -> return cid
|
|
|
|
_ -> error "Multiple collabs for project+person"
|
|
|
|
mcrole <- getValBy $ UniqueCollabRoleLocal cid
|
|
|
|
for mcrole $
|
|
|
|
\ (CollabRoleLocal _cid rlid) -> roleIdent <$> getJust rlid
|
2016-06-01 08:52:14 +00:00
|
|
|
defaultLayout $(widgetFile "project/collab/one")
|
|
|
|
|
|
|
|
deleteProjectDevR :: ShrIdent -> PrjIdent -> ShrIdent -> Handler Html
|
|
|
|
deleteProjectDevR shr rp dev = do
|
|
|
|
runDB $ do
|
2016-06-06 17:29:54 +00:00
|
|
|
jid <- do
|
2016-06-01 08:52:14 +00:00
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
2016-06-06 17:29:54 +00:00
|
|
|
Entity j _ <- getBy404 $ UniqueProject rp s
|
|
|
|
return j
|
2016-06-01 08:52:14 +00:00
|
|
|
pid <- do
|
|
|
|
Entity s _ <- getBy404 $ UniqueSharer dev
|
|
|
|
Entity p _ <- getBy404 $ UniquePersonIdent s
|
|
|
|
return p
|
2022-06-22 06:19:37 +00:00
|
|
|
collabs <- E.select $ E.from $ \ (recip `E.InnerJoin` topic) -> do
|
|
|
|
E.on $ recip E.^. CollabRecipLocalCollab E.==. topic E.^. CollabTopicLocalProjectCollab
|
|
|
|
E.where_ $
|
|
|
|
recip E.^. CollabRecipLocalPerson E.==. E.val pid E.&&.
|
|
|
|
topic E.^. CollabTopicLocalProjectProject E.==. E.val jid
|
|
|
|
return
|
|
|
|
( recip E.^. CollabRecipLocalId
|
|
|
|
, topic E.^. CollabTopicLocalProjectId
|
|
|
|
, recip E.^. CollabRecipLocalCollab
|
|
|
|
)
|
|
|
|
(E.Value crid, E.Value ctid, E.Value cid) <-
|
|
|
|
case collabs of
|
|
|
|
[] -> notFound
|
|
|
|
[c] -> return c
|
|
|
|
_ -> error "More than 1 collab for project+person"
|
|
|
|
deleteWhere [CollabRoleLocalCollab ==. cid]
|
|
|
|
delete ctid
|
|
|
|
deleteWhere [CollabSenderLocalCollab ==. cid]
|
|
|
|
deleteWhere [CollabSenderRemoteCollab ==. cid]
|
|
|
|
delete crid
|
2016-06-01 08:52:14 +00:00
|
|
|
delete cid
|
|
|
|
setMessage "Collaborator removed."
|
|
|
|
redirect $ ProjectDevsR shr rp
|
|
|
|
|
|
|
|
postProjectDevR :: ShrIdent -> PrjIdent -> ShrIdent -> Handler Html
|
|
|
|
postProjectDevR shr rp dev = do
|
|
|
|
mmethod <- lookupPostParam "_method"
|
|
|
|
case mmethod of
|
|
|
|
Just "DELETE" -> deleteProjectDevR shr rp dev
|
|
|
|
_ -> notFound
|
2019-06-11 12:19:51 +00:00
|
|
|
|
|
|
|
getProjectTeamR :: ShrIdent -> PrjIdent -> Handler TypedContent
|
|
|
|
getProjectTeamR shr prj = do
|
|
|
|
memberShrs <- runDB $ do
|
|
|
|
sid <- getKeyBy404 $ UniqueSharer shr
|
|
|
|
_jid <- getKeyBy404 $ UniqueProject prj sid
|
|
|
|
id_ <-
|
|
|
|
requireEitherAlt
|
|
|
|
(getKeyBy $ UniquePersonIdent sid)
|
|
|
|
(getKeyBy $ UniqueGroup sid)
|
|
|
|
"Found sharer that is neither person nor group"
|
|
|
|
"Found sharer that is both person and group"
|
|
|
|
case id_ of
|
|
|
|
Left pid -> return [shr]
|
|
|
|
Right gid -> do
|
|
|
|
pids <-
|
|
|
|
map (groupMemberPerson . entityVal) <$>
|
|
|
|
selectList [GroupMemberGroup ==. gid] []
|
|
|
|
sids <-
|
|
|
|
map (personIdent . entityVal) <$>
|
|
|
|
selectList [PersonId <-. pids] []
|
|
|
|
map (sharerIdent . entityVal) <$>
|
|
|
|
selectList [SharerId <-. sids] []
|
|
|
|
|
|
|
|
let here = ProjectTeamR shr prj
|
|
|
|
|
|
|
|
encodeRouteLocal <- getEncodeRouteLocal
|
|
|
|
encodeRouteHome <- getEncodeRouteHome
|
|
|
|
let team = Collection
|
|
|
|
{ collectionId = encodeRouteLocal here
|
|
|
|
, collectionType = CollectionTypeUnordered
|
|
|
|
, collectionTotalItems = Just $ length memberShrs
|
|
|
|
, collectionCurrent = Nothing
|
|
|
|
, collectionFirst = Nothing
|
|
|
|
, collectionLast = Nothing
|
|
|
|
, collectionItems = map (encodeRouteHome . SharerR) memberShrs
|
|
|
|
}
|
|
|
|
provideHtmlAndAP team $ redirect (here, [("prettyjson", "true")])
|
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
|
|
|
-}
|