1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 00:54:52 +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
personInbox
personFollowers
(\ _ _ -> return $ Just "Undo object is a RemoteFollow, but isn't under this sharer")
tryTicket
where
getRecip = do
sid <- getKeyBy404 $ UniqueSharer shr
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
:: ShrIdent