mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-10 10:05:09 +03:00
hark-store, hark-chat-hook: support mentions in chat
This commit is contained in:
parent
62409ca94d
commit
fa3fe2b17d
@ -13,6 +13,7 @@
|
||||
+$ state-0
|
||||
$: %0
|
||||
watching=(set path)
|
||||
mentions=_&
|
||||
==
|
||||
::
|
||||
--
|
||||
@ -75,6 +76,7 @@
|
||||
?- -.action
|
||||
%listen (listen +.action)
|
||||
%ignore (ignore +.action)
|
||||
%set-mentions (set-mentions +.action)
|
||||
==
|
||||
++ listen
|
||||
|= chat=path
|
||||
@ -87,6 +89,12 @@
|
||||
^- (quip card _state)
|
||||
:- (give:ha ~[/updates] [%ignore chat])
|
||||
state(watching (~(del in watching) chat))
|
||||
::
|
||||
++ set-mentions
|
||||
|= ment=?
|
||||
^- (quip card _state)
|
||||
:- (give:ha ~[/updates] [%set-mentions ment])
|
||||
state(mentions ment)
|
||||
--
|
||||
--
|
||||
::
|
||||
@ -121,16 +129,29 @@
|
||||
%- zing
|
||||
(turn envelopes.update (cury process-envelope path.update))
|
||||
==
|
||||
++ is-mention
|
||||
|= [=path =envelope:chat-store]
|
||||
?. ?=(%text -.letter.envelope) %.n
|
||||
?& mentions
|
||||
?= ^
|
||||
(find (scow %p our.bowl) (trip text.letter.envelope))
|
||||
==
|
||||
::
|
||||
++ is-notification
|
||||
|= [=path =envelope:chat-store]
|
||||
?& (~(has in watching) path)
|
||||
!=(author.envelope our.bowl)
|
||||
==
|
||||
::
|
||||
++ process-envelope
|
||||
|= [=path =envelope:chat-store]
|
||||
^- (list card)
|
||||
?. ?& (~(has in watching) path)
|
||||
!=(author.envelope our.bowl)
|
||||
==
|
||||
=/ mention=?
|
||||
(is-mention path envelope)
|
||||
?. ?|(mention (is-notification path envelope))
|
||||
~
|
||||
=/ =index:store
|
||||
[%chat path]
|
||||
[%chat path mention]
|
||||
=/ =contents:store
|
||||
[%chat ~[envelope]]
|
||||
~[(poke-store %add index when.envelope %.n contents)]
|
||||
|
@ -12,6 +12,7 @@
|
||||
%- of
|
||||
:~ listen+pa
|
||||
ignore+pa
|
||||
set-mentions+bo
|
||||
==
|
||||
--
|
||||
::
|
||||
@ -24,6 +25,7 @@
|
||||
%+ frond -.upd
|
||||
?- -.upd
|
||||
?(%listen %ignore) (path chat.upd)
|
||||
%set-mentions b+mentions.upd
|
||||
%initial a+(turn ~(tap in watching.upd) path)
|
||||
==
|
||||
--
|
||||
|
@ -11,7 +11,13 @@
|
||||
%- of
|
||||
:~ graph+graph-index
|
||||
group+group-index
|
||||
chat+pa
|
||||
chat+chat-index
|
||||
==
|
||||
::
|
||||
++ chat-index
|
||||
%- ot
|
||||
:~ chat+pa
|
||||
mention+bo
|
||||
==
|
||||
::
|
||||
++ group-index
|
||||
@ -107,8 +113,16 @@
|
||||
?- -.index
|
||||
%graph (graph-index +.index)
|
||||
%group (group-index +.index)
|
||||
%chat (path chat.index)
|
||||
%chat (chat-index +.index)
|
||||
==
|
||||
::
|
||||
++ chat-index
|
||||
|= [chat=^path mention=?]
|
||||
^- json
|
||||
%- pairs
|
||||
:~ chat+(path chat)
|
||||
mention+b+mention
|
||||
==
|
||||
::
|
||||
++ graph-index
|
||||
|= [group=resource graph=resource module=@t description=@t]
|
||||
|
@ -3,6 +3,7 @@
|
||||
::
|
||||
+$ action
|
||||
$% [?(%listen %ignore) chat=path]
|
||||
[%set-mentions mentions=?]
|
||||
==
|
||||
::
|
||||
+$ update
|
||||
|
@ -5,7 +5,7 @@
|
||||
+$ index
|
||||
$% [%graph group=resource graph=resource module=@t description=@t]
|
||||
[%group group=resource description=@t]
|
||||
[%chat chat=path]
|
||||
[%chat chat=path mention=?]
|
||||
==
|
||||
::
|
||||
+$ group-contents
|
||||
|
Loading…
Reference in New Issue
Block a user