2020-09-01 04:54:39 +03:00
|
|
|
:: chat-view [landscape]:
|
|
|
|
::
|
|
|
|
:: sets up chat JS client, paginates data, and combines commands
|
2019-11-23 02:02:31 +03:00
|
|
|
:: into semantic actions for the UI
|
|
|
|
::
|
|
|
|
/- *permission-store,
|
|
|
|
*permission-hook,
|
2020-05-25 08:52:54 +03:00
|
|
|
*group,
|
2020-10-22 20:17:15 +03:00
|
|
|
inv=invite-store,
|
2020-02-26 00:23:07 +03:00
|
|
|
*metadata-store,
|
2020-05-25 08:52:54 +03:00
|
|
|
group-hook,
|
2019-11-23 02:02:31 +03:00
|
|
|
*permission-group-hook,
|
2020-02-26 00:23:07 +03:00
|
|
|
*chat-hook,
|
2020-06-01 21:34:32 +03:00
|
|
|
*metadata-hook,
|
2020-05-27 05:22:51 +03:00
|
|
|
hook=chat-hook,
|
2020-06-15 11:07:21 +03:00
|
|
|
contact-view,
|
|
|
|
pull-hook
|
2020-06-01 21:34:32 +03:00
|
|
|
/+ *server, default-agent, verb, dbug,
|
|
|
|
store=chat-store,
|
2020-05-25 08:52:54 +03:00
|
|
|
view=chat-view,
|
2020-05-27 05:22:51 +03:00
|
|
|
group-store,
|
2020-06-08 10:53:16 +03:00
|
|
|
grpl=group,
|
2020-06-15 11:07:21 +03:00
|
|
|
resource,
|
|
|
|
mdl=metadata
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
2020-04-03 00:43:03 +03:00
|
|
|
~% %chat-view-top ..is ~
|
2019-11-23 02:02:31 +03:00
|
|
|
|%
|
2020-05-29 19:57:51 +03:00
|
|
|
+$ versioned-state
|
|
|
|
$% state-0
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ state-0
|
|
|
|
$: %0
|
|
|
|
~
|
2020-06-02 09:24:37 +03:00
|
|
|
==
|
2020-05-25 08:52:54 +03:00
|
|
|
+$ poke
|
2020-06-02 09:24:37 +03:00
|
|
|
$% [%chat-action action:store]
|
2020-05-25 08:52:54 +03:00
|
|
|
[%group-action action:group-store]
|
2020-06-02 09:24:37 +03:00
|
|
|
[%chat-hook-action action:hook]
|
2020-05-25 08:52:54 +03:00
|
|
|
[%permission-hook-action permission-hook-action]
|
|
|
|
[%permission-group-hook-action permission-group-hook-action]
|
2020-05-29 19:57:51 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-23 02:02:31 +03:00
|
|
|
+$ card card:agent:gall
|
|
|
|
--
|
2020-05-29 19:57:51 +03:00
|
|
|
::
|
|
|
|
=| state-0
|
|
|
|
=* state -
|
|
|
|
::
|
2020-01-21 23:36:03 +03:00
|
|
|
%+ verb |
|
2020-02-26 00:23:07 +03:00
|
|
|
%- agent:dbug
|
2019-11-23 02:02:31 +03:00
|
|
|
^- agent:gall
|
|
|
|
=<
|
2020-04-03 00:43:03 +03:00
|
|
|
~% %chat-view-agent-core ..poke-handle-http-request ~
|
2019-11-27 04:43:03 +03:00
|
|
|
|_ bol=bowl:gall
|
2019-11-23 02:02:31 +03:00
|
|
|
+* this .
|
|
|
|
chat-core +>
|
2019-11-27 04:43:03 +03:00
|
|
|
cc ~(. chat-core bol)
|
|
|
|
def ~(. (default-agent this %|) bol)
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
++ on-init
|
|
|
|
^- (quip card _this)
|
|
|
|
:_ this
|
2020-06-10 05:52:29 +03:00
|
|
|
:~ :* %pass /srv %agent [our.bol %file-server]
|
2020-05-29 19:57:51 +03:00
|
|
|
%poke %file-server-action
|
2020-08-26 22:22:54 +03:00
|
|
|
!>([%serve-dir /'~chat' /app/landscape %.n %.y])
|
2020-05-29 19:57:51 +03:00
|
|
|
==
|
2020-06-10 05:52:29 +03:00
|
|
|
[%pass / %arvo %e %connect [~ /'chat-view'] %chat-view]
|
|
|
|
[%pass /updates %agent [our.bol %chat-store] %watch /updates]
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
2020-04-29 22:01:31 +03:00
|
|
|
::
|
2019-11-23 02:02:31 +03:00
|
|
|
++ on-poke
|
2020-04-03 00:43:03 +03:00
|
|
|
~/ %chat-view-poke
|
2019-11-23 02:02:31 +03:00
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
2019-11-27 04:43:03 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
2019-11-23 02:02:31 +03:00
|
|
|
?+ mark (on-poke:def mark vase)
|
|
|
|
%handle-http-request
|
|
|
|
=+ !<([eyre-id=@ta =inbound-request:eyre] vase)
|
|
|
|
:_ this
|
|
|
|
%+ give-simple-payload:app eyre-id
|
|
|
|
%+ require-authorization:app inbound-request
|
|
|
|
poke-handle-http-request:cc
|
|
|
|
::
|
|
|
|
%json
|
|
|
|
:_ this
|
2020-04-30 02:04:29 +03:00
|
|
|
(poke-chat-view-action:cc (action:dejs:view !<(json vase)))
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
%chat-view-action
|
|
|
|
:_ this
|
2020-04-25 06:51:28 +03:00
|
|
|
(poke-chat-view-action:cc !<(action:view vase))
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ on-watch
|
2020-04-03 00:43:03 +03:00
|
|
|
~/ %chat-view-watch
|
2019-11-23 02:02:31 +03:00
|
|
|
|= =path
|
|
|
|
^- (quip card _this)
|
2019-11-27 04:43:03 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
|
|
|
|^
|
2019-11-23 02:02:31 +03:00
|
|
|
?: ?=([%http-response *] path)
|
|
|
|
[~ this]
|
|
|
|
?: =(/primary path)
|
2020-03-26 02:48:35 +03:00
|
|
|
:: create inbox with 20 messages max per mailbox and send that along
|
2019-11-23 02:02:31 +03:00
|
|
|
:: then quit the subscription
|
|
|
|
:_ this
|
2020-06-01 21:34:32 +03:00
|
|
|
[%give %fact ~ %json !>((update:enjs:store [%initial truncated-inbox]))]~
|
2019-11-23 02:02:31 +03:00
|
|
|
(on-watch:def path)
|
2019-11-27 04:43:03 +03:00
|
|
|
::
|
2020-03-26 02:48:35 +03:00
|
|
|
++ message-limit 20
|
2020-03-20 22:47:15 +03:00
|
|
|
::
|
2020-05-22 21:21:10 +03:00
|
|
|
++ truncated-inbox
|
2020-06-01 21:34:32 +03:00
|
|
|
^- inbox:store
|
|
|
|
=/ =inbox:store
|
2020-06-03 08:48:57 +03:00
|
|
|
=/ our (scot %p our.bol)
|
|
|
|
=/ now (scot %da now.bol)
|
|
|
|
.^(inbox:store %gx /[our]/chat-store/[now]/all/noun)
|
2019-11-27 04:43:03 +03:00
|
|
|
%- ~(run by inbox)
|
2020-04-25 06:51:28 +03:00
|
|
|
|= =mailbox:store
|
|
|
|
^- mailbox:store
|
2020-03-31 23:19:44 +03:00
|
|
|
[config.mailbox (scag message-limit envelopes.mailbox)]
|
2019-11-27 04:43:03 +03:00
|
|
|
--
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
++ on-agent
|
2020-04-03 00:43:03 +03:00
|
|
|
~/ %chat-view-agent
|
2019-11-23 02:02:31 +03:00
|
|
|
|= [=wire =sign:agent:gall]
|
|
|
|
^- (quip card _this)
|
2020-05-29 04:53:14 +03:00
|
|
|
?+ -.sign (on-agent:def wire sign)
|
|
|
|
%poke-ack
|
2020-06-15 11:07:21 +03:00
|
|
|
?. ?=([%join-group @ @ @ @ @ ~] wire)
|
2020-05-29 04:53:14 +03:00
|
|
|
(on-agent:def wire sign)
|
2020-06-15 11:07:21 +03:00
|
|
|
?^ p.sign
|
2020-05-29 04:53:14 +03:00
|
|
|
(on-agent:def wire sign)
|
|
|
|
=/ =ship
|
|
|
|
(slav %p i.t.wire)
|
|
|
|
=/ ask-history=?
|
|
|
|
=('y' i.t.t.wire)
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
|
|
|
(de-path:resource t.t.t.wire)
|
2020-05-29 04:53:14 +03:00
|
|
|
:_ this
|
2020-06-08 10:53:16 +03:00
|
|
|
(joined-group:cc rid ship ask-history)
|
2020-05-29 04:53:14 +03:00
|
|
|
::
|
2019-11-23 02:02:31 +03:00
|
|
|
%kick
|
|
|
|
:_ this
|
|
|
|
[%pass / %agent [our.bol %chat-store] %watch /updates]~
|
|
|
|
::
|
|
|
|
%fact
|
|
|
|
?+ p.cage.sign (on-agent:def wire sign)
|
|
|
|
%chat-update
|
|
|
|
:_ this
|
2020-04-25 06:51:28 +03:00
|
|
|
(diff-chat-update:cc !<(update:store q.cage.sign))
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
2020-01-04 00:06:42 +03:00
|
|
|
++ on-arvo
|
2020-04-03 00:43:03 +03:00
|
|
|
~/ %chat-view-arvo
|
2019-11-23 02:02:31 +03:00
|
|
|
|= [=wire =sign-arvo]
|
|
|
|
^- (quip card _this)
|
2020-05-07 03:42:23 +03:00
|
|
|
?: ?=(%bound +<.sign-arvo) [~ this]
|
|
|
|
(on-arvo:def wire sign-arvo)
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
2020-05-29 19:57:51 +03:00
|
|
|
++ on-save !>(state)
|
2020-09-01 04:54:39 +03:00
|
|
|
++ on-load
|
2020-05-29 19:57:51 +03:00
|
|
|
|= old-vase=vase
|
2020-04-29 22:01:31 +03:00
|
|
|
^- (quip card _this)
|
2020-05-29 19:57:51 +03:00
|
|
|
=/ old ((soft state-0) q.old-vase)
|
|
|
|
?^ old [~ this]
|
|
|
|
:_ this(state [%0 ~])
|
2020-04-29 22:01:31 +03:00
|
|
|
:~ [%pass / %arvo %e %disconnect [~ /'~chat']]
|
|
|
|
[%pass / %arvo %e %connect [~ /'chat-view'] %chat-view]
|
2020-05-28 21:47:34 +03:00
|
|
|
:* %pass /srv %agent [our.bol %file-server]
|
|
|
|
%poke %file-server-action
|
2020-08-26 22:22:54 +03:00
|
|
|
!>([%serve-dir /'~chat' /app/landscape %.n %.y])
|
2020-05-28 21:47:34 +03:00
|
|
|
==
|
2020-04-29 22:01:31 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-23 02:02:31 +03:00
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-peek on-peek:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|
|
|
|
::
|
|
|
|
::
|
2020-04-03 00:43:03 +03:00
|
|
|
~% %chat-view-library ..card ~
|
2019-11-23 02:02:31 +03:00
|
|
|
|_ bol=bowl:gall
|
2020-05-27 05:22:51 +03:00
|
|
|
++ grp ~(. grpl bol)
|
2020-06-15 11:07:21 +03:00
|
|
|
++ md ~(. mdl bol)
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
++ poke-handle-http-request
|
|
|
|
|= =inbound-request:eyre
|
|
|
|
^- simple-payload:http
|
|
|
|
=+ url=(parse-request-line url.request.inbound-request)
|
|
|
|
?+ site.url not-found:gen
|
2020-04-29 22:01:31 +03:00
|
|
|
[%'chat-view' %paginate @t @t *]
|
2019-11-23 02:02:31 +03:00
|
|
|
=/ start (need (rush i.t.t.site.url dem))
|
|
|
|
=/ end (need (rush i.t.t.t.site.url dem))
|
|
|
|
=/ pax t.t.t.t.site.url
|
|
|
|
=/ envelopes (envelope-scry [(scot %ud start) (scot %ud end) pax])
|
|
|
|
%- json-response:gen
|
2020-04-30 02:04:29 +03:00
|
|
|
%- update:enjs:store
|
2019-11-23 02:02:31 +03:00
|
|
|
[%messages pax start end envelopes]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ poke-json
|
|
|
|
|= jon=json
|
|
|
|
^- (list card)
|
2020-02-05 02:16:20 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
2020-04-30 02:04:29 +03:00
|
|
|
(poke-chat-view-action (action:dejs:view jon))
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
++ poke-chat-view-action
|
2020-04-25 06:51:28 +03:00
|
|
|
|= act=action:view
|
2019-11-23 02:02:31 +03:00
|
|
|
^- (list card)
|
2020-02-04 22:12:51 +03:00
|
|
|
|^
|
2020-02-05 02:16:20 +03:00
|
|
|
?> (team:title our.bol src.bol)
|
2019-11-23 02:02:31 +03:00
|
|
|
?- -.act
|
|
|
|
%create
|
2020-02-26 00:23:07 +03:00
|
|
|
?> ?=(^ app-path.act)
|
2020-09-01 04:54:39 +03:00
|
|
|
?> ?| =(+:group-path.act app-path.act)
|
|
|
|
=(~(tap in members.act) ~)
|
2020-07-08 04:13:39 +03:00
|
|
|
==
|
2020-02-26 00:23:07 +03:00
|
|
|
?^ (chat-scry app-path.act)
|
2020-02-05 02:16:20 +03:00
|
|
|
~& %chat-already-exists
|
|
|
|
~
|
2019-11-23 02:02:31 +03:00
|
|
|
%- zing
|
2020-03-07 02:15:03 +03:00
|
|
|
:~ (create-chat app-path.act allow-history.act)
|
2020-03-02 03:38:46 +03:00
|
|
|
%- create-group
|
2020-03-02 02:35:44 +03:00
|
|
|
:* group-path.act
|
2020-03-02 04:08:16 +03:00
|
|
|
app-path.act
|
2020-05-25 08:52:54 +03:00
|
|
|
policy.act
|
2020-03-02 02:35:44 +03:00
|
|
|
members.act
|
|
|
|
title.act
|
|
|
|
description.act
|
2020-06-15 11:07:21 +03:00
|
|
|
managed.act
|
2020-03-02 02:35:44 +03:00
|
|
|
==
|
2020-02-28 22:52:17 +03:00
|
|
|
(create-metadata title.act description.act group-path.act app-path.act)
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
%delete
|
2020-02-26 00:23:07 +03:00
|
|
|
?> ?=(^ app-path.act)
|
2020-03-19 03:26:44 +03:00
|
|
|
:: always just delete the chat from chat-store
|
|
|
|
::
|
|
|
|
:+ (chat-hook-poke [%remove app-path.act])
|
|
|
|
(chat-poke [%delete app-path.act])
|
|
|
|
:: if we still have metadata for the chat, remove it, and the associated
|
2020-06-15 11:07:21 +03:00
|
|
|
:: group if it's unmanaged.
|
2020-03-19 03:26:44 +03:00
|
|
|
::
|
|
|
|
:: we aren't guaranteed to have metadata: the chat might have been
|
|
|
|
:: deleted by the host, which pushes metadata deletion down to us.
|
|
|
|
::
|
2020-06-15 11:07:21 +03:00
|
|
|
=/ maybe-group-path
|
|
|
|
(maybe-group-from-chat app-path.act)
|
|
|
|
?~ maybe-group-path
|
|
|
|
~
|
|
|
|
=* group-path u.maybe-group-path
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
2020-06-15 11:07:21 +03:00
|
|
|
(de-path:resource group-path)
|
|
|
|
=/ maybe-group
|
|
|
|
(scry-group:grp rid)
|
|
|
|
=/ hidden
|
|
|
|
?~ maybe-group
|
|
|
|
%.n
|
|
|
|
hidden.u.maybe-group
|
2020-02-07 02:55:10 +03:00
|
|
|
%- zing
|
2020-06-15 11:07:21 +03:00
|
|
|
:~ ?. (is-creator group-path %chat app-path.act)
|
|
|
|
~
|
|
|
|
[(metadata-poke [%remove group-path [%chat app-path.act]])]~
|
2020-03-03 23:36:23 +03:00
|
|
|
::
|
2020-06-15 11:07:21 +03:00
|
|
|
?. hidden
|
|
|
|
~
|
2020-06-08 10:53:16 +03:00
|
|
|
:~ (group-proxy-poke %remove-members rid (sy our.bol ~))
|
|
|
|
(group-poke [%remove-group rid ~])
|
2020-06-15 11:07:21 +03:00
|
|
|
(metadata-hook-poke [%remove group-path])
|
|
|
|
(metadata-store-poke [%remove group-path [%chat app-path.act]])
|
2020-02-07 02:55:10 +03:00
|
|
|
==
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
2020-06-15 11:07:21 +03:00
|
|
|
::
|
|
|
|
%invite
|
|
|
|
=/ =group-path
|
|
|
|
(need (maybe-group-from-chat app-path.act))
|
|
|
|
=/ rid=resource
|
|
|
|
(de-path:resource group-path)
|
|
|
|
=/ =group
|
|
|
|
(need (scry-group:grp rid))
|
|
|
|
?> ?=(%invite -.policy.group)
|
|
|
|
:- (group-poke %change-policy rid %invite %add-invites ships.act)
|
|
|
|
%+ turn
|
|
|
|
~(tap in ships.act)
|
|
|
|
|= =ship
|
|
|
|
(send-invite group-path app-path.act ship)
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
%join
|
2020-02-26 00:23:07 +03:00
|
|
|
=/ group-path
|
2020-05-29 04:53:14 +03:00
|
|
|
(maybe-group-from-chat app-path.act)
|
2020-06-24 03:28:57 +03:00
|
|
|
=/ group
|
|
|
|
?~ group-path
|
|
|
|
~
|
|
|
|
(scry-group-path:grp u.group-path)
|
|
|
|
?: &(?=(^ group) =(hidden.u.group %.n))
|
2020-05-29 04:53:14 +03:00
|
|
|
~[(chat-hook-poke %add-synced ship.act app-path.act ask-history.act)]
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
2020-06-15 11:07:21 +03:00
|
|
|
(de-path:resource ship+app-path.act)
|
2020-09-02 04:44:10 +03:00
|
|
|
?: =(our.bol entity.rid) ~
|
2020-05-29 04:53:14 +03:00
|
|
|
=/ =cage
|
2020-06-15 11:07:21 +03:00
|
|
|
:- %group-update
|
2020-05-29 04:53:14 +03:00
|
|
|
!> ^- action:group-store
|
2020-06-08 10:53:16 +03:00
|
|
|
[%add-members rid (sy our.bol ~)]
|
2020-05-29 04:53:14 +03:00
|
|
|
:: we need this info in the wire to continue the flow after the
|
|
|
|
:: poke ack
|
|
|
|
=/ =wire
|
|
|
|
:- %join-group
|
2020-06-15 11:07:21 +03:00
|
|
|
[(scot %p ship.act) ?:(ask-history.act %y %n) ship+app-path.act]
|
|
|
|
[%pass wire %agent [entity.rid %group-push-hook] %poke cage]~
|
2020-03-13 20:13:44 +03:00
|
|
|
::
|
|
|
|
%groupify
|
2020-05-27 05:22:51 +03:00
|
|
|
=* app-path app-path.act
|
2020-06-15 11:07:21 +03:00
|
|
|
=/ group-path
|
|
|
|
(snag 0 (groups-from-resource:md %chat app-path))
|
2020-05-27 05:22:51 +03:00
|
|
|
=/ scry-pax=path
|
2020-06-15 11:07:21 +03:00
|
|
|
/metadata/[(scot %t (spat group-path))]/chat/[(scot %t (spat app-path))]
|
2020-05-27 05:22:51 +03:00
|
|
|
=/ =metadata
|
|
|
|
(need (scry-for (unit metadata) %metadata-store scry-pax))
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ old-rid=resource
|
2020-06-15 11:07:21 +03:00
|
|
|
(de-path:resource group-path)
|
2020-06-08 10:53:16 +03:00
|
|
|
?< (is-managed:grp old-rid)
|
2020-05-27 05:22:51 +03:00
|
|
|
?~ existing.act
|
|
|
|
:: just create contacts object for group
|
2020-06-08 10:53:16 +03:00
|
|
|
~[(contact-view-poke %groupify old-rid title.metadata description.metadata)]
|
2020-05-27 05:22:51 +03:00
|
|
|
:: change associations
|
|
|
|
=* group-path group-path.u.existing.act
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
|
|
|
(de-path:resource group-path)
|
2020-05-27 05:22:51 +03:00
|
|
|
=/ old-group=group
|
2020-06-08 10:53:16 +03:00
|
|
|
(need (scry-group:grp old-rid))
|
2020-05-27 05:22:51 +03:00
|
|
|
=/ =group
|
2020-06-08 10:53:16 +03:00
|
|
|
(need (scry-group:grp rid))
|
2020-05-27 05:22:51 +03:00
|
|
|
=/ ships=(set ship)
|
|
|
|
(~(dif in members.old-group) members.group)
|
2020-06-15 11:07:21 +03:00
|
|
|
:* (metadata-store-poke %remove ship+app-path %chat app-path)
|
2020-05-27 05:22:51 +03:00
|
|
|
(metadata-store-poke %add group-path [%chat app-path] metadata)
|
2020-06-08 10:53:16 +03:00
|
|
|
(group-poke %remove-group old-rid ~)
|
2020-05-27 05:22:51 +03:00
|
|
|
?. inclusive.u.existing.act
|
|
|
|
~
|
2020-06-08 10:53:16 +03:00
|
|
|
:- (group-poke %add-members rid ships)
|
2020-05-27 05:22:51 +03:00
|
|
|
%+ turn
|
|
|
|
~(tap in ships)
|
|
|
|
|= =ship
|
|
|
|
(send-invite group-path app-path ship)
|
|
|
|
==
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
2020-02-04 22:12:51 +03:00
|
|
|
::
|
|
|
|
++ create-chat
|
2020-03-07 02:15:03 +03:00
|
|
|
|= [=path history=?]
|
2020-02-04 22:12:51 +03:00
|
|
|
^- (list card)
|
2020-02-26 00:23:07 +03:00
|
|
|
:~ (chat-poke [%create path])
|
2020-03-07 02:15:03 +03:00
|
|
|
(chat-hook-poke [%add-owned path history])
|
2020-02-04 22:12:51 +03:00
|
|
|
==
|
|
|
|
::
|
2020-03-02 03:38:46 +03:00
|
|
|
++ create-group
|
2020-06-15 11:07:21 +03:00
|
|
|
|= [=path app-path=path =policy ships=(set ship) title=@t desc=@t managed=?]
|
2020-02-05 02:16:20 +03:00
|
|
|
^- (list card)
|
2020-06-15 11:07:21 +03:00
|
|
|
?^ (scry-group-path:grp path) ~
|
2020-06-08 10:53:16 +03:00
|
|
|
=/ rid=resource
|
|
|
|
(de-path:resource path)
|
|
|
|
?> =(our.bol entity.rid)
|
2020-05-25 08:52:54 +03:00
|
|
|
:: do not create a contacts object if this is unmanaged
|
2020-02-05 02:16:20 +03:00
|
|
|
::
|
2020-05-25 08:52:54 +03:00
|
|
|
:-
|
2020-06-15 11:07:21 +03:00
|
|
|
?. managed
|
2020-06-08 10:53:16 +03:00
|
|
|
(group-poke %add-group rid policy %.y)
|
|
|
|
(contact-view-poke %create name.rid policy title desc)
|
2020-05-25 08:52:54 +03:00
|
|
|
%+ murn ~(tap in ships)
|
2020-03-10 02:41:31 +03:00
|
|
|
|= =ship
|
2020-05-25 08:52:54 +03:00
|
|
|
^- (unit card)
|
2020-03-10 02:41:31 +03:00
|
|
|
?: =(ship our.bol) ~
|
2020-05-25 08:52:54 +03:00
|
|
|
`(send-invite path app-path ship)
|
2020-02-05 02:16:20 +03:00
|
|
|
::
|
2020-02-26 00:23:07 +03:00
|
|
|
++ create-metadata
|
2020-02-28 22:52:17 +03:00
|
|
|
|= [title=@t description=@t group-path=path app-path=path]
|
2020-02-26 00:23:07 +03:00
|
|
|
^- (list card)
|
|
|
|
=/ =metadata
|
|
|
|
%* . *metadata
|
2020-02-28 22:52:17 +03:00
|
|
|
title title
|
|
|
|
description description
|
2020-02-26 00:23:07 +03:00
|
|
|
date-created now.bol
|
|
|
|
creator
|
2020-06-15 11:07:21 +03:00
|
|
|
(slav %p (snag 0 app-path))
|
2020-02-26 00:23:07 +03:00
|
|
|
==
|
2020-03-03 03:50:20 +03:00
|
|
|
:~ (metadata-poke [%add group-path [%chat app-path] metadata])
|
2020-02-26 00:23:07 +03:00
|
|
|
(metadata-hook-poke [%add-owned group-path])
|
|
|
|
==
|
|
|
|
::
|
2020-02-05 02:16:20 +03:00
|
|
|
++ contact-view-poke
|
2020-05-27 05:22:51 +03:00
|
|
|
|= act=contact-view-action:contact-view
|
2020-02-05 02:16:20 +03:00
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %contact-view] %poke %contact-view-action !>(act)]
|
|
|
|
::
|
2020-03-03 03:50:20 +03:00
|
|
|
++ metadata-poke
|
2020-02-26 00:23:07 +03:00
|
|
|
|= act=metadata-action
|
|
|
|
^- card
|
2020-03-03 03:50:20 +03:00
|
|
|
[%pass / %agent [our.bol %metadata-hook] %poke %metadata-action !>(act)]
|
2020-02-26 00:23:07 +03:00
|
|
|
::
|
2020-03-03 23:36:23 +03:00
|
|
|
++ metadata-store-poke
|
|
|
|
|= act=metadata-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %metadata-store] %poke %metadata-action !>(act)]
|
|
|
|
::
|
2020-03-02 04:08:16 +03:00
|
|
|
++ send-invite
|
2020-05-25 08:52:54 +03:00
|
|
|
|= [group-path=path app-path=path =ship]
|
2020-02-05 02:16:20 +03:00
|
|
|
^- card
|
2020-05-25 08:52:54 +03:00
|
|
|
=/ managed=?
|
2020-06-15 11:07:21 +03:00
|
|
|
!=(ship+app-path group-path)
|
2020-10-22 20:17:15 +03:00
|
|
|
=/ =invite:inv
|
2020-05-25 08:52:54 +03:00
|
|
|
:* our.bol
|
2020-05-27 05:22:51 +03:00
|
|
|
?:(managed %contact-hook %chat-hook)
|
2020-10-22 02:11:31 +03:00
|
|
|
(de-path:resource ?:(managed group-path ship+app-path))
|
2020-05-25 08:52:54 +03:00
|
|
|
ship ''
|
2020-02-05 02:16:20 +03:00
|
|
|
==
|
2020-10-22 20:17:15 +03:00
|
|
|
=/ act=action:inv
|
2020-10-21 01:18:30 +03:00
|
|
|
[%invite ?:(managed %contacts %chat) (shaf %msg-uid eny.bol) invite]
|
2020-02-05 02:16:20 +03:00
|
|
|
[%pass / %agent [our.bol %invite-hook] %poke %invite-action !>(act)]
|
|
|
|
::
|
|
|
|
++ chat-scry
|
|
|
|
|= pax=path
|
2020-04-25 06:51:28 +03:00
|
|
|
^- (unit mailbox:store)
|
2020-05-19 23:53:55 +03:00
|
|
|
=. pax
|
|
|
|
;: weld
|
2020-05-20 10:28:14 +03:00
|
|
|
/(scot %p our.bol)/chat-store/(scot %da now.bol)/mailbox
|
2020-05-19 23:53:55 +03:00
|
|
|
pax
|
|
|
|
/noun
|
|
|
|
==
|
2020-04-25 06:51:28 +03:00
|
|
|
.^((unit mailbox:store) %gx pax)
|
2020-02-26 00:23:07 +03:00
|
|
|
::
|
2020-03-19 03:26:44 +03:00
|
|
|
++ maybe-group-from-chat
|
2020-02-26 00:23:07 +03:00
|
|
|
|= app-path=path
|
2020-03-19 03:26:44 +03:00
|
|
|
^- (unit path)
|
2020-02-26 00:23:07 +03:00
|
|
|
?. .^(? %gu (scot %p our.bol) %metadata-store (scot %da now.bol) ~)
|
|
|
|
?: ?=([@ ^] app-path)
|
|
|
|
~& [%assuming-ported-legacy-chat app-path]
|
2020-03-19 03:26:44 +03:00
|
|
|
`[%'~' app-path]
|
2020-02-26 00:23:07 +03:00
|
|
|
~& [%weird-chat app-path]
|
|
|
|
!!
|
|
|
|
=/ resource-indices
|
2020-06-08 10:53:16 +03:00
|
|
|
.^ (jug md-resource group-path)
|
2020-02-26 00:23:07 +03:00
|
|
|
%gy
|
|
|
|
(scot %p our.bol)
|
|
|
|
%metadata-store
|
|
|
|
(scot %da now.bol)
|
|
|
|
/resource-indices
|
|
|
|
==
|
2020-03-19 03:26:44 +03:00
|
|
|
=/ groups=(set path)
|
|
|
|
%+ fall
|
|
|
|
(~(get by resource-indices) [%chat app-path])
|
|
|
|
*(set path)
|
|
|
|
?~ groups ~
|
|
|
|
`n.groups
|
|
|
|
::
|
|
|
|
++ group-from-chat
|
|
|
|
(cork maybe-group-from-chat need)
|
2020-02-26 00:23:07 +03:00
|
|
|
::
|
|
|
|
++ is-managed
|
|
|
|
|= =path
|
|
|
|
^- ?
|
|
|
|
?> ?=(^ path)
|
2020-02-27 01:21:20 +03:00
|
|
|
!=(i.path '~')
|
2020-03-03 23:36:23 +03:00
|
|
|
::
|
|
|
|
++ is-creator
|
|
|
|
|= [group-path=path app-name=@ta app-path=path]
|
|
|
|
^- ?
|
2020-03-04 05:04:00 +03:00
|
|
|
=/ meta=(unit metadata)
|
|
|
|
.^ (unit metadata)
|
2020-03-03 23:36:23 +03:00
|
|
|
%gx
|
|
|
|
(scot %p our.bol)
|
|
|
|
%metadata-store
|
|
|
|
(scot %da now.bol)
|
|
|
|
%metadata
|
|
|
|
(scot %t (spat group-path))
|
|
|
|
app-name
|
|
|
|
(scot %t (spat app-path))
|
|
|
|
/noun
|
|
|
|
==
|
2020-03-04 05:04:00 +03:00
|
|
|
?~ meta !!
|
|
|
|
=(our.bol creator.u.meta)
|
2020-02-04 22:12:51 +03:00
|
|
|
--
|
2020-05-29 04:53:14 +03:00
|
|
|
:: +joined-group: Successfully joined unmanaged group, continue flow
|
|
|
|
::
|
|
|
|
++ joined-group
|
2020-06-08 10:53:16 +03:00
|
|
|
|= [rid=resource =ship ask-history=?]
|
2020-05-29 04:53:14 +03:00
|
|
|
^- (list card)
|
|
|
|
=/ =path
|
2020-06-08 10:53:16 +03:00
|
|
|
(en-path:resource rid)
|
2020-06-15 11:07:21 +03:00
|
|
|
?> ?=(^ path)
|
|
|
|
:~ (group-pull-hook-poke %add ship rid)
|
|
|
|
(chat-hook-poke %add-synced ship t.path ask-history)
|
2020-05-29 04:53:14 +03:00
|
|
|
(metadata-hook-poke %add-synced ship path)
|
|
|
|
==
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
++ diff-chat-update
|
2020-04-25 06:51:28 +03:00
|
|
|
|= upd=update:store
|
2019-11-23 02:02:31 +03:00
|
|
|
^- (list card)
|
2020-06-01 21:34:32 +03:00
|
|
|
[%give %fact ~[/primary] %json !>((update:enjs:store upd))]~
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
|
|
|
:: +utilities
|
|
|
|
::
|
|
|
|
++ chat-poke
|
2020-04-25 06:51:28 +03:00
|
|
|
|= act=action:store
|
2019-11-23 02:02:31 +03:00
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %chat-store] %poke %chat-action !>(act)]
|
|
|
|
::
|
|
|
|
++ group-poke
|
2020-06-15 11:07:21 +03:00
|
|
|
|= upd=update:group-store
|
2019-11-23 02:02:31 +03:00
|
|
|
^- card
|
2020-06-15 11:07:21 +03:00
|
|
|
[%pass / %agent [our.bol %group-store] %poke %group-update !>(upd)]
|
|
|
|
++ group-pull-hook-poke
|
|
|
|
|= act=action:pull-hook
|
2020-05-25 08:52:54 +03:00
|
|
|
^- card
|
2020-06-15 11:07:21 +03:00
|
|
|
[%pass / %agent [our.bol %group-pull-hook] %poke %pull-hook-action !>(act)]
|
2020-05-25 08:52:54 +03:00
|
|
|
::
|
|
|
|
++ group-proxy-poke
|
|
|
|
|= act=action:group-store
|
|
|
|
^- card
|
2020-06-15 11:07:21 +03:00
|
|
|
[%pass / %agent [entity.resource.act %group-push-hook] %poke %group-update !>(act)]
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
2020-02-28 01:54:03 +03:00
|
|
|
++ permission-poke
|
|
|
|
|= act=permission-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %permission-store] %poke %permission-action !>(act)]
|
|
|
|
::
|
2019-11-23 02:02:31 +03:00
|
|
|
++ chat-hook-poke
|
2020-04-25 06:51:28 +03:00
|
|
|
|= act=action:hook
|
2019-11-23 02:02:31 +03:00
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %chat-hook] %poke %chat-hook-action !>(act)]
|
|
|
|
::
|
|
|
|
++ permission-hook-poke
|
|
|
|
|= act=permission-hook-action
|
|
|
|
^- card
|
|
|
|
:* %pass / %agent [our.bol %permission-hook]
|
|
|
|
%poke %permission-hook-action !>(act)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ perm-group-hook-poke
|
|
|
|
|= act=permission-group-hook-action
|
|
|
|
^- card
|
|
|
|
:* %pass / %agent [our.bol %permission-group-hook]
|
|
|
|
%poke %permission-group-hook-action !>(act)
|
|
|
|
==
|
|
|
|
::
|
2020-05-29 04:53:14 +03:00
|
|
|
++ metadata-hook-poke
|
|
|
|
|= act=metadata-hook-action
|
|
|
|
^- card
|
|
|
|
:* %pass / %agent
|
|
|
|
[our.bol %metadata-hook]
|
|
|
|
%poke %metadata-hook-action
|
|
|
|
!>(act)
|
|
|
|
==
|
|
|
|
::
|
2019-11-23 02:02:31 +03:00
|
|
|
++ envelope-scry
|
|
|
|
|= pax=path
|
2020-04-25 06:51:28 +03:00
|
|
|
^- (list envelope:store)
|
|
|
|
(scry-for (list envelope:store) %chat-store [%envelopes pax])
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
2020-06-15 11:07:21 +03:00
|
|
|
|
2020-01-11 20:44:35 +03:00
|
|
|
::
|
2020-03-13 20:12:57 +03:00
|
|
|
++ scry-for
|
|
|
|
|* [=mold app=term =path]
|
|
|
|
.^ mold
|
|
|
|
%gx
|
|
|
|
(scot %p our.bol)
|
|
|
|
app
|
|
|
|
(scot %da now.bol)
|
|
|
|
(snoc `^path`path %noun)
|
|
|
|
==
|
2019-11-23 02:02:31 +03:00
|
|
|
--
|