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
|
||||
-> YesodDB site (InstanceId, RemoteActorId, Maybe Bool)
|
||||
instanceAndActor host luActor luInbox = do
|
||||
(iid, inew) <- idAndNew <$> insertBy (Instance host)
|
||||
let rs = RemoteActor luActor iid luInbox Nothing
|
||||
if inew
|
||||
then do
|
||||
rsid <- insert rs
|
||||
return (iid, rsid, Nothing)
|
||||
else do
|
||||
(rsid, rsnew) <- idAndNew <$> insertBy rs
|
||||
return (iid, rsid, Just rsnew)
|
||||
(iid, inew) <- idAndNew <$> insertBy' (Instance host)
|
||||
(raid, ranew) <-
|
||||
idAndNew <$> insertBy' (RemoteActor luActor iid luInbox Nothing)
|
||||
return $
|
||||
( iid
|
||||
, raid
|
||||
, if inew
|
||||
then if ranew
|
||||
then Nothing
|
||||
else Just False
|
||||
else if ranew
|
||||
then Just True
|
||||
else Just False
|
||||
)
|
||||
|
||||
actorRoom
|
||||
:: ( PersistQueryRead (YesodPersistBackend site)
|
||||
|
|
Loading…
Reference in a new issue