From 36454b35d62cc6f92fe60284039e8458e2cd53b9 Mon Sep 17 00:00:00 2001
From: Greg Fodor <gfodor@gmail.com>
Date: Sun, 14 Oct 2018 18:00:39 +0000
Subject: [PATCH] Use permalink appropriately in invite dialog

---
 src/assets/translations.data.json     | 2 +-
 src/react-components/invite-dialog.js | 7 ++++---
 src/react-components/ui-root.js       | 1 +
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/assets/translations.data.json b/src/assets/translations.data.json
index b0bd613fd..b9f9c9f59 100644
--- a/src/assets/translations.data.json
+++ b/src/assets/translations.data.json
@@ -89,7 +89,7 @@
     "invite.enter_via": "Enter via ",
     "invite.tweet": "tweet",
     "invite.and_enter_code": " with code:",
-    "invite.or_visit": "or visit",
+    "invite.or_visit": "or share permalink",
     "spoke.primary_tagline": "make your space",
     "spoke.secondary_tagline": "Create 3D social scenes for ",
     "spoke.thank_you": "Thank you for downloading Spoke!",
diff --git a/src/react-components/invite-dialog.js b/src/react-components/invite-dialog.js
index aa5c511bc..97d01aee9 100644
--- a/src/react-components/invite-dialog.js
+++ b/src/react-components/invite-dialog.js
@@ -15,6 +15,7 @@ function pad(num, size) {
 export default class InviteDialog extends Component {
   static propTypes = {
     entryCode: PropTypes.number,
+    hubId: PropTypes.string,
     allowShare: PropTypes.bool,
     onClose: PropTypes.func
   };
@@ -42,11 +43,11 @@ export default class InviteDialog extends Component {
     const { entryCode } = this.props;
 
     const entryCodeString = pad(entryCode, 6);
-    const shareShortLink = `hub.link/${entryCodeString}`;
-    const shareFullLink = [location.protocol, "//", location.host, location.pathname].join("");
+    const shareShortLink = `hub.link/${this.props.hubId}`;
+    const shareFullLink = [location.protocol, "//", "hub.link", location.pathname].join("");
 
     const tweetText = `Join me now in #hubs!`;
-    const tweetLink = `https://twitter.com/share?url=${encodeURIComponent(shareFullLink)}&text=${encodeURIComponent(
+    const tweetLink = `https://twitter.com/share?url=${encodeURIComponent(shareShortLink)}&text=${encodeURIComponent(
       tweetText
     )}`;
 
diff --git a/src/react-components/ui-root.js b/src/react-components/ui-root.js
index 73c2a1e87..88d19abd2 100644
--- a/src/react-components/ui-root.js
+++ b/src/react-components/ui-root.js
@@ -990,6 +990,7 @@ class UIRoot extends Component {
               <InviteDialog
                 allowShare={!this.props.availableVREntryTypes.isInHMD}
                 entryCode={this.props.hubEntryCode}
+                hubId={this.props.hubId}
                 onClose={() => this.setState({ showInviteDialog: false })}
               />
             )}
-- 
GitLab