diff --git a/src/Vervis/Handler/Discussion.hs b/src/Vervis/Handler/Discussion.hs index 66fe8da..392cd03 100644 --- a/src/Vervis/Handler/Discussion.hs +++ b/src/Vervis/Handler/Discussion.hs @@ -43,6 +43,7 @@ import Yesod.Form.Types (FormResult (..)) import Yesod.Persist.Core (runDB, get404, getBy404) import Data.Aeson.Encode.Pretty.ToEncoding +import Database.Persist.JSON import Network.FedURI import Web.ActivityPub import Yesod.Auth.Unverified @@ -147,6 +148,8 @@ getDiscussionMessage shr lmid = do rs <- getJust $ remoteMessageAuthor rmParent i <- getJust $ remoteActorInstance rs return $ l2f (instanceHost i) (remoteActorIdent rs) + ob <- getJust $ localMessageCreate lm + let activity = docValue $ persistJSONValue $ outboxItemActivity ob host <- getsYesod $ appInstanceHost . appSettings route2local <- getEncodeRouteLocal @@ -154,7 +157,10 @@ getDiscussionMessage shr lmid = do return $ Doc host Note { noteId = Just $ route2local $ MessageR shr lmhid , noteAttrib = route2local $ SharerR shr - , noteAudience = error "TODO noteAudience" + , noteAudience = + case activitySpecific activity of + CreateActivity (Create note) -> noteAudience note + _ -> error $ "lmid#" ++ show (fromSqlKey lmid) ++ "'s create isn't a Create activity!" , noteReplyTo = Just $ fromMaybe uContext muParent , noteContext = Just uContext , notePublished = Just $ messageCreated m