link-store: don't send update if not new
We were taking care not to re-add something to our data store if we
already had it in there, but were still sending out an update
regardless.
With this, we only send out an update if we weren't previously aware
of the content.
:: add link to group submissions
::
=/ =links (~(gut by by-group) path *links)
- =. submissions.links
+ =^ added submissions.links
+ ?: ?=(^ (find ~[submission] submissions.links))
+ [| submissions.links]
+ :- &
(submissions:merge submissions.links ~[submission])
=. by-group (~(put by by-group) path links)
:: add submission to global sites
:: send updates to subscribers
::
:_ state
+ ?. added ~
:_ ~
:+ %give %fact
:+ :~ /submissions
::
=/ urls (~(gut by discussions) path *(map ^url discussion))
=/ =discussion (~(gut by urls) url *discussion)
- =. comments.discussion
+ =^ added comments.discussion
+ ?: ?=(^ (find ~[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
::
:_ state
+ ?. added ~
:_ ~
:+ %give %fact
:+ :~ /discussions
