Merge pull request #4016 from urbit/lf/read-index-fix

hark-store: fix caching of merged notifications
This commit is contained in:
matildepark 2020-11-25 00:25:27 -05:00 committed by GitHub
commit 3415435399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,11 +166,16 @@
?~ existing-notif
notification
(merge-notification:ha u.existing-notif notification)
=/ new-read=?
?~ existing-notif
%.y
read.u.existing-notif
=. read.new %.n
=/ new-timebox=timebox:store
(~(put by timebox) index new)
:- (give:ha [/updates]~ %added last-seen index new)
%_ state
+ ?~(existing-notif (upd-unreads:ha index last-seen %.n) +.state)
+ ?.(new-read +.state (upd-unreads:ha index last-seen %.n))
notifications (put:orm notifications last-seen new-timebox)
==
++ read-index