Merge branch 'odyssey-wip' into odyssey-chat-cli

This commit is contained in:
Fang 2019-10-08 23:32:57 +02:00 committed by GitHub
commit b7f1e9c578
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 19 additions and 71 deletions

View File

@ -43,13 +43,6 @@
[ost.bol %peer /permissions [our.bol %permission-store] /updates]~
[~ this(+<+ u.old)]
::
++ poke-noun
|= a=*
^- (quip move _this)
~& synced
~& boned
[~ this]
::
++ poke-json
|= jon=json
^- (quip move _this)
@ -121,11 +114,10 @@
^- (list move)
%+ turn (prey:pubsub:userlib [%mailbox path.act] bol)
|= [=bone *]
^- move
[bone %quit ~]
==
?. |(=(u.ship src.bol) (team:title our.bol src.bol))
:: if neither ship = source or source = us, do nothing
:: if neither ship = source or source = us, do nothing
[~ this]
:: delete a foreign ship's path
:- (pull-wire [%mailbox path.act])
@ -174,9 +166,8 @@
%+ turn ~(tap in who)
|= check-ship=ship
?: (permitted-scry [(scot %p check-ship) pax])
:: if ship is permitted to be subscribed, do nothing
~
:: if ship is not permitted, quit their subscription
:: if ship is not permitted, quit their subscription
=/ mail-path
(oust [(dec (lent t.pax)) (lent t.pax)] `(list @t)`t.pax)
=/ bne (~(get by sup) [check-ship [%mailbox mail-path]])
@ -201,7 +192,6 @@
?. (~(has by synced) path.diff)
[~ this]
:_ this(synced (~(del by synced) path.diff))
:- (chat-poke diff)
[ost.bol %pull [%mailbox path.diff] [our.bol %chat-store] ~]~
::
%message
@ -344,7 +334,7 @@
++ pull-wire
|= pax=path
^- (list move)
?> ?=([* ^] pax)
?> ?=(^ pax)
=/ bnd (~(get by boned) pax)
?~ bnd ~
=/ shp (~(get by synced) t.pax)

View File

@ -143,12 +143,6 @@
:_ this
[ost.bol %diff %chat-update [%create ship pax]]~
::
++ poke-noun
|= a=*
^- (quip move _this)
~& inbox
[~ this]
::
++ poke-json
|= jon=json
^- (quip move _this)

View File

@ -1,3 +1,4 @@
:: chat-view: sets up chat JS client, paginates data, and combines commands
:: into semantic actions for the UI
::
@ -177,23 +178,14 @@
::
==
::
++ peer-initial
++ peer-primary
|= pax=path
^- (quip move _this)
?> (team:title our.bol src.bol)
:: create inbox with 100 messages max per mailbox and send that along
:: then quit the subscription
:_ this
:~ [ost.bol %diff %json (inbox-to-json (truncate-inbox all-scry))]
[ost.bol %quit ~]
==
::
++ peer-updates
|= pax=path
^- (quip move _this)
?> (team:title our.bol src.bol)
:: send along all subsequent updates
[~ this]
[ost.bol %diff %json (inbox-to-json (truncate-inbox all-scry))]~
::
++ peer-configs
|= pax=path
@ -209,7 +201,7 @@
=/ configs-json (configs-to-json configs-scry)
:_ this
%+ weld
%+ turn (prey:pubsub:userlib /updates bol)
%+ turn (prey:pubsub:userlib /primary bol)
|= [=bone *]
[bone %diff %json updates-json]
%+ turn (prey:pubsub:userlib /configs bol)

File diff suppressed because one or more lines are too long

View File

@ -29,13 +29,13 @@
++ eval ::: %exp speech
::: extract contents of an %exp speech, evaluating
::: the {exp} if there is no {res} yet.
::
|= a=json
^- [cord (list tank)]
=, ^? dejs-soft:format
=/ exp ((ot expression+so ~) a)
=+ exp=((ot expression+so ~) a)
%- need
?~ exp
[~ '' ~]
?~ exp [~ '' ~]
:+ ~ u.exp
::NOTE when sending, if output is an empty list, chat-store will evaluate
(fall ((ot output+(ar dank) ~) a) ~)
@ -125,8 +125,6 @@
%+ frond %chat-update
%- pairs
:~
::
:: %message
?: =(%message -.upd)
?> ?=(%message -.upd)
:- %message
@ -134,13 +132,9 @@
:~ [%path (path path.upd)]
[%envelope (enve envelope.upd)]
==
::
:: %read
?: =(%read -.upd)
?> ?=(%read -.upd)
[%read (pairs [%path (path path.upd)]~)]
::
:: %create
?: =(%create -.upd)
?> ?=(%create -.upd)
:- %create
@ -148,13 +142,9 @@
:~ [%ship (ship ship.upd)]
[%path (path path.upd)]
==
::
:: %delete
?: =(%delete -.upd)
?> ?=(%delete -.upd)
[%delete (pairs [%path (path path.upd)]~)]
::
:: %config
?: =(%config -.upd)
?> ?=(%config -.upd)
:- %config
@ -162,8 +152,6 @@
:~ [%path (path path.upd)]
[%config (conf config.upd)]
==
::
:: %noop
[*@t *^json]
==
::

View File

@ -1,5 +1,5 @@
|%
++ serial @uvH
+$ serial @uvH
::
+$ letter
$% [%text text=cord]
@ -42,5 +42,4 @@
[%config =path =config]
chat-action
==
::
--

View File

@ -58,7 +58,7 @@ export class ChatScreen extends Component {
);
this.updateReadNumber();
});
} else if (Object.keys(props.inbox) > 0) {
} else if (Object.keys(props.inbox).length === 0) {
props.history.push('/~chat');
} else if (props.envelopes.length - prevProps.envelopes.length >= 200) {
this.hasAskedForMessages = false;

View File

@ -10,7 +10,7 @@ export class JoinScreen extends Component {
componentDidMount() {
const { props } = this;
let station = `${props.match.params.ship}/${props.match.params.station}`;
let station = `/${props.match.params.ship}/${props.match.params.station}`;
if (station in props.inbox) {
props.history.push(`/~chat/room${station}`);

View File

@ -23,12 +23,9 @@ export class InviteElement extends Component {
let aud = [];
let isValid = true;
if (state.members.length > 2) {
aud = state.members.split(',')
.map((mem) => mem.trim())
.map(deSig)
.map((mem) => {
return `~${mem}`;
});
aud = state.members
.split(',')
.map((mem) => `~${deSig(mem.trim())}`);
aud.forEach((mem) => {
if (!urbitOb.isValidPatp(mem)) {

View File

@ -73,11 +73,7 @@ export class NewScreen extends Component {
let isValid = true;
if (state.invites.length > 2) {
aud = state.invites.split(',')
.map((mem) => mem.trim())
.map(deSig)
.map((mem) => {
return `~${mem}`;
});
.map((mem) => `~${deSig(mem.trim())}`);
aud.forEach((mem) => {
if (!urbitOb.isValidPatp(mem)) {

View File

@ -14,11 +14,7 @@ export class Subscription {
}
initializeChat() {
api.bind('/initial', 'PUT', api.authTokens.ship, 'chat-view',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitSilently.bind(this));
api.bind('/updates', 'PUT', api.authTokens.ship, 'chat-view',
api.bind('/primary', 'PUT', api.authTokens.ship, 'chat-view',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
@ -30,10 +26,6 @@ export class Subscription {
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
api.bind('/all', 'PUT', api.authTokens.ship, 'invite-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
}
handleEvent(diff) {