link-store: ensure latest-first ordering of state
We may %hear or %read content that was posted some time ago, so we need
to make sure we add it at the appropriate position (wrt timestamp)
rather than just sticking it at the head of the list.
:: add link to group submissions
::
=/ =links (~(gut by by-group) path *links)
- =. submissions.links [submission submissions.links]
+ =. submissions.links
+ (submissions:merge submissions.links ~[submission])
=. by-group (~(put by by-group) path links)
:: add submission to global sites
::
::
=/ urls (~(gut by discussions) path *(map ^url discussion))
=/ =discussion (~(gut by urls) url *discussion)
- =. comments.discussion [comment comments.discussion]
+ =. comments.discussion
+ (comments:merge comments.discussion ~[comment])
=. urls (~(put by urls) url discussion)
=. discussions (~(put by discussions) path urls)
:: send updates to subscribers
