ShareProfile: refactor to remove dead props

This commit is contained in:
Liam Fitzgerald 2021-04-28 13:55:40 +10:00
parent 053e392c5c
commit a1c433b455
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -40,21 +40,20 @@ export const ShareProfile = (props) => {
); );
const onClick = async () => { const onClick = async () => {
if(group.hidden && recipients.length > 0) { if(typeof recipients === 'string') {
await api.contacts.allowShips(recipients); const [,,ship,name] = recipients.split('/');
await Promise.all(recipients.map(r => api.contacts.share(r)))
setShowBanner(false);
} else if (!group.hidden) {
const [,,ship,name] = groupPath.split('/');
await api.contacts.allowGroup(ship,name); await api.contacts.allowGroup(ship,name);
if(ship !== `~${window.ship}`) { if(ship !== `~${window.ship}`) {
await api.contacts.share(ship); await api.contacts.share(ship);
} }
setShowBanner(false); } else if(recipients.length > 0) {
} await api.contacts.allowShips(recipients);
await Promise.all(recipients.map(r => api.contacts.share(r)))
}
props.onShare();
}; };
return showBanner ? ( return props.recipients?.length > 0 ? (
<Row <Row
height="48px" height="48px"
alignItems="center" alignItems="center"