diff --git a/src/Vervis/Handler/Ticket.hs b/src/Vervis/Handler/Ticket.hs index dcf08af..eb319c9 100644 --- a/src/Vervis/Handler/Ticket.hs +++ b/src/Vervis/Handler/Ticket.hs @@ -301,18 +301,18 @@ getTicketR shar proj num = do , AP.ticketContent = TextHtml $ ticketDescription ticket , AP.ticketSource = TextPandocMarkdown $ ticketSource ticket , AP.ticketReplies = - encodeRouteLocal $ TicketDiscussionR shar proj num + Just $ encodeRouteLocal $ TicketDiscussionR shar proj num , AP.ticketAssignedTo = encodeRouteHome . SharerR . sharerIdent . fst <$> massignee , AP.ticketIsResolved = ticketStatus ticket == TSClosed , AP.ticketParticipants = - encodeRouteLocal $ TicketParticipantsR shar proj num + Just $ encodeRouteLocal $ TicketParticipantsR shar proj num , AP.ticketTeam = - encodeRouteLocal $ TicketTeamR shar proj num + Just $ encodeRouteLocal $ TicketTeamR shar proj num , AP.ticketDependsOn = map siblingUri deps , AP.ticketDependedBy = map siblingUri rdeps , AP.ticketEvents = - encodeRouteLocal $ TicketEventsR shar proj num + Just $ encodeRouteLocal $ TicketEventsR shar proj num } provideHtmlAndAP ticketAP $(widgetFile "ticket/one") diff --git a/src/Web/ActivityPub.hs b/src/Web/ActivityPub.hs index 19742d6..9996641 100644 --- a/src/Web/ActivityPub.hs +++ b/src/Web/ActivityPub.hs @@ -625,14 +625,14 @@ data Ticket = Ticket , ticketSummary :: TextHtml , ticketContent :: TextHtml , ticketSource :: TextPandocMarkdown - , ticketReplies :: LocalURI + , ticketReplies :: Maybe LocalURI , ticketAssignedTo :: Maybe FedURI , ticketIsResolved :: Bool - , ticketParticipants :: LocalURI - , ticketTeam :: LocalURI + , ticketParticipants :: Maybe LocalURI + , ticketTeam :: Maybe LocalURI , ticketDependsOn :: [FedURI] , ticketDependedBy :: [FedURI] - , ticketEvents :: LocalURI + , ticketEvents :: Maybe LocalURI } instance ActivityPub Ticket where @@ -664,14 +664,14 @@ instance ActivityPub Ticket where <*> (TextHtml . sanitizeBalance <$> o .: "summary") <*> (TextHtml . sanitizeBalance <$> o .: "content") <*> source .: "content" - <*> withHost h (f2l <$> o .: "replies") + <*> withHostMaybe h (fmap f2l <$> o .:? "replies") <*> o .:? (frg <> "assignedTo") <*> o .: (frg <> "isResolved") - <*> withHost h (f2l <$> o .: (frg <> "participants")) - <*> withHost h (f2l <$> o .: (frg <> "team")) + <*> withHostMaybe h (fmap f2l <$> o .:? (frg <> "participants")) + <*> withHostMaybe h (fmap f2l <$> o .:? (frg <> "team")) <*> o .:? (frg <> "dependsOn") .!= [] <*> o .:? (frg <> "dependedBy") .!= [] - <*> withHost h (f2l <$> o .: (frg <> "events")) + <*> withHostMaybe h (fmap f2l <$> o .:? (frg <> "events")) toSeries host (Ticket id_ attributedTo published updated context name summary content @@ -691,14 +691,14 @@ instance ActivityPub Ticket where [ "content" .= source , "mediaType" .= ("text/markdown; variant=Pandoc" :: Text) ] - <> "replies" .= l2f host replies + <> "replies" .=? (l2f host <$> replies) <> (frg <> "assignedTo") .=? assignedTo <> (frg <> "isResolved") .= isResolved - <> (frg <> "participants") .= l2f host participants - <> (frg <> "team") .= l2f host team + <> (frg <> "participants") .=? (l2f host <$> participants) + <> (frg <> "team") .=? (l2f host <$> team) <> (frg <> "dependsOn") .=% dependsOn <> (frg <> "dependedBy") .=% dependedBy - <> (frg <> "events") .= l2f host events + <> (frg <> "events") .=? (l2f host <$> events) data Accept = Accept { acceptObject :: FedURI