2019-11-23 02:02:31 +03:00
|
|
|
:: chat-view: sets up chat JS client, paginates data, and combines commands
|
|
|
|
:: into semantic actions for the UI
|
|
|
|
::
|
2020-04-22 12:27:36 +03:00
|
|
|
/- *permission-store
|
|
|
|
/- *permission-hook
|
|
|
|
/- *group-store
|
|
|
|
/- *invite-store
|
|
|
|
/- *metadata-store
|
|
|
|
/- *permission-group-hook
|
|
|
|
/- *chat-hook
|
|
|
|
/- *metadata-hook
|
2020-06-03 08:48:57 +03:00
|
|
|
/- *rw-security
|
2020-06-03 07:50:20 +03:00
|
|
|
/- hook=chat-hook
|
|
|
|
/+ *server, default-agent, verb, dbug
|
2020-06-03 08:48:57 +03:00
|
|
|
/+ store=chat-store
|
|
|
|
/+ view=chat-view
|
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
|
|
|
|
==
|
2019-11-23 02:02:31 +03:00
|
|
|
::
|
2020-05-29 19:57:51 +03:00
|
|
|
+$ state-0
|
|
|
|
$: %0
|
|
|
|
~
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
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
|
|
|
|
!>([%serve-dir /'~chat' /app/landscape %.n])
|
|
|
|
==
|
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-04-25 06:51:28 +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-07 03:42:23 +03:00
|
|
|
?+ -.sign (on-agent:def wire sign)
|
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-04-29 22:01:31 +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
|
|
|
|
!>([%serve-dir /'~chat' /app/landscape %.n])
|
|
|
|
==
|
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
|
|
|
|
::
|
|
|
|
++ 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-01-04 00:06:42 +03:00
|
|
|
%- json-to-octs
|
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-03-02 22:10:29 +03:00
|
|
|
?> |(=(group-path.act app-path.act) =(~(tap in members.act) ~))
|
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-03-02 02:35:44 +03:00
|
|
|
security.act
|
|
|
|
members.act
|
|
|
|
title.act
|
|
|
|
description.act
|
|
|
|
==
|
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
|
|
|
|
:: group if it's unmanaged
|
|
|
|
::
|
|
|
|
:: we aren't guaranteed to have metadata: the chat might have been
|
|
|
|
:: deleted by the host, which pushes metadata deletion down to us.
|
|
|
|
::
|
|
|
|
=/ group-path=(unit path)
|
|
|
|
(maybe-group-from-chat app-path.act)
|
|
|
|
?~ group-path ~
|
|
|
|
=* group u.group-path
|
2020-02-07 02:55:10 +03:00
|
|
|
%- zing
|
2020-03-19 03:26:44 +03:00
|
|
|
:~ ?. (is-creator group %chat app-path.act) ~
|
|
|
|
[(metadata-poke [%remove group [%chat app-path.act]])]~
|
2020-03-03 23:36:23 +03:00
|
|
|
::
|
2020-03-19 03:26:44 +03:00
|
|
|
?: (is-managed group) ~
|
|
|
|
:~ (group-poke [%unbundle group])
|
|
|
|
(metadata-hook-poke [%remove group])
|
|
|
|
(metadata-store-poke [%remove group [%chat app-path.act]])
|
2020-02-07 02:55:10 +03:00
|
|
|
==
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
%join
|
2020-02-26 00:23:07 +03:00
|
|
|
=/ group-path
|
|
|
|
?. (is-managed app-path.act) app-path.act
|
|
|
|
(group-from-chat app-path.act)
|
|
|
|
:~ (chat-hook-poke [%add-synced ship.act app-path.act ask-history.act])
|
|
|
|
(permission-hook-poke [%add-synced ship.act group-path])
|
|
|
|
(metadata-hook-poke [%add-synced ship.act group-path])
|
2019-11-23 02:02:31 +03:00
|
|
|
==
|
2020-03-13 20:13:44 +03:00
|
|
|
::
|
|
|
|
%groupify
|
|
|
|
?> ?=([%'~' ^] app-path.act)
|
2020-03-18 23:54:28 +03:00
|
|
|
:: retrieve old data
|
|
|
|
::
|
2020-04-25 06:51:28 +03:00
|
|
|
=/ data=(unit mailbox:store)
|
|
|
|
(scry-for (unit mailbox:store) %chat-store [%mailbox app-path.act])
|
2020-03-13 20:13:44 +03:00
|
|
|
?~ data
|
|
|
|
~& [%cannot-groupify-nonexistent app-path.act]
|
|
|
|
~
|
|
|
|
=/ permission=(unit permission)
|
|
|
|
(scry-for (unit permission) %permission-store [%permission app-path.act])
|
|
|
|
?: |(?=(~ permission) ?=(%black kind.u.permission))
|
|
|
|
~& [%cannot-groupify-blacklist app-path.act]
|
|
|
|
~
|
|
|
|
=/ =metadata
|
|
|
|
=- (fall - *metadata)
|
|
|
|
%^ scry-for (unit metadata)
|
|
|
|
%metadata-store
|
|
|
|
=/ encoded-path=@ta
|
|
|
|
(scot %t (spat app-path.act))
|
|
|
|
/metadata/[encoded-path]/chat/[encoded-path]
|
2020-03-18 23:54:28 +03:00
|
|
|
:: figure out new data
|
|
|
|
::
|
|
|
|
=/ chat-path=^path (slag 1 `path`app-path.act)
|
|
|
|
:: group-path: the group to associate with the chat
|
|
|
|
:: members: members of group, if it's new
|
|
|
|
:: new-members: new members of group, if it already exists
|
|
|
|
::
|
|
|
|
=/ [group-path=path members=(set ship) new-members=(set ship)]
|
|
|
|
?~ existing.act
|
|
|
|
[chat-path who.u.permission ~]
|
|
|
|
:+ group-path.u.existing.act
|
|
|
|
~
|
|
|
|
?. inclusive.u.existing.act ~
|
|
|
|
%- ~(dif in who.u.permission)
|
|
|
|
~| [%groupifying-with-nonexistent-group group-path.u.existing.act]
|
|
|
|
%- need
|
|
|
|
(group-scry group-path.u.existing.act)
|
|
|
|
:: make changes
|
|
|
|
::
|
|
|
|
;: weld
|
|
|
|
:: delete the old chat
|
|
|
|
::
|
|
|
|
(poke-chat-view-action %delete app-path.act)
|
|
|
|
::
|
|
|
|
:: create the new chat. if needed, creates the new group.
|
|
|
|
::
|
2020-03-13 20:13:44 +03:00
|
|
|
%- poke-chat-view-action
|
|
|
|
:* %create
|
|
|
|
title.metadata
|
|
|
|
description.metadata
|
2020-03-18 23:54:28 +03:00
|
|
|
chat-path
|
|
|
|
group-path
|
2020-03-13 20:13:44 +03:00
|
|
|
%village
|
|
|
|
members
|
|
|
|
&
|
|
|
|
==
|
2020-03-18 23:54:28 +03:00
|
|
|
::
|
|
|
|
:: if needed, add members to the existing group
|
|
|
|
::
|
|
|
|
?~ new-members ~
|
|
|
|
[(group-poke [%add new-members group-path])]~
|
|
|
|
::
|
|
|
|
:: import messages into the new chat
|
|
|
|
::
|
|
|
|
[(chat-poke %messages chat-path envelopes.u.data)]~
|
|
|
|
==
|
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-03-02 04:08:16 +03:00
|
|
|
|= [=path app-path=path sec=rw-security ships=(set ship) title=@t desc=@t]
|
2020-02-05 02:16:20 +03:00
|
|
|
^- (list card)
|
2020-05-20 04:48:06 +03:00
|
|
|
?^ (group-scry path)
|
|
|
|
:~ (create-security path %village)
|
|
|
|
(permission-hook-poke [%add-owned path path])
|
|
|
|
==
|
2020-02-06 22:28:58 +03:00
|
|
|
:: do not create a managed group if this is a sig path or a blacklist
|
2020-02-05 02:16:20 +03:00
|
|
|
::
|
2020-03-02 04:08:16 +03:00
|
|
|
?: =(sec %channel)
|
2020-03-02 03:38:46 +03:00
|
|
|
:~ (group-poke [%bundle path])
|
2020-03-02 04:08:16 +03:00
|
|
|
(create-security path sec)
|
2020-03-02 03:38:46 +03:00
|
|
|
(permission-hook-poke [%add-owned path path])
|
|
|
|
==
|
2020-02-28 03:14:07 +03:00
|
|
|
?: (is-managed path)
|
2020-03-02 02:35:44 +03:00
|
|
|
~[(contact-view-poke [%create path ships title desc])]
|
2020-03-10 02:41:31 +03:00
|
|
|
%+ welp
|
|
|
|
:~ (group-poke [%bundle path])
|
|
|
|
(group-poke [%add ships path])
|
|
|
|
(create-security path sec)
|
|
|
|
(permission-hook-poke [%add-owned path path])
|
|
|
|
==
|
|
|
|
%- zing
|
|
|
|
%+ turn ~(tap in ships)
|
|
|
|
|= =ship
|
|
|
|
?: =(ship our.bol) ~
|
|
|
|
[(send-invite app-path ship)]~
|
2020-03-02 03:38:46 +03:00
|
|
|
::
|
|
|
|
++ create-security
|
|
|
|
|= [pax=path sec=rw-security]
|
|
|
|
^- card
|
|
|
|
?+ sec !!
|
|
|
|
%channel
|
|
|
|
(perm-group-hook-poke [%associate pax [[pax %black] ~ ~]])
|
|
|
|
::
|
|
|
|
%village
|
|
|
|
(perm-group-hook-poke [%associate pax [[pax %white] ~ ~]])
|
2020-02-28 03:14:07 +03:00
|
|
|
==
|
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
|
|
|
|
%+ slav %p
|
|
|
|
?: (is-managed app-path) (snag 0 app-path)
|
|
|
|
(snag 1 app-path)
|
|
|
|
==
|
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-03-02 02:35:44 +03:00
|
|
|
|= act=[%create =path ships=(set ship) title=@t description=@t]
|
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-02-26 00:23:07 +03:00
|
|
|
++ metadata-hook-poke
|
|
|
|
|= act=metadata-hook-action
|
|
|
|
^- card
|
|
|
|
:* %pass / %agent
|
|
|
|
[our.bol %metadata-hook]
|
|
|
|
%poke %metadata-hook-action
|
|
|
|
!>(act)
|
|
|
|
==
|
|
|
|
::
|
2020-03-02 04:08:16 +03:00
|
|
|
++ send-invite
|
2020-02-05 02:16:20 +03:00
|
|
|
|= [=path =ship]
|
|
|
|
^- card
|
|
|
|
=/ =invite
|
|
|
|
:* our.bol %chat-hook
|
|
|
|
path ship ''
|
|
|
|
==
|
|
|
|
=/ act=invite-action [%invite /chat (shaf %msg-uid eny.bol) invite]
|
|
|
|
[%pass / %agent [our.bol %invite-hook] %poke %invite-action !>(act)]
|
|
|
|
::
|
|
|
|
++ chat-scry
|
|
|
|
|= pax=path
|
2020-06-03 08:48:57 +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
|
|
|
|
.^ (jug resource group-path)
|
|
|
|
%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
|
|
|
--
|
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
|
|
|
|
|= act=group-action
|
|
|
|
^- card
|
|
|
|
[%pass / %agent [our.bol %group-store] %poke %group-action !>(act)]
|
|
|
|
::
|
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)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ 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-01-11 20:44:35 +03:00
|
|
|
++ group-scry
|
|
|
|
|= pax=path
|
|
|
|
^- (unit group)
|
2020-03-13 20:12:57 +03:00
|
|
|
(scry-for (unit group) %group-store pax)
|
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
|
|
|
--
|