contacts: delete groups/contacts properly and mirror to foreign

This commit is contained in:
Logan Allen 2020-01-29 15:02:03 -08:00
parent 4c5ecb51bd
commit 1279019cdd
5 changed files with 137 additions and 92 deletions

View File

@ -145,8 +145,7 @@
:: ::
%add-synced %add-synced
?> (team:title our.bol src.bol) ?> (team:title our.bol src.bol)
?: (~(has by synced) path.act) ?: (~(has by synced) path.act) [~ state]
[~ state]
=. synced (~(put by synced) path.act ship.act) =. synced (~(put by synced) path.act ship.act)
=/ contact-path [%contacts path.act] =/ contact-path [%contacts path.act]
:_ state :_ state
@ -154,8 +153,7 @@
:: ::
%remove %remove
=/ ship (~(get by synced) path.act) =/ ship (~(get by synced) path.act)
?~ ship ?~ ship [~ state]
[~ state]
?: &(=(u.ship our.bol) (team:title our.bol src.bol)) ?: &(=(u.ship our.bol) (team:title our.bol src.bol))
:: delete one of our.bol own paths :: delete one of our.bol own paths
:_ state(synced (~(del by synced) path.act)) :_ state(synced (~(del by synced) path.act))
@ -223,9 +221,9 @@
|= [wir=wire fact=contact-update] |= [wir=wire fact=contact-update]
^- (quip card _state) ^- (quip card _state)
|^ |^
:_ state
?: (team:title our.bol src.bol) ?: (team:title our.bol src.bol)
(local fact) (local fact)
:_ state
(foreign fact) (foreign fact)
:: ::
++ give-fact ++ give-fact
@ -235,18 +233,24 @@
:: ::
++ local ++ local
|= fact=contact-update |= fact=contact-update
^- (list card) ^- (quip card _state)
?+ -.fact ~ ?+ -.fact [~ state]
%add %add
:_ state
(give-fact path.fact [%add path.fact ship.fact contact.fact]) (give-fact path.fact [%add path.fact ship.fact contact.fact])
:: ::
%edit %edit
:_ state
(give-fact path.fact [%edit path.fact ship.fact edit-field.fact]) (give-fact path.fact [%edit path.fact ship.fact edit-field.fact])
:: ::
%remove %remove
%+ welp :_ state
(give-fact path.fact [%remove path.fact ship.fact]) ~[(group-poke [%remove [ship.fact ~ ~] path.fact])]
[%give %kick ~[[%contacts path.fact]] `ship.fact]~ ::
%delete
=. synced (~(del by synced) path.fact)
:_ state
[(group-poke [%unbundle path.fact])]~
== ==
:: ::
++ foreign ++ foreign
@ -301,18 +305,27 @@
?. (~(has by synced) path) ?. (~(has by synced) path)
[~ state] [~ state]
:_ state(synced (~(del by synced) path)) :_ state(synced (~(del by synced) path))
[%pass [%contacts path] %agent [our.bol %contact-store] %leave ~]~ :~ [%pass [%contacts path] %agent [our.bol %contact-store] %leave ~]
[(contact-poke [%delete path])]
==
:: ::
++ remove ++ remove
|= [members=group =path] |= [members=group =path]
^- (quip card _state) ^- (quip card _state)
:: if pax is synced, remove member from contacts and kick their sub :: if pax is synced, remove member from contacts and kick their sub
=/ owner=(unit ship) (~(get by synced) path)
?~ owner
:_ state
%+ turn ~(tap in members)
|= =ship
(contact-poke [%remove path ship])
:_ state :_ state
?. (~(has by synced) path) ~
%- zing %- zing
%+ turn ~(tap in members) %+ turn ~(tap in members)
|= =ship |= =ship
:~ [%give %kick ~[[%contacts path]] `ship] :~ [%give %kick ~[[%contacts path]] `ship]
?: =(ship our.bol)
(contact-poke [%delete path])
(contact-poke [%remove path ship]) (contact-poke [%remove path ship])
== ==
-- --

View File

@ -32308,6 +32308,7 @@
global$2[key$1] = "esm"; global$2[key$1] = "esm";
} }
} }
//# sourceMappingURL=react-router.js.map
/** /**
* The public API for a <Router> that uses HTML5 history. * The public API for a <Router> that uses HTML5 history.
@ -32607,6 +32608,7 @@
style: propTypes.object style: propTypes.object
}); });
} }
//# sourceMappingURL=react-router-dom.js.map
var classnames = createCommonjsModule(function (module) { var classnames = createCommonjsModule(function (module) {
/*! /*!
@ -58709,10 +58711,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
this.handleEvent.bind(this), this.handleEvent.bind(this),
this.handleError.bind(this), this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this)); this.handleQuitAndResubscribe.bind(this));
api$1.bind('/all', 'PUT', api$1.authTokens.ship, 'permission-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
} }
handleEvent(diff) { handleEvent(diff) {
@ -63464,6 +63462,22 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
removeFromGroup() { removeFromGroup() {
const { props } = this; const { props } = this;
// share empty contact so that we can remove ourselves from group
// if we haven't shared yet
let contact = {
nickname: "",
email: "",
phone: "",
website: "",
notes: "",
color: "000000",
avatar: null
};
api$1.contactView.share(
`~${props.ship}`, props.path, `~${window.ship}`, contact
);
api$1.contactHook.remove(props.path, `~${props.ship}`); api$1.contactHook.remove(props.path, `~${props.ship}`);
props.history.push(`/~contacts${props.path}`); props.history.push(`/~contacts${props.path}`);
} }
@ -63501,8 +63515,8 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
if (!hasAvatar) { if (!hasAvatar) {
sigilColor = ( sigilColor = (
react.createElement('div', { className: "tl mt4 mb4 w-auto ml-auto mr-auto" , react.createElement('div', { className: "tl mt4 mb4 w-auto ml-auto mr-auto" ,
style: { width: "fit-content" }, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 289}} style: { width: "fit-content" }, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 305}}
, react.createElement('p', { className: "f9 gray2 lh-copy" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 291}}, "Sigil Color" ) , react.createElement('p', { className: "f9 gray2 lh-copy" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 307}}, "Sigil Color" )
, react.createElement('textarea', { , react.createElement('textarea', {
className: "b--gray4 black f7 ba db pl2" , className: "b--gray4 black f7 ba db pl2" ,
onChange: this.sigilColorSet, onChange: this.sigilColorSet,
@ -63513,77 +63527,77 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
height: 40, height: 40,
paddingTop: 10, paddingTop: 10,
width: 114 width: 114
}, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 292}} }, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 308}}
) )
) )
); );
} }
let removeImage = hasAvatar ? ( let removeImage = hasAvatar ? (
react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 309}} react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 325}}
, react.createElement('button', { className: "f9 black pointer db" , , react.createElement('button', { className: "f9 black pointer db" ,
onClick: () => this.setField("removeAvatar"), __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 310}}, "Remove photo" onClick: () => this.setField("removeAvatar"), __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 326}}, "Remove photo"
) )
) )
) : ""; ) : "";
let avatar = (hasAvatar) let avatar = (hasAvatar)
? react.createElement('img', { className: "dib h-auto" , width: 128, src: props.contact.avatar, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 318}} ) ? react.createElement('img', { className: "dib h-auto" , width: 128, src: props.contact.avatar, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 334}} )
: react.createElement(Sigil, { : react.createElement(Sigil, {
ship: props.ship, ship: props.ship,
size: 128, size: 128,
color: currentColor, color: currentColor,
key: "avatar" + currentColor, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 319}} ); key: "avatar" + currentColor, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 335}} );
return ( return (
react.createElement('div', { className: "w-100 mt8 flex justify-center pa4 pt8 pt0-l pa0-xl pt4-xl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 326}} react.createElement('div', { className: "w-100 mt8 flex justify-center pa4 pt8 pt0-l pa0-xl pt4-xl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 342}}
, react.createElement('div', { className: "w-100 mw6 tc" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 327}} , react.createElement('div', { className: "w-100 mw6 tc" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 343}}
, avatar , avatar
, sigilColor , sigilColor
, react.createElement('button', { className: "f9 b--black ba pa2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 330}}, "Upload an Image" ) , react.createElement('button', { className: "f9 b--black ba pa2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 346}}, "Upload an Image" )
, removeImage , removeImage
, react.createElement('div', { className: "w-100 pt8 lh-copy tl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 332}} , react.createElement('div', { className: "w-100 pt8 lh-copy tl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 348}}
, react.createElement('p', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 333}}, "Ship Name" ) , react.createElement('p', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 349}}, "Ship Name" )
, react.createElement('p', { className: "f8 mono" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 334}}, "~", props.ship) , react.createElement('p', { className: "f8 mono" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 350}}, "~", props.ship)
, react.createElement('p', { className: "f9 gray2 mt3" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 335}}, "Ship Type" ) , react.createElement('p', { className: "f9 gray2 mt3" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 351}}, "Ship Type" )
, react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 336}}, shipType) , react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 352}}, shipType)
, react.createElement('hr', { className: "mv8 gray4 b--gray4 bb-0 b--solid" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 337}} ) , react.createElement('hr', { className: "mv8 gray4 b--gray4 bb-0 b--solid" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 353}} )
, react.createElement(EditElement, { , react.createElement(EditElement, {
title: "Nickname", title: "Nickname",
defaultValue: defaultValue.nickname, defaultValue: defaultValue.nickname,
onChange: this.nickNameToSet, onChange: this.nickNameToSet,
onDeleteClick: () => this.setField("removeNickname"), onDeleteClick: () => this.setField("removeNickname"),
onSaveClick: () => this.setField("nickname"), onSaveClick: () => this.setField("nickname"),
showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 338}} ) showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 354}} )
, react.createElement(EditElement, { , react.createElement(EditElement, {
title: "Email", title: "Email",
defaultValue: defaultValue.email, defaultValue: defaultValue.email,
onChange: this.emailToSet, onChange: this.emailToSet,
onDeleteClick: () => this.setField("removeEmail"), onDeleteClick: () => this.setField("removeEmail"),
onSaveClick: () => this.setField("email"), onSaveClick: () => this.setField("email"),
showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 345}} ) showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 361}} )
, react.createElement(EditElement, { , react.createElement(EditElement, {
title: "Phone", title: "Phone",
defaultValue: defaultValue.phone, defaultValue: defaultValue.phone,
onChange: this.phoneToSet, onChange: this.phoneToSet,
onDeleteClick: () => this.setField("removePhone"), onDeleteClick: () => this.setField("removePhone"),
onSaveClick: () => this.setField("phone"), onSaveClick: () => this.setField("phone"),
showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 352}} ) showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 368}} )
, react.createElement(EditElement, { , react.createElement(EditElement, {
title: "Website", title: "Website",
defaultValue: defaultValue.website, defaultValue: defaultValue.website,
onChange: this.websiteToSet, onChange: this.websiteToSet,
onDeleteClick: () => this.setField("removeWebsite"), onDeleteClick: () => this.setField("removeWebsite"),
onSaveClick: () => this.setField("website"), onSaveClick: () => this.setField("website"),
showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 359}} ) showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 375}} )
, react.createElement(EditElement, { , react.createElement(EditElement, {
title: "Notes", title: "Notes",
defaultValue: defaultValue.notes, defaultValue: defaultValue.notes,
onChange: this.notesToSet, onChange: this.notesToSet,
onDeleteClick: () => this.setField("removeNotes"), onDeleteClick: () => this.setField("removeNotes"),
onSaveClick: () => this.setField("notes"), onSaveClick: () => this.setField("notes"),
showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 366}} ) showButtons: !props.share, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 382}} )
) )
) )
) )
@ -63598,64 +63612,64 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
let avatar = let avatar =
('avatar' in props.contact && props.contact.avatar !== "TODO") ? ('avatar' in props.contact && props.contact.avatar !== "TODO") ?
react.createElement('img', { className: "dib h-auto" , width: 128, src: props.contact.avatar, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 387}} ) : react.createElement('img', { className: "dib h-auto" , width: 128, src: props.contact.avatar, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 403}} ) :
react.createElement(Sigil, { react.createElement(Sigil, {
ship: props.ship, ship: props.ship,
size: 128, size: 128,
color: hexColor, color: hexColor,
key: hexColor, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 388}} ); key: hexColor, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 404}} );
let websiteHref = let websiteHref =
(props.contact.website && props.contact.website.includes("://")) ? (props.contact.website && props.contact.website.includes("://")) ?
props.contact.website : "http://" + props.contact.website; props.contact.website : "http://" + props.contact.website;
return ( return (
react.createElement('div', { className: "w-100 mt8 flex justify-center pa4 pt8 pt0-l pa0-xl pt4-xl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 399}} react.createElement('div', { className: "w-100 mt8 flex justify-center pa4 pt8 pt0-l pa0-xl pt4-xl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 415}}
, react.createElement('div', { className: "w-100 mw6 tc" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 400}} , react.createElement('div', { className: "w-100 mw6 tc" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 416}}
, avatar , avatar
, react.createElement('div', { className: "w-100 pt8 lh-copy tl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 402}} , react.createElement('div', { className: "w-100 pt8 lh-copy tl" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 418}}
, react.createElement('p', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 403}}, "Ship Name" ) , react.createElement('p', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 419}}, "Ship Name" )
, react.createElement('p', { className: "f8 mono" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 404}}, "~", props.ship) , react.createElement('p', { className: "f8 mono" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 420}}, "~", props.ship)
, react.createElement('p', { className: "f9 gray2 mt3" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 405}}, "Ship Type" ) , react.createElement('p', { className: "f9 gray2 mt3" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 421}}, "Ship Type" )
, react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 406}}, shipType) , react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 422}}, shipType)
, react.createElement('hr', { className: "mv8 gray4 b--gray4 bb-0 b--solid" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 407}} ) , react.createElement('hr', { className: "mv8 gray4 b--gray4 bb-0 b--solid" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 423}} )
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 408}} , react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 424}}
, !!props.contact.nickname ? ( , !!props.contact.nickname ? (
react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 410}} react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 426}}
, react.createElement('p', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 411}}, "Nickname") , react.createElement('p', { className: "f9 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 427}}, "Nickname")
, react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 412}}, props.contact.nickname) , react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 428}}, props.contact.nickname)
) )
) : null ) : null
, !!props.contact.email ? ( , !!props.contact.email ? (
react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 417}} react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 433}}
, react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 418}}, "Email") , react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 434}}, "Email")
, react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 419}}, props.contact.email) , react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 435}}, props.contact.email)
) )
) : null ) : null
, !!props.contact.phone ? ( , !!props.contact.phone ? (
react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 424}} react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 440}}
, react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 425}}, "Phone") , react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 441}}, "Phone")
, react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 426}}, props.contact.phone) , react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 442}}, props.contact.phone)
) )
) : null ) : null
, !!props.contact.website ? ( , !!props.contact.website ? (
react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 431}} react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 447}}
, react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 432}}, "website") , react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 448}}, "website")
, react.createElement('a', { target: "_blank", , react.createElement('a', { target: "_blank",
className: "bb b--black f8" , className: "bb b--black f8" ,
href: websiteHref, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 433}} href: websiteHref, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 449}}
, props.contact.website , props.contact.website
) )
) )
) : null ) : null
, !!props.contact.notes ? ( , !!props.contact.notes ? (
react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 442}} react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$d, lineNumber: 458}}
, react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 443}}, "notes") , react.createElement('p', { className: "f9 mt6 gray2" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 459}}, "notes")
, react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 444}}, props.contact.notes) , react.createElement('p', { className: "f8", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 460}}, props.contact.notes)
) )
) : null ) : null
@ -63687,10 +63701,10 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
//TODO "Share card" if it's /me -> sends to /~/default of recipient //TODO "Share card" if it's /me -> sends to /~/default of recipient
return ( return (
react.createElement('div', { className: "h-100 w-100 overflow-x-hidden" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 476}} react.createElement('div', { className: "h-100 w-100 overflow-x-hidden" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 492}}
, react.createElement('div', { className: "w-100 bg-white fixed bb b--gray4" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 477}} , react.createElement('div', { className: "w-100 bg-white fixed bb b--gray4" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 493}}
, react.createElement('div', { className: "w-100 h2 dn-m dn-l dn-xl inter pb6 pl3 pt3 f8" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 478}} , react.createElement('div', { className: "w-100 h2 dn-m dn-l dn-xl inter pb6 pl3 pt3 f8" , __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 494}}
, react.createElement(Link, { to: "/~contacts/", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 479}}, "⟵") , react.createElement(Link, { to: "/~contacts/", __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 495}}, "⟵")
) )
, react.createElement('button', { , react.createElement('button', {
onClick: () => { onClick: () => {
@ -63700,16 +63714,16 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
this.editToggle(); this.editToggle();
} }
}, },
className: `ml3 mt2 mb2 f9 pa1 ba br2 pointer b--black ` + ourOpt, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 481}} className: `ml3 mt2 mb2 f9 pa1 ba br2 pointer b--black ` + ourOpt, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 497}}
, editInfoText , editInfoText
) )
, react.createElement('button', { , react.createElement('button', {
className: `ml3 mt2 mb2 f9 pa1 ba br2 b--black ` + localOpt, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 492}}, "Share Contact Info" className: `ml3 mt2 mb2 f9 pa1 ba br2 b--black ` + localOpt, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 508}}, "Share Contact Info"
) )
, react.createElement('button', { , react.createElement('button', {
className: `ml3 mt2 mb2 f9 pa1 ba red2 br2 b--red2 pointer ` + adminOpt, className: `ml3 mt2 mb2 f9 pa1 ba red2 br2 b--red2 pointer ` + adminOpt,
onClick: this.removeFromGroup, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 496}}, "Remove from Group" onClick: this.removeFromGroup, __self: this, __source: {fileName: _jsxFileName$d, lineNumber: 512}}, "Remove from Group"
) )
) )
@ -63892,6 +63906,9 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
`/${props.match.params.ship}/${props.match.params.group}`; `/${props.match.params.ship}/${props.match.params.group}`;
let groupContacts = contacts[groupPath] || {}; let groupContacts = contacts[groupPath] || {};
let group = groups[groupPath] || new Set([]); let group = groups[groupPath] || new Set([]);
if (!(groupPath in groups)) {
props.history.push('/~contacts');
}
return ( return (
react.createElement(Skeleton, { react.createElement(Skeleton, {
@ -63902,14 +63919,14 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
invites: invites, invites: invites,
groups: groups, groups: groups,
activeDrawer: "contacts", activeDrawer: "contacts",
selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 85}} selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 88}}
, react.createElement(ContactSidebar, { , react.createElement(ContactSidebar, {
contacts: groupContacts, contacts: groupContacts,
defaultContacts: defaultContacts, defaultContacts: defaultContacts,
group: group, group: group,
activeDrawer: "contacts", activeDrawer: "contacts",
path: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 94}} ) path: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 97}} )
, react.createElement('div', { className: "h-100 w-100 overflow-x-hidden bg-gray0 dn db-ns" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 100}}) , react.createElement('div', { className: "h-100 w-100 overflow-x-hidden bg-gray0 dn db-ns" , __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 103}})
) )
); );
}, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 77}} }, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 77}}
@ -63930,22 +63947,22 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
groups: groups, groups: groups,
invites: invites, invites: invites,
activeDrawer: "rightPanel", activeDrawer: "rightPanel",
selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 113}} selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 116}}
, react.createElement(ContactSidebar, { , react.createElement(ContactSidebar, {
contacts: groupContacts, contacts: groupContacts,
defaultContacts: defaultContacts, defaultContacts: defaultContacts,
group: group, group: group,
activeDrawer: "rightPanel", activeDrawer: "rightPanel",
path: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 122}} ) path: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 125}} )
, react.createElement(AddScreen, { , react.createElement(AddScreen, {
api: api$1, api: api$1,
path: groupPath, path: groupPath,
setSpinner: this.setSpinner, setSpinner: this.setSpinner,
history: props.history, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 128}} history: props.history, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 131}}
) )
) )
); );
}, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 105}} ) }, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 108}} )
, react.createElement(Route, { exact: true, path: "/~contacts/share/:ship/:group", , react.createElement(Route, { exact: true, path: "/~contacts/share/:ship/:group",
render: (props) => { render: (props) => {
let groupPath = let groupPath =
@ -63971,24 +63988,24 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
groups: groups, groups: groups,
invites: invites, invites: invites,
activeDrawer: "rightPanel", activeDrawer: "rightPanel",
selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 154}} selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 157}}
, react.createElement(ContactSidebar, { , react.createElement(ContactSidebar, {
activeDrawer: "rightPanel", activeDrawer: "rightPanel",
contacts: groupContacts, contacts: groupContacts,
defaultContacts: defaultContacts, defaultContacts: defaultContacts,
group: group, group: group,
path: groupPath, path: groupPath,
selectedContact: shipPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 163}} ) selectedContact: shipPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 166}} )
, react.createElement(ContactCard, { , react.createElement(ContactCard, {
history: props.history, history: props.history,
contact: contact, contact: contact,
path: groupPath, path: groupPath,
ship: window.ship, ship: window.ship,
share: true, share: true,
rootIdentity: rootIdentity, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 170}} ) rootIdentity: rootIdentity, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 173}} )
) )
); );
}, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 137}} ) }, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 140}} )
, react.createElement(Route, { exact: true, path: "/~contacts/view/:ship/:group/:contact", , react.createElement(Route, { exact: true, path: "/~contacts/view/:ship/:group/:contact",
render: (props) => { render: (props) => {
let groupPath = let groupPath =
@ -64015,24 +64032,24 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
groups: groups, groups: groups,
invites: invites, invites: invites,
activeDrawer: "rightPanel", activeDrawer: "rightPanel",
selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 198}} selected: groupPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 201}}
, react.createElement(ContactSidebar, { , react.createElement(ContactSidebar, {
activeDrawer: "rightPanel", activeDrawer: "rightPanel",
contacts: groupContacts, contacts: groupContacts,
defaultContacts: defaultContacts, defaultContacts: defaultContacts,
group: group, group: group,
path: groupPath, path: groupPath,
selectedContact: shipPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 207}} ) selectedContact: shipPath, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 210}} )
, react.createElement(ContactCard, { , react.createElement(ContactCard, {
history: props.history, history: props.history,
contact: contact, contact: contact,
path: groupPath, path: groupPath,
ship: props.match.params.contact, ship: props.match.params.contact,
rootIdentity: rootIdentity, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 214}} rootIdentity: rootIdentity, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 217}}
) )
) )
); );
}, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 180}} ) }, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 183}} )
, react.createElement(Route, { exact: true, path: "/~contacts/me", , react.createElement(Route, { exact: true, path: "/~contacts/me",
render: (props) => { render: (props) => {
let me = defaultContacts[window.ship] || {}; let me = defaultContacts[window.ship] || {};
@ -64046,15 +64063,15 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
groups: groups, groups: groups,
invites: invites, invites: invites,
activeDrawer: "rightPanel", activeDrawer: "rightPanel",
selected: "me", __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 229}} selected: "me", __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 232}}
, react.createElement(ContactCard, { , react.createElement(ContactCard, {
history: props.history, history: props.history,
path: "/~/default", path: "/~/default",
contact: me, contact: me,
ship: window.ship, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 238}} ) ship: window.ship, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 241}} )
) )
); );
}, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 224}} ) }, __self: this, __source: {fileName: _jsxFileName$f, lineNumber: 227}} )
) )
) )
); );

View File

@ -250,6 +250,22 @@ export class ContactCard extends Component {
removeFromGroup() { removeFromGroup() {
const { props } = this; const { props } = this;
// share empty contact so that we can remove ourselves from group
// if we haven't shared yet
let contact = {
nickname: "",
email: "",
phone: "",
website: "",
notes: "",
color: "000000",
avatar: null
};
api.contactView.share(
`~${props.ship}`, props.path, `~${window.ship}`, contact
);
api.contactHook.remove(props.path, `~${props.ship}`); api.contactHook.remove(props.path, `~${props.ship}`);
props.history.push(`/~contacts${props.path}`); props.history.push(`/~contacts${props.path}`);
} }

View File

@ -80,6 +80,9 @@ export class Root extends Component {
`/${props.match.params.ship}/${props.match.params.group}`; `/${props.match.params.ship}/${props.match.params.group}`;
let groupContacts = contacts[groupPath] || {}; let groupContacts = contacts[groupPath] || {};
let group = groups[groupPath] || new Set([]); let group = groups[groupPath] || new Set([]);
if (!(groupPath in groups)) {
props.history.push('/~contacts');
}
return ( return (
<Skeleton <Skeleton

View File

@ -26,10 +26,6 @@ export class Subscription {
this.handleEvent.bind(this), this.handleEvent.bind(this),
this.handleError.bind(this), this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this)); this.handleQuitAndResubscribe.bind(this));
api.bind('/all', 'PUT', api.authTokens.ship, 'permission-store',
this.handleEvent.bind(this),
this.handleError.bind(this),
this.handleQuitAndResubscribe.bind(this));
} }
handleEvent(diff) { handleEvent(diff) {