chat: unmanaged chats are cleaned up and sync down metadata properly

This commit is contained in:
Logan Allen 2020-02-27 14:54:03 -08:00
parent c502474942
commit 7abb371a20
6 changed files with 25 additions and 11 deletions

View File

@ -215,6 +215,7 @@
::
%delete
=/ group-path (group-from-chat app-path.act)
~& delete+group-path
?> ?=(^ app-path.act)
%- zing
:~ :~ (chat-hook-poke [%remove app-path.act])
@ -224,6 +225,7 @@
::
?: (is-managed group-path) ~
:~ (permission-hook-poke [%remove group-path])
(permission-poke [%delete group-path])
(group-poke [%unbundle group-path])
(metadata-hook-poke [%remove group-path])
==
@ -264,9 +266,9 @@
++ create-metadata
|= [group-path=path app-path=path]
^- (list card)
~& group-path+group-path
~& app-path+app-path
~& is-managed+(is-managed app-path)
::~& group-path+group-path
::~& app-path+app-path
::~& is-managed+(is-managed app-path)
=/ =metadata
%* . *metadata
date-created now.bol
@ -342,6 +344,7 @@
(scot %da now.bol)
/resource-indices
==
~& resource-indices
=/ groups=(set path) (~(got by resource-indices) [%chat app-path])
(snag 0 ~(tap in groups))
::
@ -349,6 +352,7 @@
|= =path
^- ?
?> ?=(^ path)
~& is-managed+!=(i.path '~')
!=(i.path '~')
--
::
@ -373,6 +377,11 @@
^- card
[%pass / %agent [our.bol %group-store] %poke %group-action !>(act)]
::
++ permission-poke
|= act=permission-action
^- card
[%pass / %agent [our.bol %permission-store] %poke %permission-action !>(act)]
::
++ chat-hook-poke
|= act=chat-hook-action
^- card

File diff suppressed because one or more lines are too long

View File

@ -132,7 +132,7 @@
|= pax=^path
^- associations
=. pax ;:(weld /=metadata-store/(scot %da now.bowl)/group pax /noun)
(need .^((unit associations) %gx pax))
.^(associations %gx pax)
--
::
++ fact-metadata-update

View File

@ -171,6 +171,7 @@
::
++ metadata-for-app
|= =app-name
^- ^associations
%- ~(gas by *^associations)
%+ turn ~(tap in (~(got by app-indices) app-name))
|= [=group-path =app-path]
@ -179,6 +180,7 @@
::
++ metadata-for-group
|= =group-path
^- ^associations
%- ~(gas by *^associations)
%+ turn ~(tap in (~(got by group-indices) group-path))
|= =resource

View File

@ -177,7 +177,9 @@
::
%unbundle
:: pull subscriptions
~& %unbundle
=/ perms (~(get by relation) pax.diff)
~& perms
?~ perms
:_ state(relation (~(del by relation) pax.diff))
[(group-pull pax.diff)]~

View File

@ -64,14 +64,15 @@ export class JoinScreen extends Component {
}
let station = text.split('/');
let sig = state.station.includes("/~/");
let ship = !!sig ? station[2] : station[1];
let sig = state.station.includes("~/");
let ship = !!sig ? station[1] : station[0];
station = station.join('/');
console.log(sig, station.split('/').length, ship);
if (
station.length < 2 ||
(!!sig && station.length < 3) ||
(!sig && station.split('/').length < 2) ||
(!!sig && station.split('/').length < 3) ||
!urbitOb.isValidPatp(ship)
) {
this.setState({
@ -80,7 +81,7 @@ export class JoinScreen extends Component {
return;
}
props.api.chatView.join(ship, station, true);
props.api.chatView.join(ship, `/${station}`, true);
}
stationChange(event) {
@ -115,7 +116,7 @@ export class JoinScreen extends Component {
</div>
<h2 className="mb3 f8">Join Existing Chat</h2>
<div className="w-100">
<p className="f8 lh-copy mt3 db">Enter a <span className="mono">~ship/chat-name</span></p>
<p className="f8 lh-copy mt3 db">Enter a <span className="mono">~ship/chat-name</span> or <span className="mono">~/~ship/chat-name</span></p>
<p className="f9 gray2 mb4">Chat names use lowercase, hyphens, and slashes.</p>
<textarea
ref={ e => { this.textarea = e; } }