Use insertBy' in instanceAndActor
This commit is contained in:
parent
c2ee6a7f16
commit
735a6a39cb
1 changed files with 14 additions and 9 deletions
|
@ -138,15 +138,20 @@ instanceAndActor
|
||||||
-> LocalURI
|
-> LocalURI
|
||||||
-> YesodDB site (InstanceId, RemoteActorId, Maybe Bool)
|
-> YesodDB site (InstanceId, RemoteActorId, Maybe Bool)
|
||||||
instanceAndActor host luActor luInbox = do
|
instanceAndActor host luActor luInbox = do
|
||||||
(iid, inew) <- idAndNew <$> insertBy (Instance host)
|
(iid, inew) <- idAndNew <$> insertBy' (Instance host)
|
||||||
let rs = RemoteActor luActor iid luInbox Nothing
|
(raid, ranew) <-
|
||||||
if inew
|
idAndNew <$> insertBy' (RemoteActor luActor iid luInbox Nothing)
|
||||||
then do
|
return $
|
||||||
rsid <- insert rs
|
( iid
|
||||||
return (iid, rsid, Nothing)
|
, raid
|
||||||
else do
|
, if inew
|
||||||
(rsid, rsnew) <- idAndNew <$> insertBy rs
|
then if ranew
|
||||||
return (iid, rsid, Just rsnew)
|
then Nothing
|
||||||
|
else Just False
|
||||||
|
else if ranew
|
||||||
|
then Just True
|
||||||
|
else Just False
|
||||||
|
)
|
||||||
|
|
||||||
actorRoom
|
actorRoom
|
||||||
:: ( PersistQueryRead (YesodPersistBackend site)
|
:: ( PersistQueryRead (YesodPersistBackend site)
|
||||||
|
|
Loading…
Reference in a new issue