Merge pull request #2361 from urbit/ixv/publish-update

OS1: publish ota-ability fixes
This commit is contained in:
Logan 2020-02-26 17:53:58 -08:00 committed by GitHub
commit 7aa22c8b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,7 +94,6 @@
?: ?=(%& -.old-state) ?: ?=(%& -.old-state)
[~ this(state p.old-state)] [~ this(state p.old-state)]
=/ zero !<(state-zero old) =/ zero !<(state-zero old)
:: unsubscribe from all foreign notebooks
:: kill all ford builds :: kill all ford builds
:: flush all state :: flush all state
:: detect files in /web/publish :: detect files in /web/publish
@ -105,7 +104,7 @@
:: send invites to all previously subscribed ships :: send invites to all previously subscribed ships
:: ::
|^ |^
=/ rav [%sing %t [%da now.bol] /app/publish/notebooks] =/ rav [%next %t [%da now.bol] /app/publish/notebooks]
=/ tile-json =/ tile-json
(frond:enjs:format %notifications (numb:enjs:format 0)) (frond:enjs:format %notifications (numb:enjs:format 0))
=/ init-cards=(list card) =/ init-cards=(list card)
@ -120,22 +119,20 @@
[%give %fact [/publishtile]~ %json !>(tile-json)] [%give %fact [/publishtile]~ %json !>(tile-json)]
== ==
=+ ^- [kick-cards=(list card) old-subs=(jug @tas @p)] kick-subs =+ ^- [kick-cards=(list card) old-subs=(jug @tas @p)] kick-subs
:_ this(state [%1 *state-one]) =/ inv-scry-pax
/(scot %p our.bol)/invite-store/(scot %da now.bol)/invitatory/publish/noun
=/ inv=(unit invitatory) .^((unit invitatory) %gx inv-scry-pax)
=| new-state=state-one
=? tile-num.new-state ?=(^ inv)
~(wyt by u.inv)
:_ this(state [%1 new-state])
;: weld ;: weld
kill-builds kill-builds
leave-subs
kick-cards kick-cards
init-cards init-cards
(move-files old-subs) (move-files old-subs)
== ==
:: ::
++ leave-subs
^- (list card)
%+ turn ~(tap by wex.bol)
|= [[wir=wire who=@p @] ? path]
^- card
[%pass wir %agent [who %publish] %leave ~]
::
++ kick-subs ++ kick-subs
^- [(list card) (jug @tas @p)] ^- [(list card) (jug @tas @p)]
=+ ^- [paths=(list path) subs=(jug @tas @p)] =+ ^- [paths=(list path) subs=(jug @tas @p)]
@ -343,6 +340,9 @@
=^ cards state =^ cards state
(handle-invite-update:main !<(invite-update q.cage.sin)) (handle-invite-update:main !<(invite-update q.cage.sin))
[cards this] [cards this]
::
[%collection *]
[~ this]
== ==
== ==
:: ::
@ -635,7 +635,7 @@
=/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]] =/ rif=riff:clay [q.byk.bol `[%next %x [%da now.bol] pax]]
:_ (~(put by notes) note-name new-note) :_ (~(put by notes) note-name new-note)
;: weld ;: weld
[%pass (welp /read/comment pax) %arvo %c %warp our.bol rif]~ [%pass (welp /read/note pax) %arvo %c %warp our.bol rif]~
comment-cards comment-cards
cards cards
== ==
@ -667,13 +667,11 @@
++ form-note ++ form-note
|= [note-name=@tas udon=@t] |= [note-name=@tas udon=@t]
^- note ^- note
=/ body=tape (slag (add 3 (need (find ";>" (trip udon)))) (trip udon)) =/ front-idx (add 3 (need (find ";>" (trip udon))))
=/ snippet=@t (of-wain:format (scag 1 (to-wain:format (crip body)))) =/ front-matter
:: =/ build=(each manx tang) (cat 3 (end 3 front-idx udon) 'dummy text\0a')
:: %- mule |. =/ body (cut 3 [front-idx (met 3 udon)] udon)
:: ^- manx =/ snippet=@t (of-wain:format (scag 1 (to-wain:format body)))
:: elm:(static:cram (ream udon))
::
=/ meta=(each (map term knot) tang) =/ meta=(each (map term knot) tang)
%- mule |. %- mule |.
%- ~(run by inf:(static:cram (ream udon))) %- ~(run by inf:(static:cram (ream udon)))
@ -692,12 +690,24 @@
=? title ?=(%.y -.meta) =? title ?=(%.y -.meta)
(fall (~(get by p.meta) %title) note-name) (fall (~(get by p.meta) %title) note-name)
:: ::
=/ date-created=@da now.bol
=? date-created ?=(%.y -.meta)
%+ fall
(biff (~(get by p.meta) %date-created) (slat %da))
now.bol
::
=/ last-modified=@da now.bol
=? last-modified ?=(%.y -.meta)
%+ fall
(biff (~(get by p.meta) %last-modified) (slat %da))
now.bol
::
:* author :* author
title title
note-name note-name
now.bol date-created
now.bol last-modified
%.n %.y
udon udon
snippet snippet
~ ~
@ -756,7 +766,8 @@
[%give %fact [/publishtile]~ %json !>(jon)]~ [%give %fact [/publishtile]~ %json !>(jon)]~
:: ::
%decline %decline
=. tile-num (dec tile-num) =? tile-num (gth tile-num 0)
(dec tile-num)
=/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num)) =/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num))
:_ state :_ state
[%give %fact [/publishtile]~ %json !>(jon)]~ [%give %fact [/publishtile]~ %json !>(jon)]~
@ -765,7 +776,8 @@
?> ?=([%notebook @ ~] path.invite.upd) ?> ?=([%notebook @ ~] path.invite.upd)
=/ book i.t.path.invite.upd =/ book i.t.path.invite.upd
=/ wir=wire /subscribe/(scot %p ship.invite.upd)/[book] =/ wir=wire /subscribe/(scot %p ship.invite.upd)/[book]
=. tile-num (dec tile-num) =? tile-num (gth tile-num 0)
(dec tile-num)
=/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num)) =/ jon=json (frond:enjs:format %notifications (numb:enjs:format tile-num))
:_ state :_ state
:~ [%pass wir %agent [ship.invite.upd %publish] %watch path.invite.upd] :~ [%pass wir %agent [ship.invite.upd %publish] %watch path.invite.upd]
@ -1028,6 +1040,8 @@
%- my %- my
:~ title+title.act :~ title+title.act
author+(scot %p src.bol) author+(scot %p src.bol)
date-created+(scot %da now.bol)
last-modified+(scot %da now.bol)
== ==
=. body.act (cat 3 body.act '\0a') =. body.act (cat 3 body.act '\0a')
=/ file=@t (add-front-matter front body.act) =/ file=@t (add-front-matter front body.act)
@ -1102,6 +1116,8 @@
%- my %- my
:~ title+title.act :~ title+title.act
author+(scot %p src.bol) author+(scot %p src.bol)
date-created+(scot %da date-created.u.note)
last-modified+(scot %da now.bol)
== ==
=. body.act (cat 3 body.act '\0a') =. body.act (cat 3 body.act '\0a')
=/ file=@t (add-front-matter front body.act) =/ file=@t (add-front-matter front body.act)
@ -1228,7 +1244,7 @@
=/ not=(unit note) (~(get by notes.u.book) note.act) =/ not=(unit note) (~(get by notes.u.book) note.act)
?~ not ?~ not
~|("nonexistent note: {<note.act>}" !!) ~|("nonexistent note: {<note.act>}" !!)
=? tile-num !read.u.not =? tile-num &(!read.u.not (gth tile-num 0))
(dec tile-num) (dec tile-num)
=. read.u.not %.y =. read.u.not %.y
=. notes.u.book (~(put by notes.u.book) note.act u.not) =. notes.u.book (~(put by notes.u.book) note.act u.not)
@ -1380,7 +1396,7 @@
?~ book ?~ book
[~ sty] [~ sty]
=/ not=note (~(got by notes.u.book) note.del) =/ not=note (~(got by notes.u.book) note.del)
=? tile-num !read.not =? tile-num &(!read.not (gth tile-num 0))
(dec tile-num) (dec tile-num)
=. notes.u.book (~(del by notes.u.book) note.del) =. notes.u.book (~(del by notes.u.book) note.del)
(emit-updates-and-state host.del book.del u.book del sty) (emit-updates-and-state host.del book.del u.book del sty)