diff --git a/desk/app/chat.hoon b/desk/app/chat.hoon index 3154dbaf1f..4832b4e2ad 100644 --- a/desk/app/chat.hoon +++ b/desk/app/chat.hoon @@ -1568,6 +1568,9 @@ :: [%perm ~] ``chat-perm+!>(perm.chat) + :: + [%logs ~] + ``chat-logs+!>(log.chat) :: [%search %text skip=@ count=@ nedl=@ ~] %- some diff --git a/desk/app/diary.hoon b/desk/app/diary.hoon index b2c645adc9..9cde67cf3f 100644 --- a/desk/app/diary.hoon +++ b/desk/app/diary.hoon @@ -277,12 +277,20 @@ =+ !<(=action:d vase) =/ diary-core (di-abed:di-core p.action) ?: =(p.p.action our.bowl) - di-abet:(di-update:diary-core q.action) + :: we use now on the host to enforce host ordering + di-abet:(di-update:diary-core now.bowl q.q.action) di-abet:(di-proxy:diary-core q.action) :: %diary-remark-action =+ !<(act=remark-action:d vase) di-abet:(di-remark-diff:(di-abed:di-core p.act) q.act) + %import-channel + ?> from-self + =+ !<([=flag:d cr=create:d =log:d] vase) + =. cor (create cr) + ~& "importing {<(wyt:log-on:d log)>} logs to {}" + =/ core (di-abed:di-core flag) + di-abet:(di-apply-logs:core log) == ++ join |= =join:d @@ -836,6 +844,7 @@ ?+ pole [~ ~] [%notes rest=*] (peek:di-notes rest.pole) [%perm ~] ``diary-perm+!>(perm.diary) + [%logs ~] ``diary-logs+!>(log.diary) == :: ++ di-revoke @@ -1070,9 +1079,6 @@ |= [=time dif=diff:d] ?> di-can-write ^+ di-core - :: we use now on the host to enforce host ordering - =? time =(p.flag our.bowl) - now.bowl =. log.diary (put:log-on:d log.diary time dif) =. di-core diff --git a/desk/app/groups.hoon b/desk/app/groups.hoon index f42cede2b5..b9035322e6 100644 --- a/desk/app/groups.hoon +++ b/desk/app/groups.hoon @@ -1,4 +1,4 @@ -/- g=groups, ha=hark, h=heap, d=diary, c=chat +/- g=groups, ha=hark, h=heap, d=diary, c=chat, cl=clone /- g-one=group /- m-one=metadata-store /- meta @@ -183,6 +183,11 @@ %group-cancel =+ !<(=flag:g vase) ga-abet:ga-cancel:(ga-abed:gang-core flag) + :: + %group-do-clone + ?> from-self + =+ !<(=flag:g vase) + ga-abet:ga-clone:(ga-abed:gang-core flag) :: %invite-decline =+ !<(=flag:g vase) @@ -977,6 +982,7 @@ [%updates rest=*] (go-pub rest.pole) [%ui ~] go-core [%preview ~] go-preview + [%clone ~] go-clone :: [%bait host=@ name=@ ~] ?> ?=(%open -.cordon.group) @@ -1012,6 +1018,52 @@ (emit %give %kick ~ ~) go-core :: + ++ go-clone + =. cor + %- emil + %+ murn + ~(tap by channels.group) + |= [=nest:g =channel:g] + ?. (go-can-read src.bowl channel) ~ + ?+ p.nest ~ + %chat + =/ =log:c .^(log:c %gx (welp (channel-scry nest) /logs/noun)) + =/ new-log=log:c + =< + + %^ (dip:log-on:c @) log ~ + |= [st=@ =time =diff:c] + :_ [%.n st] + ?: ?=(%create -.diff) ~ + `diff + =/ =clone:cl [q.flag q.q.nest [%chat new-log]] + `[%give %fact ~ group-clone+!>(clone)] + %heap + =/ =log:h .^(log:h %gx (welp (channel-scry nest) /logs/noun)) + =/ new-log=log:h + =< + + %^ (dip:log-on:h @) log ~ + |= [st=@ =time =diff:h] + :_ [%.n st] + ?: ?=(%create -.diff) ~ + `diff + =/ =clone:cl [q.flag q.q.nest [%heap new-log]] + `[%give %fact ~ group-clone+!>(clone)] + %diary + =/ =log:d .^(log:d %gx (welp (channel-scry nest) /logs/noun)) + =/ new-log=log:d + =< + + %^ (dip:log-on:d @) log ~ + |= [st=@ =time =diff:d] + :_ [%.n st] + ?: ?=(%create -.diff) ~ + `diff + =/ =clone:cl [q.flag q.q.nest [%diary new-log]] + `[%give %fact ~ group-clone+!>(clone)] + == + =. cor + (emit %give %kick ~ ~) + go-core + :: ++ go-peek |= =(pole knot) ^- (unit (unit cage)) @@ -1071,6 +1123,8 @@ ^+ go-core ?+ wire !! [%updates ~] (go-take-update sign) + [%create ~] go-core + [%clone ~] (go-take-clone sign) :: [%join-channels ~] ?> ?=(%poke-ack -.sign) @@ -1140,6 +1194,38 @@ == == :: + ++ go-take-clone + |= =sign:agent:gall + ^+ go-core + ?+ -.sign go-core + %fact + =* cage cage.sign + =+ !<(=clone:cl q.cage) + ~& >>> clone + =/ create + :* [our.bowl group.clone] + name.clone + :: TODO placeholder title & description + (crip "{} title") + (crip "{} description") + :: TODO get these if necessary + readers=~ + writers=~ + == + =. cor + ?- +>-.clone + %chat + =/ tail=[flag:c create:c log:c] + [[our.bowl name.clone] create log.clone] + (emit %pass /groups/(scot %p our.bowl)/[group.clone]/clone %agent [our.bowl %chat] %poke %noun !>([%import-channel tail])) + %heap + (emit %pass /groups/(scot %p our.bowl)/[group.clone]/clone %agent [our.bowl %heap] %poke %import-channel !>([[our.bowl name.clone] create log.clone])) + %diary + (emit %pass /groups/(scot %p our.bowl)/[group.clone]/clone %agent [our.bowl %diary] %poke %import-channel !>([[our.bowl name.clone] create log.clone])) + == + go-core + == + :: ++ go-odd-update |= =mark ?. (is-old:epos mark) @@ -1810,6 +1896,24 @@ =. cor ga-give-update ga-core :: + ++ ga-clone + ^+ ga-core + =/ =create:g + :* name=q.flag + title=(crip "{} title") + description=(crip "{} description") + image='' + cover='' + *cordon:g + members=~ + secret=%.n + == + =. cor + (emit %pass /groups/(scot %p our.bowl)/[q.flag]/create %agent [our.bowl %groups] %poke %group-create !>(create)) + =. cor + (emit %pass /groups/(scot %p p.flag)/[q.flag]/clone %agent [our.bowl %groups] %watch /groups/(scot %p p.flag)/[q.flag]/clone) + ga-core + :: ++ ga-knock ^+ ga-core =. cor (emit knock:ga-pass) diff --git a/desk/app/heap.hoon b/desk/app/heap.hoon index 2752e12f58..ca03ff9a18 100644 --- a/desk/app/heap.hoon +++ b/desk/app/heap.hoon @@ -161,12 +161,20 @@ =+ !<(=action:h vase) =/ heap-core (he-abed:he-core p.action) ?: =(p.p.action our.bowl) - he-abet:(he-update:heap-core q.action) + :: we use now on the host to enforce host ordering + he-abet:(he-update:heap-core now.bowl q.q.action) he-abet:(he-proxy:heap-core q.action) :: %heap-remark-action =+ !<(act=remark-action:h vase) he-abet:(he-remark-diff:(he-abed:he-core p.act) q.act) + %import-channel + ?> from-self + =+ !<([=flag:h cr=create:h =log:h] vase) + =. cor (create cr) + ~& "importing {<(wyt:log-on:h log)>} logs to {}" + =/ core (he-abed:he-core flag) + he-abet:(he-apply-logs:core log) == ++ join |= =join:h @@ -777,7 +785,8 @@ ^- (unit (unit cage)) ?+ pole [~ ~] [%curios rest=*] (peek:he-curios rest.pole) - [%perm ~] ``heap-perm+!>(perm.heap) + [%perm ~] ``heap-perm+!>(perm.heap) + [%logs ~] ``heap-logs+!>(log.heap) == :: ++ he-revoke @@ -1038,9 +1047,6 @@ |= [=time d=diff:h] ^+ he-core ?> he-can-write - :: we use now on the host to enforce host ordering - =? time =(p.flag our.bowl) - now.bowl =. log.heap (put:log-on:h log.heap time d) =. he-core diff --git a/desk/mar/group/clone.hoon b/desk/mar/group/clone.hoon new file mode 100644 index 0000000000..ac77daf420 --- /dev/null +++ b/desk/mar/group/clone.hoon @@ -0,0 +1,12 @@ +/- cl=clone +|_ =clone:cl +++ grad %noun +++ grow + |% + ++ noun clone + -- +++ grab + |% + ++ noun clone:cl + -- +-- diff --git a/desk/sur/clone.hoon b/desk/sur/clone.hoon new file mode 100644 index 0000000000..96b68d0051 --- /dev/null +++ b/desk/sur/clone.hoon @@ -0,0 +1,11 @@ +/- h=heap, d=diary, c=chat +|% ++$ clone + $: group=term + name=term + $% [%chat =log:c] + [%heap =log:h] + [%diary =log:d] + == + == +--