NOTE: Federation is disabled on this instance!
You can test federation between the following instances:forge.angeley.es
code.angeley.es
By | fr33domlover |
At | 2020-08-14 |
Title | DB: Add media type field to 'Patch' entity |
Description | This patch (haha) also adds a VCS field to the AP representation of repos |
Edit file config/models 0 → 0
+ | 459 | type PatchMediaType |
|
… | … | … | … |
Add file migrations/2020_08_13_vcs.model 0
Edit file migrations/2020_08_13_vcs.model 0 → 0
+ | 1 | Sharer |
|
+ | 2 | Project |
|
+ | 3 | Role |
|
+ | 4 | Inbox |
|
+ | 5 | Outbox |
|
+ | 6 | FollowerSet |
|
+ | 7 | ||
+ | 8 | Repo |
|
+ | 9 | ident RpIdent |
|
+ | 10 | sharer SharerId |
|
+ | 11 | vcs Text |
|
+ | 12 | project ProjectId Maybe |
|
+ | 13 | desc Text Maybe |
|
+ | 14 | mainBranch Text |
|
+ | 15 | collabUser RoleId Maybe |
|
+ | 16 | collabAnon RoleId Maybe |
|
+ | 17 | inbox InboxId |
|
+ | 18 | outbox OutboxId |
|
+ | 19 | followers FollowerSetId |
|
+ | 20 | ||
+ | 21 | UniqueRepo ident sharer |
|
+ | 22 | UniqueRepoInbox inbox |
|
+ | 23 | UniqueRepoOutbox outbox |
|
+ | 24 | UniqueRepoFollowers followers |
|
… | … | … | … |
Edit file src/Data/Aeson/Local.hs 0 → 0
- | 61 | frg = "https://forgefed.angeley.es/ns#" |
|
+ | 61 | frg = "https://forgefed.peers.community/ns#" |
|
… | … | … | … |
Add file src/Development 0
Add file src/Development/PatchMediaType 0
Add file src/Development/PatchMediaType.hs 0
Edit file src/Development/PatchMediaType.hs 0 → 0
+ | 1 | {- This file is part of Vervis. |
|
+ | 2 | - |
|
+ | 3 | - Written in 2016, 2019, 2020 by fr33domlover <fr33domlover@riseup.net>. |
|
+ | 4 | - |
|
+ | 5 | - ♡ Copying is an act of love. Please copy, reuse and share. |
|
+ | 6 | - |
|
+ | 7 | - The author(s) have dedicated all copyright and related and neighboring |
|
+ | 8 | - rights to this software to the public domain worldwide. This software is |
|
+ | 9 | - distributed without any warranty. |
|
+ | 10 | - |
|
+ | 11 | - You should have received a copy of the CC0 Public Domain Dedication along |
|
+ | 12 | - with this software. If not, see |
|
+ | 13 | - <http://creativecommons.org/publicdomain/zero/1.0/>. |
|
+ | 14 | -} |
|
+ | 15 | ||
+ | 16 | module Development.PatchMediaType |
|
+ | 17 | ( VersionControlSystem (..) |
|
+ | 18 | , PatchMediaType (..) |
|
+ | 19 | , parseVersionControlSystemName |
|
+ | 20 | , parseVersionControlSystemURI |
|
+ | 21 | , versionControlSystemName |
|
+ | 22 | , versionControlSystemURI |
|
+ | 23 | , patchMediaTypeVCS |
|
+ | 24 | , parsePatchMediaType |
|
+ | 25 | , renderPatchMediaType |
|
+ | 26 | ) |
|
+ | 27 | where |
|
+ | 28 | ||
+ | 29 | import Control.Monad |
|
+ | 30 | import Data.Text (Text) |
|
+ | 31 | ||
+ | 32 | import qualified Data.Text as T |
|
+ | 33 | ||
+ | 34 | data VersionControlSystem = VCSDarcs | VCSGit deriving Eq |
|
+ | 35 | ||
+ | 36 | data PatchMediaType = PatchMediaTypeDarcs deriving Eq |
|
+ | 37 | ||
+ | 38 | forgeFedPrefix :: Text |
|
+ | 39 | forgeFedPrefix = "https://forgefed.peers.community/ns#" |
|
+ | 40 | ||
+ | 41 | parseVersionControlSystemName :: Text -> Maybe VersionControlSystem |
|
+ | 42 | parseVersionControlSystemName = parse . T.toLower |
|
+ | 43 | where |
|
+ | 44 | parse "darcs" = Just VCSDarcs |
|
+ | 45 | parse "git" = Just VCSGit |
|
+ | 46 | parse _ = Nothing |
|
+ | 47 | ||
+ | 48 | parseVersionControlSystemURI :: Text -> Maybe VersionControlSystem |
|
+ | 49 | parseVersionControlSystemURI = parse <=< T.stripPrefix forgeFedPrefix |
|
+ | 50 | where |
|
+ | 51 | parse "darcs" = Just VCSDarcs |
|
+ | 52 | parse "git" = Just VCSGit |
|
+ | 53 | parse _ = Nothing |
|
+ | 54 | ||
+ | 55 | versionControlSystemName :: VersionControlSystem -> Text |
|
+ | 56 | versionControlSystemName VCSDarcs = "Darcs" |
|
+ | 57 | versionControlSystemName VCSGit = "Git" |
|
+ | 58 | ||
+ | 59 | versionControlSystemURI :: VersionControlSystem -> Text |
|
+ | 60 | versionControlSystemURI vcs = forgeFedPrefix <> rest vcs |
|
+ | 61 | where |
|
+ | 62 | rest VCSDarcs = "darcs" |
|
+ | 63 | rest VCSGit = "git" |
|
+ | 64 | ||
+ | 65 | patchMediaTypeVCS :: PatchMediaType -> VersionControlSystem |
|
+ | 66 | patchMediaTypeVCS PatchMediaTypeDarcs = VCSDarcs |
|
+ | 67 | ||
+ | 68 | parsePatchMediaType :: Text -> Maybe PatchMediaType |
|
+ | 69 | parsePatchMediaType "application/x-darcs-patch" = Just PatchMediaTypeDarcs |
|
+ | 70 | parsePatchMediaType _ = Nothing |
|
+ | 71 | ||
+ | 72 | renderPatchMediaType :: PatchMediaType -> Text |
|
+ | 73 | renderPatchMediaType PatchMediaTypeDarcs = "application/x-darcs-patch" |
|
… | … | … | … |
Add file src/Development/PatchMediaType/JSON.hs 0
Edit file src/Development/PatchMediaType/JSON.hs 0 → 0
+ | 1 | {- This file is part of Vervis. |
|
+ | 2 | - |
|
+ | 3 | - Written in 2019, 2020 by fr33domlover <fr33domlover@riseup.net>. |
|
+ | 4 | - |
|
+ | 5 | - ♡ Copying is an act of love. Please copy, reuse and share. |
|
+ | 6 | - |
|
+ | 7 | - The author(s) have dedicated all copyright and related and neighboring |
|
+ | 8 | - rights to this software to the public domain worldwide. This software is |
|
+ | 9 | - distributed without any warranty. |
|
+ | 10 | - |
|
+ | 11 | - You should have received a copy of the CC0 Public Domain Dedication along |
|
+ | 12 | - with this software. If not, see |
|
+ | 13 | - <http://creativecommons.org/publicdomain/zero/1.0/>. |
|
+ | 14 | -} |
|
+ | 15 | ||
+ | 16 | module Development.PatchMediaType.JSON () where |
|
+ | 17 | ||
+ | 18 | import Data.Aeson |
|
+ | 19 | ||
+ | 20 | import qualified Data.Text as T |
|
+ | 21 | ||
+ | 22 | import Development.PatchMediaType |
|
+ | 23 | ||
+ | 24 | instance FromJSON VersionControlSystem where |
|
+ | 25 | parseJSON = |
|
+ | 26 | withText "VersionControlSystem" $ \ t -> |
|
+ | 27 | case parseVersionControlSystemURI t of |
|
+ | 28 | Nothing -> |
|
+ | 29 | fail $ "Unknown version control system URI: " ++ T.unpack t |
|
+ | 30 | Just vcs -> return vcs |
|
+ | 31 | ||
+ | 32 | instance ToJSON VersionControlSystem where |
|
+ | 33 | toJSON = toJSON . versionControlSystemURI |
|
+ | 34 | toEncoding = toEncoding . versionControlSystemURI |
|
+ | 35 | ||
+ | 36 | instance FromJSON PatchMediaType where |
|
+ | 37 | parseJSON = |
|
+ | 38 | withText "PatchMediaType" $ \ t -> |
|
+ | 39 | case parsePatchMediaType t of |
|
+ | 40 | Nothing -> fail $ "Unknown patch media type: " ++ T.unpack t |
|
+ | 41 | Just pmt -> return pmt |
|
+ | 42 | ||
+ | 43 | instance ToJSON PatchMediaType where |
|
+ | 44 | toJSON = toJSON . renderPatchMediaType |
|
+ | 45 | toEncoding = toEncoding . renderPatchMediaType |
|
… | … | … | … |
Add file src/Development/PatchMediaType/Persist.hs 0
Edit file src/Development/PatchMediaType/Persist.hs 0 → 0
+ | 1 | {- This file is part of Vervis. |
|
+ | 2 | - |
|
+ | 3 | - Written in 2020 by fr33domlover <fr33domlover@riseup.net>. |
|
+ | 4 | - |
|
+ | 5 | - ♡ Copying is an act of love. Please copy, reuse and share. |
|
+ | 6 | - |
|
+ | 7 | - The author(s) have dedicated all copyright and related and neighboring |
|
+ | 8 | - rights to this software to the public domain worldwide. This software is |
|
+ | 9 | - distributed without any warranty. |
|
+ | 10 | - |
|
+ | 11 | - You should have received a copy of the CC0 Public Domain Dedication along |
|
+ | 12 | - with this software. If not, see |
|
+ | 13 | - <http://creativecommons.org/publicdomain/zero/1.0/>. |
|
+ | 14 | -} |
|
+ | 15 | ||
+ | 16 | module Development.PatchMediaType.Persist () where |
|
+ | 17 | ||
+ | 18 | import Database.Persist |
|
+ | 19 | import Database.Persist.Sql |
|
+ | 20 | ||
+ | 21 | import Development.PatchMediaType |
|
+ | 22 | ||
+ | 23 | instance PersistField VersionControlSystem where |
|
+ | 24 | toPersistValue = toPersistValue . versionControlSystemName |
|
+ | 25 | fromPersistValue v = do |
|
+ | 26 | t <- fromPersistValue v |
|
+ | 27 | case parseVersionControlSystemName t of |
|
+ | 28 | Nothing -> Left $ "Unknown version control system name: " <> t |
|
+ | 29 | Just vcs -> Right vcs |
|
+ | 30 | ||
+ | 31 | instance PersistFieldSql VersionControlSystem where |
|
+ | 32 | sqlType = sqlType . fmap versionControlSystemName |
|
+ | 33 | ||
+ | 34 | instance PersistField PatchMediaType where |
|
+ | 35 | toPersistValue = toPersistValue . renderPatchMediaType |
|
+ | 36 | fromPersistValue v = do |
|
+ | 37 | t <- fromPersistValue v |
|
+ | 38 | case parsePatchMediaType t of |
|
+ | 39 | Nothing -> Left $ "Unknown patch media type: " <> t |
|
+ | 40 | Just pmt -> Right pmt |
|
+ | 41 | ||
+ | 42 | instance PersistFieldSql PatchMediaType where |
|
+ | 43 | sqlType = sqlType . fmap renderPatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/API.hs 0 → 0
- | 88 | import Web.ActivityPub hiding (Patch, Ticket, Follow) |
|
+ | 88 | import Web.ActivityPub hiding (Patch, Ticket, Follow, Repo (..)) |
|
… | … | … | … |
- | 114 | import Vervis.Model.Repo |
|
+ | 114 | import Development.PatchMediaType |
|
… | … | … | … |
- | 581 | Right (Entity _ r, _, _) -> |
|
+ | 581 | Right (Entity _ r, _, _, _) -> |
|
… | … | … | … |
- | 615 | , Maybe (Maybe LocalURI, PatchType, NonEmpty Text) |
|
+ | 615 | , Maybe (Maybe LocalURI, PatchMediaType, NonEmpty Text) |
|
… | … | … | … |
- | 656 | ( Either WorkItemTarget (Host, LocalURI, Maybe (Maybe LocalURI, PatchType, NonEmpty Text)) |
|
+ | 656 | ( Either WorkItemTarget (Host, LocalURI, Maybe (Maybe LocalURI, PatchMediaType, NonEmpty Text)) |
|
… | … | … | … |
- | 682 | , PatchType |
|
+ | 682 | , PatchMediaType |
|
… | … | … | … |
- | 727 | ( PatchType |
|
+ | 727 | ( PatchMediaType |
|
… | … | … | … |
- | 744 | , PatchType |
|
+ | 744 | , PatchMediaType |
|
- | 752 | , Maybe (Maybe LocalURI, PatchType, NonEmpty Text) |
|
+ | 752 | , Maybe (Maybe LocalURI, PatchMediaType, NonEmpty Text) |
|
- | 763 | let vcs = typ2vcs typ |
|
- | 764 | case vcs of |
|
+ | 763 | case patchMediaTypeVCS typ of |
|
- | 770 | return $ Left $ WITRepo shr rp branch' vcs diffs |
|
- | 771 | where |
|
- | 772 | typ2vcs PatchTypeDarcs = VCSDarcs |
|
+ | 769 | return $ Left $ WITRepo shr rp branch' typ diffs |
|
… | … | … | … |
- | 789 | (Host, LocalURI, Maybe (Maybe LocalURI, PatchType, NonEmpty Text)) |
|
+ | 786 | (Host, LocalURI, Maybe (Maybe LocalURI, PatchMediaType, NonEmpty Text)) |
|
- | 796 | , Maybe (Maybe LocalURI, PatchType, NonEmpty Text) |
|
+ | 793 | , Maybe (Maybe LocalURI, PatchMediaType, NonEmpty Text) |
|
… | … | … | … |
- | 836 | prepareProject now (Left (WITRepo shr rp mb vcs diff)) = Left <$> do |
|
+ | 833 | prepareProject now (Left (WITRepo shr rp mb typ diff)) = Left <$> do |
|
- | 841 | unless (repoVcs r == vcs) $ throwE "Repo VCS and patch VCS mismatch" |
|
+ | 838 | unless (repoVcs r == patchMediaTypeVCS typ) $ |
|
+ | 839 | throwE "Repo VCS and patch VCS mismatch" |
|
- | 844 | return (shr, Right (er, mb, diff), obiidAccept) |
|
+ | 842 | return (shr, Right (er, mb, typ, diff), obiidAccept) |
|
… | … | … | … |
- | 890 | Right (Entity rid _, mb, diffs) -> Just <$> do |
|
+ | 888 | Right (Entity rid _, mb, typ, diffs) -> Just <$> do |
|
- | 899 | (NE.toList $ NE.map (Patch bnid now) diffs) |
|
+ | 897 | (NE.toList $ NE.map (Patch bnid now typ) diffs) |
|
- | 906 | for mbundle $ \ (_typ, diffs) -> do |
|
+ | 904 | for mbundle $ \ (typ, diffs) -> do |
|
- | 910 | (NE.toList $ NE.map (Patch bnid now) diffs) |
|
+ | 908 | (NE.toList $ NE.map (Patch bnid now typ) diffs) |
|
… | … | … | … |
- | 931 | Left (WITRepo shr rp mb vcs diffs) -> |
|
+ | 929 | Left (WITRepo shr rp mb typ diffs) -> |
|
- | 940 | typ = |
|
- | 941 | case vcs of |
|
- | 942 | VCSDarcs -> PatchTypeDarcs |
|
- | 943 | VCSGit -> error "createTicketC VCSGit" |
|
… | … | … | … |
- | 1078 | Right (Entity _ r, _, _) -> |
|
+ | 1072 | Right (Entity _ r, _, _, _) -> |
|
… | … | … | … |
- | 1339 | Left (WITRepo shr rp mb vcs diffs) -> Just . Right <$> do |
|
+ | 1333 | Left (WITRepo shr rp mb typ diffs) -> Just . Right <$> do |
|
- | 1345 | unless (repoVcs r == vcs) $ throwE "Patch type and repo VCS mismatch" |
|
- | 1346 | return (s, er, mb, diffs) |
|
+ | 1339 | unless (repoVcs r == patchMediaTypeVCS typ) $ |
|
+ | 1340 | throwE "Patch type and repo VCS mismatch" |
|
+ | 1341 | return (s, er, mb, typ, diffs) |
|
… | … | … | … |
- | 1388 | Right (_, Entity _ r, _, _) -> repoOutbox r |
|
+ | 1383 | Right (_, Entity _ r, _, _, _) -> repoOutbox r |
|
- | 1394 | Right (_, Entity rid _, mb, _) -> |
|
+ | 1389 | Right (_, Entity rid _, mb, _, _) -> |
|
- | 1399 | Right (_, _, _, diffs) -> do |
|
+ | 1394 | Right (_, _, _, typ, diffs) -> do |
|
- | 1401 | insertMany_ $ NE.toList $ NE.map (Patch bnid now) diffs |
|
+ | 1396 | insertMany_ $ NE.toList $ NE.map (Patch bnid now typ) diffs |
|
- | 1409 | Right (s, Entity _ r, _, _) -> |
|
+ | 1404 | Right (s, Entity _ r, _, _, _) -> |
|
… | … | … | … |
- | 1428 | ( Either WorkItemTarget (Host, LocalURI, Maybe (Maybe LocalURI, PatchType, NonEmpty Text)) |
|
+ | 1423 | ( Either WorkItemTarget (Host, LocalURI, Maybe (Maybe LocalURI, PatchMediaType, NonEmpty Text)) |
|
… | … | … | … |
- | 1526 | let vcs = typ2vcs typ |
|
- | 1527 | case vcs of |
|
+ | 1521 | case patchMediaTypeVCS typ of |
|
- | 1533 | return $ Left $ WITRepo shr rp branch' vcs diffs |
|
- | 1534 | where |
|
- | 1535 | typ2vcs PatchTypeDarcs = VCSDarcs |
|
+ | 1527 | return $ Left $ WITRepo shr rp branch' typ diffs |
|
… | … | … | … |
- | 1607 | Right (s, Entity _ r, _, _) -> |
|
+ | 1599 | Right (s, Entity _ r, _, _, _) -> |
|
… | … | … | … |
Edit file src/Vervis/Application.hs 0 → 0
- | 124 | import Vervis.Model.Repo |
|
+ | 124 | import Development.PatchMediaType |
|
… | … | … | … |
- | 247 | shr ++ " / " ++ rp ++ " [" ++ show vcs ++ "]" |
|
+ | 247 | shr ++ " / " ++ rp ++ |
|
+ | 248 | " [" ++ T.unpack (versionControlSystemName vcs) ++ "]" |
|
… | … | … | … |
Edit file src/Vervis/ChangeFeed.hs 0 → 0
- | 31 | import Vervis.Model.Repo |
|
+ | 31 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Darcs.hs 0 → 0
- | 86 | import Vervis.Model.Repo |
|
+ | 86 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Federation/Ticket.hs 0 → 0
- | 71 | import Web.ActivityPub hiding (Patch, Ticket (..)) |
|
+ | 71 | import Web.ActivityPub hiding (Patch, Ticket (..), Repo (..)) |
|
… | … | … | … |
- | 92 | import Vervis.Model.Repo |
|
+ | 92 | import Development.PatchMediaType |
|
… | … | … | … |
- | 105 | ( Either WorkItemTarget (Host, LocalURI, Maybe (Maybe LocalURI, PatchType, NonEmpty Text)) |
|
+ | 105 | ( Either WorkItemTarget (Host, LocalURI, Maybe (Maybe LocalURI, PatchMediaType, NonEmpty Text)) |
|
… | … | … | … |
- | 198 | let vcs = typ2vcs typ |
|
- | 199 | case vcs of |
|
+ | 198 | case patchMediaTypeVCS typ of |
|
- | 205 | return $ Left $ WITRepo shr rp branch' vcs diffs |
|
- | 206 | where |
|
- | 207 | typ2vcs PatchTypeDarcs = VCSDarcs |
|
+ | 204 | return $ Left $ WITRepo shr rp branch' typ diffs |
|
… | … | … | … |
- | 402 | mmhttp <- for (targetRelevance target) $ \ (mb, vcs, diffs) -> runDBExcept $ do |
|
+ | 399 | mmhttp <- for (targetRelevance target) $ \ (mb, typ, diffs) -> runDBExcept $ do |
|
- | 406 | unless (repoVcs r == vcs) $ throwE "Patch type and repo VCS mismatch" |
|
+ | 403 | unless (repoVcs r == patchMediaTypeVCS typ) $ |
|
+ | 404 | throwE "Patch type and repo VCS mismatch" |
|
… | … | … | … |
- | 428 | insertMany_ $ NE.toList $ NE.map (Patch bnid now) diffs |
|
+ | 426 | insertMany_ $ NE.toList $ NE.map (Patch bnid now typ) diffs |
|
… | … | … | … |
- | 503 | , rpType :: PatchType |
|
+ | 501 | , rpType :: PatchMediaType |
|
… | … | … | … |
- | 604 | , PatchType |
|
+ | 602 | , PatchMediaType |
|
… | … | … | … |
- | 666 | , PatchType |
|
+ | 664 | , PatchMediaType |
|
… | … | … | … |
- | 687 | , PatchType |
|
+ | 685 | , PatchMediaType |
|
… | … | … | … |
- | 699 | let vcs = typ2vcs typ |
|
- | 700 | case vcs of |
|
+ | 697 | case patchMediaTypeVCS typ of |
|
- | 711 | return $ Left $ WITRepo shr rp branch' vcs diffs |
|
- | 712 | where |
|
- | 713 | typ2vcs PatchTypeDarcs = VCSDarcs |
|
+ | 708 | return $ Left $ WITRepo shr rp branch' typ diffs |
|
… | … | … | … |
- | 1003 | mmhttp <- for (targetRelevance targetAndContext) $ \ (mb, vcs, diffs) -> runDBExcept $ do |
|
+ | 998 | mmhttp <- for (targetRelevance targetAndContext) $ \ (mb, typ, diffs) -> runDBExcept $ do |
|
- | 1007 | unless (repoVcs r == vcs) $ throwE "Patch type and repo VCS mismatch" |
|
+ | 1002 | unless (repoVcs r == patchMediaTypeVCS typ) $ |
|
+ | 1003 | throwE "Patch type and repo VCS mismatch" |
|
- | 1017 | insertMany_ $ NE.toList $ NE.map (Patch bnid published) diffs |
|
+ | 1013 | insertMany_ $ NE.toList $ NE.map (Patch bnid published typ) diffs |
|
… | … | … | … |
Edit file src/Vervis/Form/Project.hs 0 → 0
- | 41 | import Vervis.Model.Repo |
|
+ | 41 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Form/Repo.hs 0 → 0
- | 35 | import Vervis.Model.Repo |
|
+ | 35 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Git.hs 0 → 0
- | 87 | import Vervis.Model.Repo |
|
+ | 87 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Handler/Client.hs 0 → 0
- | 92 | import Vervis.Model.Repo |
|
+ | 92 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Handler/Home.hs 0 → 0
- | 40 | import Vervis.Model.Repo |
|
+ | 40 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Handler/Patch.hs 0 → 0
- | 55 | import Web.ActivityPub hiding (Ticket (..), Patch (..), Bundle (..)) |
|
+ | 55 | import Web.ActivityPub hiding (Ticket (..), Patch (..), Bundle (..), Repo (..)) |
|
… | … | … | … |
- | 72 | import Vervis.Model.Repo |
|
+ | 72 | import Development.PatchMediaType |
|
… | … | … | … |
- | 312 | (vcs, patch) <- runDB $ do |
|
- | 313 | (_, _, _, repo, _, vers) <- getSharerProposal404 shr talkhid |
|
+ | 312 | patch <- runDB $ do |
|
+ | 313 | (_, _, _, _, _, vers) <- getSharerProposal404 shr talkhid |
|
- | 319 | vcs <- |
|
- | 320 | case repo of |
|
- | 321 | Left (_, Entity _ trl) -> |
|
- | 322 | repoVcs <$> getJust (ticketRepoLocalRepo trl) |
|
- | 323 | Right _ -> |
|
- | 324 | error "TODO determine mediaType of patch of remote repo" |
|
- | 325 | return (vcs, pt) |
|
+ | 319 | return pt |
|
- | 336 | , AP.patchType = |
|
- | 337 | case vcs of |
|
- | 338 | VCSDarcs -> PatchTypeDarcs |
|
- | 339 | VCSGit -> error "TODO add PatchType for git patches" |
|
+ | 330 | , AP.patchType = patchType patch |
|
… | … | … | … |
- | 657 | (vcs, patch, author) <- runDB $ do |
|
- | 658 | (_, Entity _ repo, _, _, _, _, ta, _, vers) <- getRepoProposal404 shr rp ltkhid |
|
- | 659 | (,,) |
|
- | 660 | <$> pure (repoVcs repo) |
|
- | 661 | <*> do bnid <- decodeKeyHashid404 bnkhid |
|
+ | 648 | (patch, author) <- runDB $ do |
|
+ | 649 | (_, _, _, _, _, _, ta, _, vers) <- getRepoProposal404 shr rp ltkhid |
|
+ | 650 | (,) <$> do bnid <- decodeKeyHashid404 bnkhid |
|
… | … | … | … |
- | 701 | , AP.patchType = |
|
- | 702 | case vcs of |
|
- | 703 | VCSDarcs -> PatchTypeDarcs |
|
- | 704 | VCSGit -> error "TODO add PatchType for git patches" |
|
+ | 690 | , AP.patchType = patchType patch |
|
… | … | … | … |
Edit file src/Vervis/Handler/Project.hs 0 → 0
- | 50 | import Web.ActivityPub hiding (Project (..)) |
|
+ | 50 | import Web.ActivityPub hiding (Project (..), Repo (..)) |
|
… | … | … | … |
- | 66 | import Vervis.Model.Repo |
|
+ | 66 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Handler/Repo.hs 0 → 0
- | 91 | import Web.ActivityPub hiding (Repo, Project) |
|
+ | 91 | import Web.ActivityPub hiding (Repo (..), Project) |
|
… | … | … | … |
- | 118 | import Vervis.Model.Repo |
|
+ | 118 | import Development.PatchMediaType |
|
… | … | … | … |
+ | 249 | , AP.repoVcs = repoVcs repo |
|
… | … | … | … |
Edit file src/Vervis/Handler/Repo/Darcs.hs 0 → 0
- | 69 | import Vervis.Model.Repo |
|
+ | 69 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Handler/Repo/Git.hs 0 → 0
- | 83 | import Vervis.Model.Repo |
|
+ | 83 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Handler/Wiki.hs 0 → 0
- | 37 | import Vervis.Model.Repo |
|
+ | 37 | import Development.PatchMediaType |
|
… | … | … | … |
Edit file src/Vervis/Migration.hs 0 → 0
+ | 1776 | -- 282 |
|
+ | 1777 | , unchecked $ lift $ do |
|
+ | 1778 | ers <- selectList ([] :: [Filter Repo282]) [] |
|
+ | 1779 | for_ ers $ \ (Entity rid r) -> do |
|
+ | 1780 | vcs <- |
|
+ | 1781 | case repo282Vcs r of |
|
+ | 1782 | "VCSDarcs" -> return "Darcs" |
|
+ | 1783 | "VCSGit" -> return "Git" |
|
+ | 1784 | _ -> error "Weird repoVcs" |
|
+ | 1785 | update rid [Repo282Vcs =. vcs] |
|
+ | 1786 | -- 283 |
|
+ | 1787 | , addFieldPrimRequired "Patch" ("???" :: Text) "type" |
|
… | … | … | … |
Edit file src/Vervis/Migration/Model.hs 0 → 0
+ | 246 | , Repo282 |
|
+ | 247 | , Repo282Generic (..) |
|
… | … | … | … |
- | 265 | import Vervis.Model.Repo |
|
+ | 267 | import Development.PatchMediaType |
|
… | … | … | … |
+ | 483 | ||
+ | 484 | makeEntitiesMigration "282" |
|
+ | 485 | $(modelFile "migrations/2020_08_13_vcs.model") |
|
… | … | … | … |
Edit file src/Vervis/Model.hs 0 → 0
+ | 37 | import Development.PatchMediaType |
|
+ | 38 | import Development.PatchMediaType.Persist |
|
- | 45 | import Vervis.Model.Repo |
|
… | … | … | … |
Edit file src/Vervis/Model/Repo.hs 0 → 0
- | 1 | {- This file is part of Vervis. |
|
- | 2 | - |
|
- | 3 | - Written in 2016 by fr33domlover <fr33domlover@riseup.net>. |
|
- | 4 | - |
|
- | 5 | - ♡ Copying is an act of love. Please copy, reuse and share. |
|
- | 6 | - |
|
- | 7 | - The author(s) have dedicated all copyright and related and neighboring |
|
- | 8 | - rights to this software to the public domain worldwide. This software is |
|
- | 9 | - distributed without any warranty. |
|
- | 10 | - |
|
- | 11 | - You should have received a copy of the CC0 Public Domain Dedication along |
|
- | 12 | - with this software. If not, see |
|
- | 13 | - <http://creativecommons.org/publicdomain/zero/1.0/>. |
|
- | 14 | -} |
|
- | 15 | ||
- | 16 | module Vervis.Model.Repo |
|
- | 17 | ( VersionControlSystem (..) |
|
- | 18 | ) |
|
- | 19 | where |
|
- | 20 | ||
- | 21 | import Database.Persist.TH |
|
- | 22 | ||
- | 23 | data VersionControlSystem = VCSGit | VCSDarcs |
|
- | 24 | deriving (Eq, Show, Read) |
|
- | 25 | ||
- | 26 | derivePersistField "VersionControlSystem" |
|
… | … | … | … |
Remove file src/Vervis/Model/Repo.hs 0
Edit file src/Vervis/WorkItem.hs 0 → 0
- | 58 | import Vervis.Model.Repo |
|
+ | 58 | import Development.PatchMediaType |
|
… | … | … | … |
- | 245 | | WITRepo ShrIdent RpIdent (Maybe Text) VersionControlSystem (NonEmpty Text) |
|
+ | 245 | | WITRepo ShrIdent RpIdent (Maybe Text) PatchMediaType (NonEmpty Text) |
|
… | … | … | … |
Edit file src/Web/ActivityPub.hs 0 → 0
- | 49 | , PatchType (..) |
|
… | … | … | … |
+ | 148 | import Development.PatchMediaType |
|
+ | 149 | import Development.PatchMediaType.JSON |
|
… | … | … | … |
+ | 407 | , repoVcs :: VersionControlSystem |
|
- | 410 | jsonldContext _ = [as2Context, secContext, forgeContext, extContext] |
|
+ | 412 | jsonldContext _ = [as2Context, secContext, forgeContext] |
|
- | 418 | toSeries authority (Repo actor team) |
|
+ | 420 | <*> o .: "versionControlSystem" |
|
+ | 421 | toSeries authority (Repo actor team vcs) |
|
- | 421 | <> "team" .= ObjURI authority team |
|
+ | 424 | <> "team" .= ObjURI authority team |
|
+ | 425 | <> "versionControlSystem" .= vcs |
|
… | … | … | … |
- | 882 | , patchType :: PatchType |
|
+ | 886 | , patchType :: PatchMediaType |
|
… | … | … | … |
Edit file vervis.cabal 0 → 0
+ | 88 | Development.PatchMediaType |
|
+ | 89 | Development.PatchMediaType.JSON |
|
+ | 90 | Development.PatchMediaType.Persist |
|
… | … | … | … |
- | 190 | Vervis.Model.Repo |
|
… | … | … | … |