Fix MessageR, setting audience to the one specified in the Create activity
This commit is contained in:
parent
e848fe5fed
commit
95a0806ef3
1 changed files with 7 additions and 1 deletions
|
@ -43,6 +43,7 @@ import Yesod.Form.Types (FormResult (..))
|
||||||
import Yesod.Persist.Core (runDB, get404, getBy404)
|
import Yesod.Persist.Core (runDB, get404, getBy404)
|
||||||
|
|
||||||
import Data.Aeson.Encode.Pretty.ToEncoding
|
import Data.Aeson.Encode.Pretty.ToEncoding
|
||||||
|
import Database.Persist.JSON
|
||||||
import Network.FedURI
|
import Network.FedURI
|
||||||
import Web.ActivityPub
|
import Web.ActivityPub
|
||||||
import Yesod.Auth.Unverified
|
import Yesod.Auth.Unverified
|
||||||
|
@ -147,6 +148,8 @@ getDiscussionMessage shr lmid = do
|
||||||
rs <- getJust $ remoteMessageAuthor rmParent
|
rs <- getJust $ remoteMessageAuthor rmParent
|
||||||
i <- getJust $ remoteActorInstance rs
|
i <- getJust $ remoteActorInstance rs
|
||||||
return $ l2f (instanceHost i) (remoteActorIdent rs)
|
return $ l2f (instanceHost i) (remoteActorIdent rs)
|
||||||
|
ob <- getJust $ localMessageCreate lm
|
||||||
|
let activity = docValue $ persistJSONValue $ outboxItemActivity ob
|
||||||
|
|
||||||
host <- getsYesod $ appInstanceHost . appSettings
|
host <- getsYesod $ appInstanceHost . appSettings
|
||||||
route2local <- getEncodeRouteLocal
|
route2local <- getEncodeRouteLocal
|
||||||
|
@ -154,7 +157,10 @@ getDiscussionMessage shr lmid = do
|
||||||
return $ Doc host Note
|
return $ Doc host Note
|
||||||
{ noteId = Just $ route2local $ MessageR shr lmhid
|
{ noteId = Just $ route2local $ MessageR shr lmhid
|
||||||
, noteAttrib = route2local $ SharerR shr
|
, 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
|
, noteReplyTo = Just $ fromMaybe uContext muParent
|
||||||
, noteContext = Just uContext
|
, noteContext = Just uContext
|
||||||
, notePublished = Just $ messageCreated m
|
, notePublished = Just $ messageCreated m
|
||||||
|
|
Loading…
Reference in a new issue