1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 15:54:51 +09:00

S2S: In Undo handler for sharer inbox, support unfollowing sharer tickets

This commit is contained in:
fr33domlover 2020-04-10 10:47:43 +00:00
parent e406b08f44
commit 40a5b336a4

View file

@ -545,11 +545,26 @@ sharerUndoF shr =
getRecip getRecip
personInbox personInbox
personFollowers personFollowers
(\ _ _ -> return $ Just "Undo object is a RemoteFollow, but isn't under this sharer") tryTicket
where where
getRecip = do getRecip = do
sid <- getKeyBy404 $ UniqueSharer shr sid <- getKeyBy404 $ UniqueSharer shr
getBy404 $ UniquePersonIdent sid getBy404 $ UniquePersonIdent sid
tryTicket pid fsid = do
mltid <- getKeyBy $ UniqueLocalTicketFollowers fsid
case mltid of
Nothing -> return $ Just "Undo object is a RemoteFollow, but isn't under this sharer"
Just ltid -> do
mtal <- getBy $ UniqueTicketAuthorLocal ltid
case mtal of
Just (Entity talid tal)
| ticketAuthorLocalAuthor tal == pid -> do
mtup <- getBy $ UniqueTicketUnderProjectAuthor talid
return $
case mtup of
Nothing -> Nothing
Just _ -> Just "Undo object is a RemoteFollow of a ticket authored by this sharer, but is hosted by the project"
_ -> return $ Just "Undo object is a RemoteFollow of a ticket of another author"
projectUndoF projectUndoF
:: ShrIdent :: ShrIdent