From 544ebae3fdf3b6d930e84027a5b73ea831b1f721 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 9 Sep 2019 00:33:36 +0000 Subject: [PATCH] Specify visibility in Follow records --- config/models | 2 ++ src/Vervis/API.hs | 4 ++-- src/Vervis/Federation/Discussion.hs | 2 +- src/Vervis/Federation/Ticket.hs | 2 +- src/Vervis/Migration.hs | 4 ++++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config/models b/config/models index 6ad47d2..779afc8 100644 --- a/config/models +++ b/config/models @@ -155,6 +155,7 @@ Follow person PersonId target FollowerSetId manual Bool + public Bool UniqueFollow person target @@ -162,6 +163,7 @@ RemoteFollow actor RemoteActorId target FollowerSetId manual Bool + public Bool UniqueRemoteFollow actor target diff --git a/src/Vervis/API.hs b/src/Vervis/API.hs index 3885777..35e3395 100644 --- a/src/Vervis/API.hs +++ b/src/Vervis/API.hs @@ -181,7 +181,7 @@ createNoteC host (Note mluNote luAttrib aud muParent muContext mpublished source unless (messageRoot m == did) $ throwE "Remote parent belongs to a different discussion" return mid - lift $ insertUnique_ $ Follow pid (ticketFollowers t) False + lift $ insertUnique_ $ Follow pid (ticketFollowers t) False True return (did, Left <$> mmidParent, Just (sid, ticketFollowers t, ibidProject, fsidProject)) Nothing -> do (rd, rdnew) <- lift $ do @@ -671,7 +671,7 @@ offerTicketC shrUser summary audience offer@(Offer ticket uTarget) = runExceptT , ticketAuthorLocalOffer = obiid } --insertMany_ $ map (TicketDependency tid) tidsDeps - insert_ $ Follow pidAuthor fsid False + insert_ $ Follow pidAuthor fsid False True publishAccept pidAuthor sid jid fsid luOffer num obiid doc = do now <- liftIO getCurrentTime let dont = Authority "dont-do.any-forwarding" Nothing diff --git a/src/Vervis/Federation/Discussion.hs b/src/Vervis/Federation/Discussion.hs index e2cb5b8..d059366 100644 --- a/src/Vervis/Federation/Discussion.hs +++ b/src/Vervis/Federation/Discussion.hs @@ -318,7 +318,7 @@ projectCreateNoteF now shrRecip prjRecip author body (Note mluNote _ _ muParent delete mid return Nothing Just _ -> do - insertUnique_ $ RemoteFollow raidAuthor fsid False + insertUnique_ $ RemoteFollow raidAuthor fsid False True ibiid <- insert $ InboxItem False insert_ $ InboxItemRemote ibid ractid ibiid return $ Just (ractid, mid) diff --git a/src/Vervis/Federation/Ticket.hs b/src/Vervis/Federation/Ticket.hs index 8a1b2aa..d6c65d1 100644 --- a/src/Vervis/Federation/Ticket.hs +++ b/src/Vervis/Federation/Ticket.hs @@ -326,7 +326,7 @@ projectOfferTicketF , ticketAuthorRemoteOffer = ractid } -- insertMany_ $ map (TicketDependency tid) deps - insert_ $ RemoteFollow raidAuthor fsid False + insert_ $ RemoteFollow raidAuthor fsid False True return $ Just (ractid, next, obiidAccept, docAccept) deliverLocal diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index 7b47f2d..22d3cb7 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -1050,6 +1050,10 @@ changes hLocal ctx = "FollowerSet" -- 135 , addUnique "Person" $ Unique "UniquePersonFollowers" ["followers"] + -- 136 + , addFieldPrimRequired "Follow" True "public" + -- 137 + , addFieldPrimRequired "RemoteFollow" True "public" ] migrateDB