mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-29 18:06:43 +03:00
chat: address review comments
This commit is contained in:
parent
5f4fc28bc9
commit
531efa82a9
@ -2,7 +2,7 @@
|
||||
:: mirror chat data from foreign to local based on read permissions
|
||||
:: allow sending chat messages to foreign paths based on write perms
|
||||
::
|
||||
/- *permission-store, *chat-hook, *invite-store, *metadata-store,
|
||||
/- *permission-store, *invite-store, *metadata-store,
|
||||
*permission-hook, *group-store, *permission-group-hook, ::TMP for upgrade
|
||||
hook=chat-hook,
|
||||
store=chat-store,
|
||||
@ -24,7 +24,7 @@
|
||||
==
|
||||
+$ state-0 [%0 state-base]
|
||||
+$ state-base
|
||||
$: =synced
|
||||
$: =synced:hook
|
||||
invite-created=_|
|
||||
allow-history=(map path ?)
|
||||
==
|
||||
|
@ -29,83 +29,83 @@
|
||||
==
|
||||
::
|
||||
++ envelope
|
||||
|= =^envelope
|
||||
^- json
|
||||
%- pairs
|
||||
:~ [%uid s+(scot %uv uid.envelope)]
|
||||
[%number (numb number.envelope)]
|
||||
[%author (ship author.envelope)]
|
||||
[%when (time when.envelope)]
|
||||
[%letter (letter letter.envelope)]
|
||||
==
|
||||
|= =^envelope
|
||||
^- json
|
||||
%- pairs
|
||||
:~ [%uid s+(scot %uv uid.envelope)]
|
||||
[%number (numb number.envelope)]
|
||||
[%author (ship author.envelope)]
|
||||
[%when (time when.envelope)]
|
||||
[%letter (letter letter.envelope)]
|
||||
==
|
||||
::
|
||||
++ config
|
||||
|= =^config
|
||||
^- json
|
||||
=, enjs:format
|
||||
%- pairs
|
||||
:~ [%length (numb length.config)]
|
||||
[%read (numb read.config)]
|
||||
==
|
||||
|= =^config
|
||||
^- json
|
||||
=, enjs:format
|
||||
%- pairs
|
||||
:~ [%length (numb length.config)]
|
||||
[%read (numb read.config)]
|
||||
==
|
||||
::
|
||||
++ configs
|
||||
|= cfg=^configs
|
||||
^- json
|
||||
%+ frond %chat-configs
|
||||
%- pairs
|
||||
%+ turn ~(tap by cfg)
|
||||
|= [pax=^path =^config]
|
||||
^- [cord json]
|
||||
[(spat pax) (^config config)]
|
||||
|= cfg=^configs
|
||||
^- json
|
||||
%+ frond %chat-configs
|
||||
%- pairs
|
||||
%+ turn ~(tap by cfg)
|
||||
|= [pax=^path =^config]
|
||||
^- [cord json]
|
||||
[(spat pax) (^config config)]
|
||||
::
|
||||
++ inbox
|
||||
|= box=^inbox
|
||||
^- json
|
||||
%+ frond %chat-initial
|
||||
%- pairs
|
||||
%+ turn ~(tap by box)
|
||||
|= [pax=^path =mailbox]
|
||||
^- [cord json]
|
||||
:- (spat pax)
|
||||
%- pairs
|
||||
:~ [%envelopes [%a (turn envelopes.mailbox envelope)]]
|
||||
[%config (config config.mailbox)]
|
||||
==
|
||||
|= box=^inbox
|
||||
^- json
|
||||
%+ frond %chat-initial
|
||||
%- pairs
|
||||
%+ turn ~(tap by box)
|
||||
|= [pax=^path =mailbox]
|
||||
^- [cord json]
|
||||
:- (spat pax)
|
||||
%- pairs
|
||||
:~ [%envelopes [%a (turn envelopes.mailbox envelope)]]
|
||||
[%config (config config.mailbox)]
|
||||
==
|
||||
::
|
||||
++ update
|
||||
|= upd=^update
|
||||
^- json
|
||||
%+ frond %chat-update
|
||||
%- pairs
|
||||
:~
|
||||
?: ?=(%message -.upd)
|
||||
:- %message
|
||||
%- pairs
|
||||
:~ [%path (path path.upd)]
|
||||
[%envelope (envelope envelope.upd)]
|
||||
==
|
||||
?: ?=(%messages -.upd)
|
||||
:- %messages
|
||||
%- pairs
|
||||
:~ [%path (path path.upd)]
|
||||
[%start (numb start.upd)]
|
||||
[%end (numb end.upd)]
|
||||
[%envelopes [%a (turn envelopes.upd envelope)]]
|
||||
==
|
||||
?: ?=(%read -.upd)
|
||||
[%read (pairs [%path (path path.upd)]~)]
|
||||
?: ?=(%create -.upd)
|
||||
[%create (pairs [%path (path path.upd)]~)]
|
||||
?: ?=(%delete -.upd)
|
||||
[%delete (pairs [%path (path path.upd)]~)]
|
||||
?: ?=(%config -.upd)
|
||||
:- %config
|
||||
%- pairs
|
||||
:~ [%path (path path.upd)]
|
||||
[%config (config config.upd)]
|
||||
==
|
||||
[*@t *json]
|
||||
==
|
||||
|= upd=^update
|
||||
^- json
|
||||
%+ frond %chat-update
|
||||
%- pairs
|
||||
:~
|
||||
?: ?=(%message -.upd)
|
||||
:- %message
|
||||
%- pairs
|
||||
:~ [%path (path path.upd)]
|
||||
[%envelope (envelope envelope.upd)]
|
||||
==
|
||||
?: ?=(%messages -.upd)
|
||||
:- %messages
|
||||
%- pairs
|
||||
:~ [%path (path path.upd)]
|
||||
[%start (numb start.upd)]
|
||||
[%end (numb end.upd)]
|
||||
[%envelopes [%a (turn envelopes.upd envelope)]]
|
||||
==
|
||||
?: ?=(%read -.upd)
|
||||
[%read (pairs [%path (path path.upd)]~)]
|
||||
?: ?=(%create -.upd)
|
||||
[%create (pairs [%path (path path.upd)]~)]
|
||||
?: ?=(%delete -.upd)
|
||||
[%delete (pairs [%path (path path.upd)]~)]
|
||||
?: ?=(%config -.upd)
|
||||
:- %config
|
||||
%- pairs
|
||||
:~ [%path (path path.upd)]
|
||||
[%config (config config.upd)]
|
||||
==
|
||||
[*@t *json]
|
||||
==
|
||||
--
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
|
@ -10,42 +10,42 @@
|
||||
=< (parse-json jon)
|
||||
|%
|
||||
++ parse-json
|
||||
%- of
|
||||
:~ [%create create]
|
||||
[%delete delete]
|
||||
[%join join]
|
||||
[%groupify groupify]
|
||||
==
|
||||
%- of
|
||||
:~ [%create create]
|
||||
[%delete delete]
|
||||
[%join join]
|
||||
[%groupify groupify]
|
||||
==
|
||||
::
|
||||
++ create
|
||||
%- ot
|
||||
:~ [%title so]
|
||||
[%description so]
|
||||
[%app-path pa]
|
||||
[%group-path pa]
|
||||
[%security sec]
|
||||
[%members (as (su ;~(pfix sig fed:ag)))]
|
||||
[%allow-history bo]
|
||||
==
|
||||
%- ot
|
||||
:~ [%title so]
|
||||
[%description so]
|
||||
[%app-path pa]
|
||||
[%group-path pa]
|
||||
[%security sec]
|
||||
[%members (as (su ;~(pfix sig fed:ag)))]
|
||||
[%allow-history bo]
|
||||
==
|
||||
::
|
||||
++ delete
|
||||
(ot [%app-path pa]~)
|
||||
(ot [%app-path pa]~)
|
||||
::
|
||||
++ join
|
||||
%- ot
|
||||
:~ [%ship (su ;~(pfix sig fed:ag))]
|
||||
[%app-path pa]
|
||||
[%ask-history bo]
|
||||
==
|
||||
%- ot
|
||||
:~ [%ship (su ;~(pfix sig fed:ag))]
|
||||
[%app-path pa]
|
||||
[%ask-history bo]
|
||||
==
|
||||
::
|
||||
++ groupify
|
||||
=- (ot [%app-path pa] [%existing -] ~)
|
||||
(mu (ot [%group-path pa] [%inclusive bo] ~))
|
||||
=- (ot [%app-path pa] [%existing -] ~)
|
||||
(mu (ot [%group-path pa] [%inclusive bo] ~))
|
||||
::
|
||||
++ sec
|
||||
=, dejs:format
|
||||
^- $-(json rw-security)
|
||||
(su (perk %channel %village %journal %mailbox ~))
|
||||
=, dejs:format
|
||||
^- $-(json rw-security)
|
||||
(su (perk %channel %village %journal %mailbox ~))
|
||||
--
|
||||
--
|
||||
--
|
||||
|
@ -5,8 +5,6 @@
|
||||
++ grab
|
||||
|%
|
||||
++ noun action
|
||||
++ json
|
||||
|= jon=^json
|
||||
(action:dejs jon)
|
||||
++ json action:dejs
|
||||
--
|
||||
--
|
||||
|
@ -4,9 +4,7 @@
|
||||
++ grab
|
||||
|%
|
||||
++ noun action
|
||||
++ json
|
||||
|= jon=^json
|
||||
(action:dejs jon)
|
||||
++ json action:dejs
|
||||
--
|
||||
--
|
||||
|
||||
|
@ -4,8 +4,6 @@
|
||||
++ grab
|
||||
|%
|
||||
++ noun action
|
||||
++ json
|
||||
|= jon=^json
|
||||
(action:dejs jon)
|
||||
++ json action:dejs
|
||||
--
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user