S2S: In Follow handler for sharer inbox, support following of sharer tickets

This commit is contained in:
fr33domlover 2020-04-10 10:34:22 +00:00
parent f4ab99f7bb
commit e406b08f44

View file

@ -374,17 +374,31 @@ sharerFollowF shr =
objRoute objRoute
(SharerR shr) (SharerR shr)
getRecip getRecip
personInbox (personInbox . fst)
personOutbox (personOutbox . fst)
personFollowers followers
(SharerOutboxItemR shr) (SharerOutboxItemR shr)
where where
objRoute (SharerR shr') | shr == shr' = Just () objRoute (SharerR shr')
| shr == shr' = Just Nothing
objRoute (SharerTicketR shr' talkhid)
| shr == shr' = Just $ Just talkhid
objRoute _ = Nothing objRoute _ = Nothing
getRecip () = do getRecip mtalkhid = do
sid <- getKeyBy404 $ UniqueSharer shr sid <- getKeyBy404 $ UniqueSharer shr
getValBy404 $ UniquePersonIdent sid Entity pid p <- getBy404 $ UniquePersonIdent sid
mt <- for mtalkhid $ \ talkhid -> do
talid <- decodeKeyHashid404 talkhid
tal <- get404 talid
unless (ticketAuthorLocalAuthor tal == pid) notFound
mtup <- getBy $ UniqueTicketUnderProjectAuthor talid
unless (isNothing mtup) notFound
getJust $ ticketAuthorLocalTicket tal
return (p, mt)
followers (p, Nothing) = personFollowers p
followers (_, Just lt) = localTicketFollowers lt
projectFollowF projectFollowF
:: ShrIdent :: ShrIdent