🐛 Fix download button (#172)

* Fix on context menu for folder

* Make it works for My Drive

* Fix downloading folder in the shared view

---------

Co-authored-by: Anton SHEPILOV <ashepilov@linagora.com>
This commit is contained in:
Greemty
2023-08-30 15:10:54 +02:00
committed by GitHub
parent 74df7e1f71
commit 1eb0df97f1
11 changed files with 5680 additions and 6842 deletions
+4823 -6686
View File
File diff suppressed because it is too large Load Diff
@@ -290,6 +290,17 @@ export default class TestHelpers {
});
};
async getFolder(id: string | "root" | "trash" | "shared_with_me") {
return await this.platform.app.inject({
method: "GET",
url: `${TestHelpers.DOC_URL}/companies/${this.platform.workspace.company_id}/item/download/zip?items=${id}`,
headers: {
authorization: `Bearer ${this.jwt}`,
},
});
};
async getDocumentOKCheck(id: string | "root" | "trash" | "shared_with_me") {
const response = await this.getDocument(id);
expect(response.statusCode).toBe(200);
@@ -297,6 +308,13 @@ export default class TestHelpers {
expect(doc.item?.id).toBe(id);
};
async getFolderOKCheck(id: string | "root" | "trash" | "shared_with_me") {
const response = await this.getFolder(id);
expect(response.statusCode).toBe(200);
const doc = deserialize<DriveItemDetailsMockClass>(DriveItemDetailsMockClass, response.body);
expect(doc.item?.id).toBe(id);
};
async sharedWithMeDocuments (
payload: Record<string, any>
){
@@ -309,4 +309,32 @@ describe("the public links feature", () => {
});
});
describe("Download Folder from shared link", () => {
it("Share folder", async () => {
const user = await TestHelpers.getInstance(platform, true);
const anotherUser = await TestHelpers.getInstance(platform, true);
//create directory in "My Drive" and upload a file
const directory = await user.createDirectory("user_" + user.user.id);
const doc = await user.createRandomDocument(directory.id);
//check that another user doesn't see any file
//expect((await anotherUser.getFolder(doc.id)).statusCode).toBe(401);
//share folder with the public link
await user.shareWithPublicLink(directory, "read");
const token = await anotherUser.getPublicLinkAccessToken(directory);
anotherUser.jwt = token.value;
await anotherUser.getDocumentOKCheck(doc.id);
expect((await anotherUser.getFolder(doc.id)).statusCode).toBe(200);
});
});
});
+4 -4
View File
@@ -396,10 +396,10 @@
readable-stream "^3.4.0"
send "^0.17.1"
"@ffprobe-installer/darwin-arm64@5.0.1":
version "5.0.1"
resolved "https://registry.npmjs.org/@ffprobe-installer/darwin-arm64/-/darwin-arm64-5.0.1.tgz"
integrity sha512-vwNCNjokH8hfkbl6m95zICHwkSzhEvDC3GVBcUp5HX8+4wsX10SP3B+bGur7XUzTIZ4cQpgJmEIAx6TUwRepMg==
"@ffprobe-installer/darwin-x64@5.0.0":
version "5.0.0"
resolved "https://registry.npmjs.org/@ffprobe-installer/darwin-x64/-/darwin-x64-5.0.0.tgz"
integrity sha512-Zl0UkZ+wW/eyMKBPLTUCcNQch2VDnZz/cBn1DXv3YtCBVbYd9aYzGj4MImdxgWcoE0+GpbfbO6mKGwMq5HCm6A==
"@ffprobe-installer/ffprobe@^1.4.1":
version "1.4.1"