From b8c669f6fc1a6719325ed271dd8667d5d3057367 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Thu, 18 Apr 2019 11:43:33 +0000 Subject: [PATCH] New outbox post: Raise error if federation disabled but remote recipients found --- src/Vervis/Federation.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Vervis/Federation.hs b/src/Vervis/Federation.hs index ed61372..a2b510c 100644 --- a/src/Vervis/Federation.hs +++ b/src/Vervis/Federation.hs @@ -417,6 +417,9 @@ handleOutboxNote host (Note mluNote luAttrib aud muParent muContext mpublished c uContext <- fromMaybeE muContext "Note without context" recips <- nonEmptyE (concatRecipients aud) "Note without recipients" (mparent, localRecips, mticket, remoteRecips) <- parseRecipsContextParent recips uContext muParent + federation <- getsYesod $ appFederation . appSettings + unless (federation || null remoteRecips) $ + throwE "Federation disabled, but remote recipients specified" result <- lift $ try $ runDB $ (either abort return =<<) . runExceptT $ do (pid, shrUser) <- verifyIsLoggedInUser luAttrib "Note attributed to different actor" (did, meparent, mcollections) <- case mticket of @@ -479,6 +482,8 @@ handleOutboxNote host (Note mluNote luAttrib aud muParent muContext mpublished c return (did, meparent, Nothing) (lmid, obid, doc) <- lift $ insertMessage luAttrib shrUser pid uContext did muParent meparent content moreRemotes <- deliverLocal obid localRecips mcollections + unless (federation || null moreRemotes) $ + throwE "Federation disabled but remote collection members found" remotesHttp <- lift $ deliverRemoteDB obid remoteRecips moreRemotes return (lmid, obid, doc, remotesHttp) (lmid, obid, doc, remotesHttp) <- case result of