mirror of
https://github.com/urbit/shrub.git
synced 2024-11-24 04:58:08 +03:00
lift permissions from message-pub to groupchat
This commit is contained in:
parent
b54aea3bd7
commit
a259cd97ab
@ -23,7 +23,8 @@
|
||||
:: and subscribe to that publisher
|
||||
:: XX - maybe move ordering is unpredictable here
|
||||
?~ old
|
||||
:_ groupchat/!>([~ (snoc here.bowl %pub)])
|
||||
:_ :- %groupchat
|
||||
!>([(sy our.bowl ~) ~ (snoc here.bowl %pub)])
|
||||
:~ :- (snoc here.bowl %pub)
|
||||
[%make %message-pub ~ ~]
|
||||
::
|
||||
@ -36,11 +37,11 @@
|
||||
=/ poke !<(groupchat-diff q.u.old)
|
||||
?+ -.poke !!
|
||||
%invited
|
||||
:_ groupchat/!>([~ (snoc chat.poke %pub)])
|
||||
:_ groupchat/!>([~ ~ host.poke])
|
||||
:~ :- (snoc here.bowl %sub)
|
||||
[%make %message-sub ~ (malt ~[[%pub (snoc chat.poke %pub)]])]
|
||||
[%make %message-sub ~ (malt ~[[%pub (snoc host.poke %pub)]])]
|
||||
::
|
||||
:- chat.poke
|
||||
:- host.poke
|
||||
[%poke groupchat-diff/!>([%acked ~])]
|
||||
==
|
||||
==
|
||||
@ -54,27 +55,48 @@
|
||||
:: if I'm the host, poke someone's provider to invite them to chat
|
||||
%invite
|
||||
?> =(our ship.src):bowl
|
||||
:: ?> =(our.bowl ->.publisher.sta) :: XX need @p, have @t ?
|
||||
?< (~(has in members.sta) ship.poke)
|
||||
:: ?> =(our.bowl ->.host.sta) :: XX need @p, have @t ?
|
||||
:_ :- %groupchat
|
||||
!>(sta(pending (~(put in pending.sta) ship.poke)))
|
||||
:~ :- provider.poke
|
||||
[%poke groupchat-diff/!>([%invited here.bowl])]
|
||||
==
|
||||
::
|
||||
:: remove someone from chat. this only removes their ability to post;
|
||||
:: they'll still be receiving new messages!
|
||||
%remove
|
||||
?> =(our ship.src):bowl
|
||||
?> (~(has in members.sta) ship.poke)
|
||||
:- ~
|
||||
:- %groupchat
|
||||
!> %= sta
|
||||
pending (~(del in pending.sta) ship.src.bowl)
|
||||
members (~(del in members.sta) ship.src.bowl)
|
||||
==
|
||||
::
|
||||
:: when invitee acks, remove them from pending
|
||||
:: and add them to pub's permissions
|
||||
%acked
|
||||
?> (~(has in pending.sta) ship.src.bowl)
|
||||
:_ :- %groupchat
|
||||
!>(sta(pending (~(del in pending.sta) ship.src.bowl)))
|
||||
:~ :- publisher.sta
|
||||
[%poke ships-diff/!>([%put ship.src.bowl])]
|
||||
:- ~
|
||||
:- %groupchat
|
||||
!> %= sta
|
||||
pending (~(del in pending.sta) ship.src.bowl)
|
||||
members (~(put in members.sta) ship.src.bowl)
|
||||
==
|
||||
::
|
||||
%post-to-host
|
||||
:_ state
|
||||
:~ :- host.sta
|
||||
[%poke groupchat-diff/!>([%host-to-pub text.poke])]
|
||||
==
|
||||
::
|
||||
%post
|
||||
%host-to-pub
|
||||
?> (~(has in members.sta) ship.src.bowl)
|
||||
:_ state
|
||||
:~ :- publisher.sta
|
||||
[%poke txt/!>(text.poke)]
|
||||
:~ :- (snoc here.bowl %pub)
|
||||
[%poke message/!>([ship.src.bowl now.bowl text.poke])]
|
||||
==
|
||||
==
|
||||
--
|
||||
|
@ -1,11 +1,10 @@
|
||||
/@ ships
|
||||
/@ ships-diff
|
||||
/@ txt
|
||||
/@ message
|
||||
::
|
||||
^- kook:neo
|
||||
|%
|
||||
++ state pro/%ships :: ships that are allowed to post
|
||||
++ poke (sy %txt %ships-diff ~)
|
||||
++ state pro/%sig
|
||||
++ poke (sy %message %txt ~)
|
||||
++ kids
|
||||
:+ ~ %y
|
||||
%- ~(gas by *lads:neo)
|
||||
@ -19,30 +18,24 @@
|
||||
++ init
|
||||
|= old=(unit pail:neo)
|
||||
^- (quip card:neo pail:neo)
|
||||
[~ ships/!>((sy our.bowl ~))]
|
||||
[~ sig/!>(~)]
|
||||
::
|
||||
++ poke
|
||||
|= [=stud:neo vax=vase]
|
||||
^- (quip card:neo pail:neo)
|
||||
=/ members !<(ships q.state)
|
||||
?> =(our ship.src):bowl
|
||||
:_ state
|
||||
?+ stud !!
|
||||
%message
|
||||
=/ msg !<(message vax)
|
||||
:~ :- (welp here.bowl ~[da/now.msg])
|
||||
[%make %message `message/vax ~]
|
||||
==
|
||||
%txt
|
||||
?> (~(has in members) ship.src.bowl)
|
||||
=/ contents=@t !<(txt vax)
|
||||
:_ state
|
||||
:~ :- (welp here.bowl ~[da/now.bowl])
|
||||
[%make %message `message/!>([ship.src.bowl now.bowl contents]) ~]
|
||||
==
|
||||
::
|
||||
%ships-diff
|
||||
?> =(our ship.src):bowl
|
||||
=/ poke !<(ships-diff vax)
|
||||
?- -.poke
|
||||
%put
|
||||
[~ ships/!>((~(put in members) ship.poke))]
|
||||
%del
|
||||
[~ ships/!>((~(del in members) ship.poke))]
|
||||
==
|
||||
==
|
||||
--
|
||||
--
|
@ -36,10 +36,12 @@
|
||||
::
|
||||
%groupchat-diff
|
||||
=/ poke !<(groupchat-diff vax)
|
||||
?> =(%invited -.poke)
|
||||
:_ state
|
||||
:~ :- (snoc here.bowl (rear pith.src.bowl))
|
||||
[%make %groupchat `groupchat-diff/vax ~]
|
||||
?+ -.poke !!
|
||||
%invited
|
||||
:_ state
|
||||
:~ :- (snoc here.bowl (rear host.poke))
|
||||
[%make %groupchat `groupchat-diff/vax ~]
|
||||
==
|
||||
==
|
||||
::
|
||||
%messenger-diff
|
||||
|
@ -1,5 +1,7 @@
|
||||
$% [%invite =ship provider=pith]
|
||||
[%invited chat=pith]
|
||||
[%remove =ship]
|
||||
[%invited host=pith]
|
||||
[%acked ~]
|
||||
[%post text=@t]
|
||||
[%post-to-host text=@t]
|
||||
[%host-to-pub text=@t]
|
||||
==
|
@ -1,3 +1,4 @@
|
||||
$: pending=(set ship)
|
||||
publisher=pith
|
||||
$: members=(set ship)
|
||||
pending=(set ship)
|
||||
host=pith
|
||||
==
|
Loading…
Reference in New Issue
Block a user