mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 11:40:11 +03:00
chat-hook: consistently pull backlog subs
We weren't accounting for backlog subscriptions with non-zero message indexes in their wires. Now, we look through all of our outgoing subscriptions to identify relevant backlog subscriptions, and leave all of those. The more proper fix here is to not include message indexes in the wire in the first place, since we don't ever reuse that anywhere. But that's a more invasive change, so we just leave a TODO for it instead.
This commit is contained in:
parent
084ce356a8
commit
0f05ed3149
@ -358,6 +358,8 @@
|
||||
%+ weld path.act
|
||||
?~(mailbox /0 /(scot %ud (lent envelopes.u.mailbox)))
|
||||
:_ state
|
||||
::TODO we shouldn't include the trailing /0 or similar in the wire,
|
||||
:: we never use it anywhere, and it complicates other logic. see #2746
|
||||
:~ [%pass chat-history %agent [ship.act %chat-hook] %watch chat-history]
|
||||
[%give %fact [/synced]~ %chat-hook-update !>([%initial synced])]
|
||||
==
|
||||
@ -376,11 +378,10 @@
|
||||
[~ state]
|
||||
=. synced (~(del by synced) path.act)
|
||||
:_ state
|
||||
%- zing
|
||||
:~ (pull-wire u.ship [%backlog (weld path.act /0)])
|
||||
:* [%give %kick ~[[%mailbox path.act]] ~]
|
||||
[%give %fact [/synced]~ %chat-hook-update !>([%initial synced])]
|
||||
(pull-wire u.ship [%mailbox path.act])
|
||||
[%give %kick ~[[%mailbox path.act]] ~]~
|
||||
[%give %fact [/synced]~ %chat-hook-update !>([%initial synced])]~
|
||||
(pull-backlog-subscriptions u.ship path.act)
|
||||
==
|
||||
==
|
||||
::
|
||||
@ -715,10 +716,23 @@
|
||||
(snoc `^path`path %noun)
|
||||
==
|
||||
::
|
||||
++ pull-backlog-subscriptions
|
||||
|= [target=ship chat=path]
|
||||
^- (list card)
|
||||
%+ murn ~(tap by wex.bol)
|
||||
|= [[=wire =ship =term] [acked=? =path]]
|
||||
^- (unit card)
|
||||
?. ?& =(ship target)
|
||||
?=([%backlog *] wire)
|
||||
=(`1 (find chat wire))
|
||||
==
|
||||
~
|
||||
`(pull-wire target wire)
|
||||
::
|
||||
++ pull-wire
|
||||
|= [=ship =wire]
|
||||
^- (list card)
|
||||
^- card
|
||||
?: =(ship our.bol)
|
||||
[%pass wire %agent [our.bol %chat-store] %leave ~]~
|
||||
[%pass wire %agent [ship %chat-hook] %leave ~]~
|
||||
[%pass wire %agent [our.bol %chat-store] %leave ~]
|
||||
[%pass wire %agent [ship %chat-hook] %leave ~]
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user