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

C2S: In followC, return friendly message if already following the target object

This commit is contained in:
fr33domlover 2020-05-13 13:29:39 +00:00
parent 43cd1a95f3
commit f296dc173c

View file

@ -774,10 +774,9 @@ followC shrUser summary audience follow@(AP.Follow uObject muContext hide) = run
Nothing -> lift $ insert_ $ FollowRemoteRequest pidAuthor uObject muContext (not hide) obiidFollow
Just (followee, actorRecip) -> do
(fsid, ibidRecip, unread, obidRecip) <- getFollowee followee
lift $ do
obiidAccept <- insertAcceptToOutbox luFollow actorRecip obidRecip
obiidAccept <- lift $ insertAcceptToOutbox luFollow actorRecip obidRecip
deliverFollowLocal pidAuthor fsid unread obiidFollow obiidAccept ibidRecip
deliverAcceptLocal obiidAccept ibidAuthor
lift $ deliverAcceptLocal obiidAccept ibidAuthor
remotesHttp <- lift $ deliverRemoteDB' dont obiidFollow remoteRecips []
return (obiidFollow, doc, remotesHttp)
lift $ forkWorker "Outbox POST handler: async HTTP delivery" $ deliverRemoteHttp dont obiidFollow doc remotesHttp
@ -875,9 +874,10 @@ followC shrUser summary audience follow@(AP.Follow uObject muContext hide) = run
return (obiid, doc, luAct)
deliverFollowLocal pidAuthor fsid unread obiidF obiidA ibidRecip = do
insert_ $ Follow pidAuthor fsid (not hide) obiidF obiidA
ibiid <- insert $ InboxItem unread
insert_ $ InboxItemLocal ibidRecip obiidF ibiid
mfid <- lift $ insertUnique $ Follow pidAuthor fsid (not hide) obiidF obiidA
_ <- fromMaybeE mfid "Already following this object"
ibiid <- lift $ insert $ InboxItem unread
lift $ insert_ $ InboxItemLocal ibidRecip obiidF ibiid
insertAcceptToOutbox luFollow actorRecip obidRecip = do
now <- liftIO getCurrentTime