chat-view and hook: style pass and backlog truncation

This commit is contained in:
Logan Allen 2020-03-31 16:19:44 -04:00
parent ecc8942eaf
commit 8cdfb559f6
2 changed files with 4 additions and 13 deletions

View File

@ -400,16 +400,14 @@
?> ?=(^ pax)
=/ last (dec (lent pax))
=/ backlog-start=(unit @ud)
%+ rush
(snag last `(list @ta)`pax)
dem:ag
(rush (snag last `(list @ta)`pax) dem:ag)
=/ pas `path`(oust [last 1] `(list @ta)`pax)
?> ?=([* ^] pas)
?> (~(has by synced) pas)
:: check if read is permitted
?> (is-permitted src.bol pas)
=/ =mailbox (need (chat-scry pas))
=* envs envelopes.mailbox
=/ backlog-limit 10.000
=/ envs (scag backlog-limit envelopes:(need (chat-scry pas)))
%- zing
:~ [%give %fact ~ %chat-update !>([%create pas])]~
?. ?&(?=(^ backlog-start) (~(has by allow-history) pas)) ~

View File

@ -121,14 +121,7 @@
%- ~(run by inbox)
|= =mailbox
^- ^mailbox
[config.mailbox (truncate-envelopes envelopes.mailbox)]
::
++ truncate-envelopes
|= envelopes=(list envelope)
^- (list envelope)
?: (lth (lent envelopes) message-limit)
envelopes
(scag message-limit envelopes)
[config.mailbox (scag message-limit envelopes.mailbox)]
--
::
++ on-agent