UI: Removal form: Extend to work on children/parents as well
This commit is contained in:
parent
7dcb225aa8
commit
1f36657084
3 changed files with 10 additions and 11 deletions
|
@ -1273,12 +1273,12 @@ remove
|
||||||
-> FedURI
|
-> FedURI
|
||||||
-> FedURI
|
-> FedURI
|
||||||
-> ExceptT Text Handler (Maybe HTML, [Aud URIMode], AP.Remove URIMode)
|
-> ExceptT Text Handler (Maybe HTML, [Aud URIMode], AP.Remove URIMode)
|
||||||
remove personID uRecipient uResourceCollabs = do
|
remove personID uRecipient uCollection = do
|
||||||
|
|
||||||
theater <- asksSite appTheater
|
theater <- asksSite appTheater
|
||||||
env <- asksSite appEnv
|
env <- asksSite appEnv
|
||||||
|
|
||||||
let activity = AP.Remove uRecipient uResourceCollabs
|
let activity = AP.Remove uRecipient uCollection
|
||||||
(resource, recipient) <-
|
(resource, recipient) <-
|
||||||
runActE $ parseRemove (Left $ LocalActorPerson personID) activity
|
runActE $ parseRemove (Left $ LocalActorPerson personID) activity
|
||||||
|
|
||||||
|
@ -1291,9 +1291,7 @@ remove personID uRecipient uResourceCollabs = do
|
||||||
manager <- asksSite appHttpManager
|
manager <- asksSite appHttpManager
|
||||||
coll <- ExceptT $ liftIO $ first T.pack <$> AP.fetchAPID manager AP.collectionId h luColl
|
coll <- ExceptT $ liftIO $ first T.pack <$> AP.fetchAPID manager AP.collectionId h luColl
|
||||||
lu <- fromMaybeE (AP.collectionContext (coll :: AP.Collection FedURI URIMode)) "Remote topic collabs has no 'context'"
|
lu <- fromMaybeE (AP.collectionContext (coll :: AP.Collection FedURI URIMode)) "Remote topic collabs has no 'context'"
|
||||||
AP.ResourceWithCollections _ mluCollabs _ mluMembers <- ExceptT $ liftIO $ first (T.pack . show) <$> AP.fetchRWC manager h lu
|
AP.ResourceWithCollections _ _mluCollabs _ _mluMembers <- ExceptT $ liftIO $ first (T.pack . show) <$> AP.fetchRWC manager h lu
|
||||||
unless (mluCollabs == Just luColl || mluMembers == Just luColl) $
|
|
||||||
throwE "Remove origin isn't a collabs list"
|
|
||||||
return $ ObjURI h lu
|
return $ ObjURI h lu
|
||||||
)
|
)
|
||||||
resource
|
resource
|
||||||
|
|
|
@ -1578,8 +1578,8 @@ postPublishAcceptR = do
|
||||||
redirect HomeR
|
redirect HomeR
|
||||||
|
|
||||||
removeForm = renderDivs $ (,,)
|
removeForm = renderDivs $ (,,)
|
||||||
<$> areq fedUriField "(URI) Whom to remove" Nothing
|
<$> areq fedUriField "(URI) Whom to remove" Nothing
|
||||||
<*> areq fedUriField "(URI) From which resource collaborators collection" Nothing
|
<*> areq fedUriField "(URI) From which collection" Nothing
|
||||||
<*> areq capField "(URI) Grant activity to use for authorization" Nothing
|
<*> areq capField "(URI) Grant activity to use for authorization" Nothing
|
||||||
|
|
||||||
getPublishRemoveR :: Handler Html
|
getPublishRemoveR :: Handler Html
|
||||||
|
@ -1587,7 +1587,7 @@ getPublishRemoveR = do
|
||||||
((_, widget), enctype) <- runFormPost removeForm
|
((_, widget), enctype) <- runFormPost removeForm
|
||||||
defaultLayout
|
defaultLayout
|
||||||
[whamlet|
|
[whamlet|
|
||||||
<h1>Remove someone from a resource
|
<h1>Remove an actor from a collaborators/components/children/parents collection
|
||||||
<form method=POST action=@{PublishRemoveR} enctype=#{enctype}>
|
<form method=POST action=@{PublishRemoveR} enctype=#{enctype}>
|
||||||
^{widget}
|
^{widget}
|
||||||
<input type=submit>
|
<input type=submit>
|
||||||
|
@ -1598,14 +1598,14 @@ postPublishRemoveR = do
|
||||||
federation <- getsYesod $ appFederation . appSettings
|
federation <- getsYesod $ appFederation . appSettings
|
||||||
unless federation badMethod
|
unless federation badMethod
|
||||||
|
|
||||||
(uRecipient, uResourceCollabs, (uCap, cap)) <-
|
(uRecipient, uCollection, (uCap, cap)) <-
|
||||||
runFormPostRedirect PublishRemoveR removeForm
|
runFormPostRedirect PublishRemoveR removeForm
|
||||||
|
|
||||||
(ep@(Entity pid _), a) <- getSender
|
(ep@(Entity pid _), a) <- getSender
|
||||||
senderHash <- encodeKeyHashid pid
|
senderHash <- encodeKeyHashid pid
|
||||||
|
|
||||||
result <- runExceptT $ do
|
result <- runExceptT $ do
|
||||||
(maybeSummary, audience, rmv) <- remove pid uRecipient uResourceCollabs
|
(maybeSummary, audience, rmv) <- remove pid uRecipient uCollection
|
||||||
(localRecips, remoteRecips, fwdHosts, action) <-
|
(localRecips, remoteRecips, fwdHosts, action) <-
|
||||||
makeServerInput (Just uCap) maybeSummary audience (AP.RemoveActivity rmv)
|
makeServerInput (Just uCap) maybeSummary audience (AP.RemoveActivity rmv)
|
||||||
handleViaActor pid (Just cap) localRecips remoteRecips fwdHosts action
|
handleViaActor pid (Just cap) localRecips remoteRecips fwdHosts action
|
||||||
|
|
|
@ -62,7 +62,8 @@ $# Comment on a ticket or merge request
|
||||||
Invite someone to a resource
|
Invite someone to a resource
|
||||||
<li>
|
<li>
|
||||||
<a href=@{PublishRemoveR}>
|
<a href=@{PublishRemoveR}>
|
||||||
Remove someone from a resource
|
Remove a collaborator/component/project/team from a
|
||||||
|
component/project/team/child/parent
|
||||||
<li>
|
<li>
|
||||||
<a href=@{PublishAddR}>
|
<a href=@{PublishAddR}>
|
||||||
Add a component/child/parent to a project/team
|
Add a component/child/parent to a project/team
|
||||||
|
|
Loading…
Reference in a new issue