link: can create managed groups for new collections

Just defers to contact-view for managed group creation.
This commit is contained in:
Fang 2020-03-03 00:12:05 +01:00
parent 0539f3ca1f
commit 111333ec93
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
5 changed files with 33 additions and 12 deletions

View File

@ -12,7 +12,7 @@
::
/- *link-view,
metadata-store, *invite-store, group-store,
group-hook, permission-hook, metadata-hook
group-hook, permission-hook, metadata-hook, contact-view
/+ *link, *server, default-agent, verb, dbug
::
|%
@ -274,7 +274,9 @@
=/ group-path=path
?- -.members.act
%group path.members.act
%ships [~.~ (scot %p our.bowl) path.act]
%ships %+ weld
?:(real-group.act ~ [~.~]~)
[(scot %p our.bowl) path.act]
==
|^
=; group-setup=(list card)
@ -294,6 +296,16 @@
==
==
?: ?=(%group -.members.act) ~
:: if the group is "real", make contact-view do the heavy lifting
::
?: real-group.act
:_ ~
%^ do-poke %contact-view
%contact-view-action
!> ^- contact-view-action:contact-view
[%create group-path [ships.members title description]:act]
:: for "unmanaged" groups, do it ourselves
::
:* :: create the new group
::
%^ do-poke %group-store

View File

@ -5,14 +5,21 @@
|%
++ noun view-action
++ json
|^ %- of
:~ %create^(ot 'path'^pa 'title'^so 'description'^so 'members'^mems ~)
==
|^ (of %create^create ~)
::
++ create
%- ot
:~ 'path'^pa
'title'^so
'description'^so
'members'^mems
'realGroup'^bo
==
::
++ mems
%- of
:~ %group^pa
%ships^(cu sy (ar (su ;~(pfix sig fed:ag))))
:~ 'group'^pa
'ships'^(cu sy (ar (su ;~(pfix sig fed:ag))))
==
--
--

View File

@ -7,6 +7,7 @@
title=@t
description=@t
members=$%([%group =path] [%ships ships=(set ship)])
real-group=?
==
==
--

View File

@ -144,10 +144,11 @@ class UrbitApi {
);
}
createCollection(path, title, description, members) {
// members is either {group:'/group-path'} or {'ships':[~zod]}
createCollection(path, title, description, members, realGroup) {
// members is either {group:'/group-path'} or {'ships':[~zod]},
// with realGroup signifying if ships should become a managed group or not.
return this.action("link-view", "link-view-action", {
create: {path, title, description, members}
create: {path, title, description, members, realGroup}
})
}

View File

@ -125,12 +125,12 @@ export class NewScreen extends Component {
ships: []
}, () => {
api.setSpinner(true);
//TODO account for state.createGroup
let submit = api.createCollection(
appPath,
state.title,
state.description,
target
target,
state.createGroup
);
submit.then(() => {
api.setSpinner(false);