From 5c6e40746f1748afad86aff9b9bad7367d6088ef Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Fri, 12 Oct 2018 15:59:11 +0000 Subject: [PATCH] Use full link for tweets --- src/react-components/invite-dialog.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/react-components/invite-dialog.js b/src/react-components/invite-dialog.js index f28fcf7f0..aa5c511bc 100644 --- a/src/react-components/invite-dialog.js +++ b/src/react-components/invite-dialog.js @@ -42,12 +42,13 @@ export default class InviteDialog extends Component { const { entryCode } = this.props; const entryCodeString = pad(entryCode, 6); - const shareLink = `hub.link/${entryCodeString}`; + const shareShortLink = `hub.link/${entryCodeString}`; + const shareFullLink = [location.protocol, "//", location.host, location.pathname].join(""); const tweetText = `Join me now in #hubs!`; - const tweetLink = `https://twitter.com/share?url=${encodeURIComponent( - "https://" + shareLink - )}&text=${encodeURIComponent(tweetText)}`; + const tweetLink = `https://twitter.com/share?url=${encodeURIComponent(shareFullLink)}&text=${encodeURIComponent( + tweetText + )}`; return ( <div className={styles.dialog}> @@ -73,15 +74,15 @@ export default class InviteDialog extends Component { <FormattedMessage id="invite.or_visit" /> </div> <div className={styles.domain}> - <input type="text" readOnly onFocus={e => e.target.select()} value={shareLink} /> + <input type="text" readOnly onFocus={e => e.target.select()} value={shareShortLink} /> </div> <div className={styles.buttons}> - <button className={styles.linkButton} onClick={this.copyClicked.bind(this, "https://" + shareLink)}> + <button className={styles.linkButton} onClick={this.copyClicked.bind(this, "https://" + shareShortLink)}> <span>{this.state.copyButtonActive ? "copied!" : "copy"}</span> </button> {this.props.allowShare && navigator.share && ( - <button className={styles.linkButton} onClick={this.shareClicked.bind(this, "https://" + shareLink)}> + <button className={styles.linkButton} onClick={this.shareClicked.bind(this, shareFullLink)}> <span>{this.state.shareButtonActive ? "sharing..." : "share"}</span> </button> )} -- GitLab