From f07b56c259669ee6e1f7ecbc26afa5628c64fad8 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sat, 18 May 2019 10:09:47 +0000 Subject: [PATCH] Implement getOutboxItemR, serving AS2 and basic HTML --- src/Vervis/Handler/Inbox.hs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Vervis/Handler/Inbox.hs b/src/Vervis/Handler/Inbox.hs index 52c2634..368bb8e 100644 --- a/src/Vervis/Handler/Inbox.hs +++ b/src/Vervis/Handler/Inbox.hs @@ -309,7 +309,20 @@ getOutboxR :: ShrIdent -> Handler TypedContent getOutboxR = error "Not implemented yet" getOutboxItemR :: ShrIdent -> KeyHashid OutboxItem -> Handler TypedContent -getOutboxItemR = error "Not implemented yet" +getOutboxItemR shr obkhid = do + obid <- decodeKeyHashid404 obkhid + doc <- runDB $ do + sid <- getKeyBy404 $ UniqueSharer shr + pid <- getKeyBy404 $ UniquePersonIdent sid + ob <- get404 obid + unless (outboxItemPerson ob == pid) notFound + return $ persistJSONValue $ outboxItemActivity ob + selectRep $ do + provideAP $ pure doc + provideRep $ defaultLayout $ + [whamlet| +
#{AEP.encodePrettyToLazyText doc}
+            |]
 
 postOutboxR :: ShrIdent -> Handler Html
 postOutboxR shrAuthor = do