1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-28 23:54:51 +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 Nothing -> lift $ insert_ $ FollowRemoteRequest pidAuthor uObject muContext (not hide) obiidFollow
Just (followee, actorRecip) -> do Just (followee, actorRecip) -> do
(fsid, ibidRecip, unread, obidRecip) <- getFollowee followee (fsid, ibidRecip, unread, obidRecip) <- getFollowee followee
lift $ do obiidAccept <- lift $ insertAcceptToOutbox luFollow actorRecip obidRecip
obiidAccept <- insertAcceptToOutbox luFollow actorRecip obidRecip deliverFollowLocal pidAuthor fsid unread obiidFollow obiidAccept ibidRecip
deliverFollowLocal pidAuthor fsid unread obiidFollow obiidAccept ibidRecip lift $ deliverAcceptLocal obiidAccept ibidAuthor
deliverAcceptLocal obiidAccept ibidAuthor
remotesHttp <- lift $ deliverRemoteDB' dont obiidFollow remoteRecips [] remotesHttp <- lift $ deliverRemoteDB' dont obiidFollow remoteRecips []
return (obiidFollow, doc, remotesHttp) return (obiidFollow, doc, remotesHttp)
lift $ forkWorker "Outbox POST handler: async HTTP delivery" $ deliverRemoteHttp dont 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) return (obiid, doc, luAct)
deliverFollowLocal pidAuthor fsid unread obiidF obiidA ibidRecip = do deliverFollowLocal pidAuthor fsid unread obiidF obiidA ibidRecip = do
insert_ $ Follow pidAuthor fsid (not hide) obiidF obiidA mfid <- lift $ insertUnique $ Follow pidAuthor fsid (not hide) obiidF obiidA
ibiid <- insert $ InboxItem unread _ <- fromMaybeE mfid "Already following this object"
insert_ $ InboxItemLocal ibidRecip obiidF ibiid ibiid <- lift $ insert $ InboxItem unread
lift $ insert_ $ InboxItemLocal ibidRecip obiidF ibiid
insertAcceptToOutbox luFollow actorRecip obidRecip = do insertAcceptToOutbox luFollow actorRecip obidRecip = do
now <- liftIO getCurrentTime now <- liftIO getCurrentTime