(core) switch to newer download endpoint in client

Summary:
 * Fix old download endpoint to correctly pass org info in redirect.
 * Switch to use newer download endpoint in client.

Old endpoint not removed. I started doing that, but it is used in copying, and it struck me that I'm not sure what should happen when copying from a site document to "Personal" - should it be the Personal that is associated with docs.getgrist.com currently, of should it be the Personal that is associated with the email of the user on whatever-site-we-are-on.getgrist.com. So leaving that as separate work.

Test Plan: updated tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2639
This commit is contained in:
Paul Fitzpatrick
2020-10-19 12:13:20 -04:00
parent ad7be0fd8d
commit 27fd894fc7
5 changed files with 21 additions and 12 deletions

View File

@@ -475,14 +475,6 @@ export class GristDoc extends DisposableWithEvents {
}
}
public getDownloadLink() {
return this.docComm.docUrl('download') + '?' + encodeQueryParams({
doc: this.docPageModel.currentDocId.get(),
title: this.docPageModel.currentDocTitle.get(),
...this.docComm.getUrlParams(),
});
}
public getCsvLink() {
return this.docComm.docUrl('gen_csv') + '?' + encodeQueryParams({
...this.docComm.getUrlParams(),

View File

@@ -194,7 +194,10 @@ function menuExports(doc: Document, pageModel: DocPageModel) {
(isElectron ?
menuItem(() => gristDoc.app.comm.showItemInFolder(doc.name),
'Show in folder', testId('tb-share-option')) :
menuItemLink({ href: gristDoc.getDownloadLink(), target: '_blank', download: ''},
menuItemLink({
href: pageModel.appModel.api.getDocAPI(doc.id).getDownloadUrl(),
target: '_blank', download: ''
},
menuIcon('Download'), 'Download', testId('tb-share-option'))
),
menuItemLink({ href: gristDoc.getCsvLink(), target: '_blank', download: ''},