UI: Project: Parents: Display parent invite info & status
This commit is contained in:
parent
d32da785b8
commit
b80d897e0c
2 changed files with 94 additions and 2 deletions
|
@ -823,7 +823,71 @@ getProjectParentsR projectHash = do
|
||||||
)
|
)
|
||||||
|
|
||||||
getHtml projectID project actor parents = do
|
getHtml projectID project actor parents = do
|
||||||
|
invites <- handlerToWidget $ runDB $ do
|
||||||
|
dests <- E.select $ E.from $ \ (dest `E.InnerJoin` holder `E.LeftOuterJoin` accept `E.LeftOuterJoin` delegl `E.LeftOuterJoin` delegr) -> do
|
||||||
|
E.on $ accept E.?. DestUsAcceptId E.==. delegr E.?. DestThemSendDelegatorRemoteDest
|
||||||
|
E.on $ accept E.?. DestUsAcceptId E.==. delegl E.?. DestThemSendDelegatorLocalDest
|
||||||
|
E.on $ E.just (dest E.^. DestId) E.==. accept E.?. DestUsAcceptDest
|
||||||
|
E.on $ dest E.^. DestId E.==. holder E.^. DestHolderProjectDest
|
||||||
|
E.where_ $
|
||||||
|
holder E.^. DestHolderProjectProject E.==. E.val projectID E.&&.
|
||||||
|
E.isNothing (delegl E.?. DestThemSendDelegatorLocalId) E.&&.
|
||||||
|
E.isNothing (delegr E.?. DestThemSendDelegatorRemoteId)
|
||||||
|
E.orderBy [E.asc $ dest E.^. DestId]
|
||||||
|
return dest
|
||||||
|
for dests $ \ (Entity destID (Dest role)) -> do
|
||||||
|
parent <- do
|
||||||
|
topic <- getDestTopic destID
|
||||||
|
bitraverse
|
||||||
|
(\ (_, e) -> do
|
||||||
|
jID <-
|
||||||
|
case e of
|
||||||
|
Left j -> pure j
|
||||||
|
Right _ -> error "I'm a Project but my parent is a Group"
|
||||||
|
j <- getJust jID
|
||||||
|
actor <- getJust $ projectActor j
|
||||||
|
return (jID, actor)
|
||||||
|
)
|
||||||
|
(\ (_, actorID) -> getRemoteActorData actorID)
|
||||||
|
topic
|
||||||
|
accept <- isJust <$> getBy (UniqueDestUsAccept destID)
|
||||||
|
((inviter, time), us) <- do
|
||||||
|
usOrThem <-
|
||||||
|
requireEitherAlt
|
||||||
|
(getKeyBy $ UniqueDestOriginUs destID)
|
||||||
|
(getKeyBy $ UniqueDestOriginThem destID)
|
||||||
|
"Neither us nor them"
|
||||||
|
"Both us and them"
|
||||||
|
(addOrActor, us) <-
|
||||||
|
case usOrThem of
|
||||||
|
Left _usID -> (,True) <$>
|
||||||
|
requireEitherAlt
|
||||||
|
(fmap destUsGestureLocalActivity <$> getValBy (UniqueDestUsGestureLocal destID))
|
||||||
|
(fmap (destUsGestureRemoteActor &&& destUsGestureRemoteActivity) <$> getValBy (UniqueDestUsGestureRemote destID))
|
||||||
|
"Neither local not remote"
|
||||||
|
"Both local and remote"
|
||||||
|
Right themID -> (,False) <$>
|
||||||
|
requireEitherAlt
|
||||||
|
(fmap destThemGestureLocalAdd <$> getValBy (UniqueDestThemGestureLocal themID))
|
||||||
|
(fmap (destThemGestureRemoteActor &&& destThemGestureRemoteAdd) <$> getValBy (UniqueDestThemGestureRemote themID))
|
||||||
|
"Neither local not remote"
|
||||||
|
"Both local and remote"
|
||||||
|
(,us) <$> case addOrActor of
|
||||||
|
Left addID -> do
|
||||||
|
OutboxItem outboxID _ time <- getJust addID
|
||||||
|
Entity actorID actor <- getByJust $ UniqueActorOutbox outboxID
|
||||||
|
(,time) . Left . (,actor) <$> getLocalActor actorID
|
||||||
|
Right (actorID, addID) -> do
|
||||||
|
RemoteActivity _ _ time <- getJust addID
|
||||||
|
(,time) . Right <$> getRemoteActorData actorID
|
||||||
|
return (inviter, us, parent, accept, time, role)
|
||||||
$(widgetFile "project/parents")
|
$(widgetFile "project/parents")
|
||||||
|
where
|
||||||
|
getRemoteActorData actorID = do
|
||||||
|
actor <- getJust actorID
|
||||||
|
object <- getJust $ remoteActorIdent actor
|
||||||
|
inztance <- getJust $ remoteObjectInstance object
|
||||||
|
return (inztance, object, actor)
|
||||||
|
|
||||||
getProjectParentLocalLiveR :: KeyHashid Project -> KeyHashid DestThemSendDelegatorLocal -> Handler ()
|
getProjectParentLocalLiveR :: KeyHashid Project -> KeyHashid DestThemSendDelegatorLocal -> Handler ()
|
||||||
getProjectParentLocalLiveR projectHash delegHash = do
|
getProjectParentLocalLiveR projectHash delegHash = do
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
$# This file is part of Vervis.
|
$# This file is part of Vervis.
|
||||||
$#
|
$#
|
||||||
$# Written in 2016, 2019, 2022, 2023 by fr33domlover <fr33domlover@riseup.net>.
|
$# Written in 2016, 2019, 2022, 2023, 2024
|
||||||
|
$# by fr33domlover <fr33domlover@riseup.net>.
|
||||||
$#
|
$#
|
||||||
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
||||||
$#
|
$#
|
||||||
|
@ -20,9 +21,36 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||||
<tr>
|
<tr>
|
||||||
<th>Role
|
<th>Role
|
||||||
<th>Since
|
<th>Since
|
||||||
<th>Child
|
<th>Parent
|
||||||
$forall (role, since, parent) <- parents
|
$forall (role, since, parent) <- parents
|
||||||
<tr>
|
<tr>
|
||||||
<td>#{show role}
|
<td>#{show role}
|
||||||
<td>#{showDate since}
|
<td>#{showDate since}
|
||||||
<td>^{projectLinkFedW parent}
|
<td>^{projectLinkFedW parent}
|
||||||
|
|
||||||
|
<h2>Invites
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Inviter
|
||||||
|
<th>Via
|
||||||
|
<th>Invited parent
|
||||||
|
<th>Parent accepted?
|
||||||
|
<th>Role
|
||||||
|
<th>Time
|
||||||
|
$forall (inviter, us, parent, accept, time, role) <- invites
|
||||||
|
<tr>
|
||||||
|
<td>^{actorLinkFedW inviter}
|
||||||
|
<td>
|
||||||
|
$if us
|
||||||
|
Us
|
||||||
|
$else
|
||||||
|
Them
|
||||||
|
<td>^{projectLinkFedW parent}
|
||||||
|
<td>
|
||||||
|
$if accept
|
||||||
|
[x]
|
||||||
|
$else
|
||||||
|
[_]
|
||||||
|
<td>#{show role}
|
||||||
|
<td>#{showDate time}
|
||||||
|
|
Loading…
Reference in a new issue