diff --git a/src/pages/resultsView/bookmark/BookmarkModal.tsx b/src/pages/resultsView/bookmark/BookmarkModal.tsx index a0076ffa367..19f79a9a725 100644 --- a/src/pages/resultsView/bookmark/BookmarkModal.tsx +++ b/src/pages/resultsView/bookmark/BookmarkModal.tsx @@ -42,7 +42,7 @@ export class BookmarkModal extends React.Component<{ onHide: () => void, urlProm initializeClipboards(){ this.clipboards.push(new Clipboard(this.sessionButton, { text: function() { - return this.urlData.sessionUrl || this.urlData.fullUrl; + return this.urlData.fullUrl; }.bind(this), container: this.container })); @@ -83,7 +83,7 @@ export class BookmarkModal extends React.Component<{ onHide: () => void, urlProm
- +
this.sessionButton=el} onClick={this.showThumb} diff --git a/src/pages/resultsView/querySummary/ShareUI.tsx b/src/pages/resultsView/querySummary/ShareUI.tsx index b369ec46774..2f3e1a286a0 100644 --- a/src/pages/resultsView/querySummary/ShareUI.tsx +++ b/src/pages/resultsView/querySummary/ShareUI.tsx @@ -12,7 +12,6 @@ import ResultsViewURLWrapper from "pages/resultsView/ResultsViewURLWrapper"; interface IShareUI { sessionEnabled: boolean; - //routingStore: ExtendedRouterStore; urlWrapper:ResultsViewURLWrapper; bitlyAccessToken?: string | null; } @@ -20,9 +19,9 @@ interface IShareUI { const win = getBrowserWindow(); export interface ShareUrls { - sessionUrl:string|undefined; - bitlyUrl:any|undefined; + bitlyUrl:string|undefined; fullUrl:string; + sessionUrl:string|undefined; } @observer @@ -30,29 +29,12 @@ export class ShareUI extends React.Component { @observable showBookmarkDialog:boolean = false; - async getUrl():Promise { + async getUrls():Promise { let sessionUrl = win.location.href; let bitlyResponse; - if (this.props.sessionEnabled) { - if (this.props.urlWrapper.hasSessionId) { - sessionUrl = getBrowserWindow().location.href; - } else { - const resp = await this.props.urlWrapper.saveRemoteSession(this.props.urlWrapper.query); - // for testing purposes we don't have links to localhost - sessionUrl = URL.format({ - hostname: (win.location.hostname.includes("localhost") ? "www.cbioportal.org" : win.location.hostname), - pathname: win.location.pathname, - protocol: win.location.protocol, - query: { - session_id: resp.id - } - }); - } - } - // now lets shorten with bityly, if we have key // WE ARE DISABLING BITLY PENDING DISCUSSION if (this.props.bitlyAccessToken) { @@ -66,42 +48,19 @@ export class ShareUI extends React.Component { } return { - sessionUrl, bitlyUrl: ((bitlyResponse && bitlyResponse.data && bitlyResponse.data.url) ? bitlyResponse.data.url : undefined), - fullUrl: win.location.href + fullUrl: win.location.href, + sessionUrl:sessionUrl } } - @autobind - shareTwitter() { - this.getUrl().then((urlData:ShareUrls) => { - win.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(this.shortenedUrl(urlData))}&text=${encodeURIComponent(document.title)}&via=cbioportal`); - }); - } - - @autobind - openEmail() { - this.getUrl().then((urlData)=>{ - window.location.href = - `mailto:?subject=${encodeURIComponent(document.title)}&body=${encodeURIComponent(this.shortenedUrl(urlData))}%20${encodeURIComponent(document.title)}`; - }); - } - @autobind @action toggleBookmarkDialog(){ this.showBookmarkDialog = !this.showBookmarkDialog; } - shortenedUrl(urlData:ShareUrls){ - const url = urlData.bitlyUrl || urlData.sessionUrl || urlData.fullUrl - if (!url) { - throw("URL bookmarking error"); - } - return url; - } - render() { return
@@ -114,7 +73,7 @@ export class ShareUI extends React.Component { { - (this.showBookmarkDialog) && () + (this.showBookmarkDialog) && () }
}