mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-29 01:14:51 +09:00
New outbox post: Raise error if federation disabled but remote recipients found
This commit is contained in:
parent
f37b9b3f52
commit
b8c669f6fc
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue