🐛 Not all the data is shown in the shared with me section (#376)

* 🐛Not all the data is shown in the shared with me section
This commit is contained in:
Anton Shepilov
2024-02-26 18:07:59 +01:00
committed by GitHub
parent 62845798b9
commit 07fc285721
11 changed files with 124 additions and 75 deletions
@@ -343,15 +343,15 @@ export default class UserApi {
) {
const response = await this.platform.app.inject({
method: "POST",
url: `${UserApi.DOC_URL}/companies/${this.platform.workspace.company_id}/shared-with-me`,
url: `${UserApi.DOC_URL}/companies/${this.platform.workspace.company_id}/browse/shared_with_me`,
headers: {
authorization: `Bearer ${this.jwt}`
},
payload
});
return deserialize<SearchResultMockClass>(
SearchResultMockClass,
return deserialize<DriveItemDetailsMockClass>(
DriveItemDetailsMockClass,
response.body);
};
@@ -126,10 +126,32 @@ describe("The Documents Browser Window and API", () => {
await new Promise(r => setTimeout(r, 3000));
//then file become searchable
expect((await anotherUser.browseDocuments("shared_with_me", {})).children).toHaveLength(1);
expect((await anotherUser.browseDocuments("shared_with_me", {pageSize: 1})).children).toHaveLength(1);
});
it("Share With Me should return all the files that was share by user at one", async () => {
const sharedWIthMeFolder = "shared_with_me";
const oneUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
const anotherUser = await UserApi.getInstance(platform, true, {companyRole: "admin"});
let files = await oneUser.uploadAllFilesOneByOne();
await anotherUser.uploadAllFilesOneByOne();
await new Promise(r => setTimeout(r, 5000));
//give permissions to the file
files[2].access_info.entities.push({
type: "user",
id: anotherUser.user.id,
level: "read",
grantor: null,
});
await oneUser.updateDocument(files[2].id, files[2]);
await new Promise(r => setTimeout(r, 3000));
//then file become searchable
expect((await anotherUser.browseDocuments("shared_with_me", {pagination: {limitStr: 100}})).children).toHaveLength(1);
});
});
});
@@ -106,7 +106,7 @@ describe("the Drive Search feature", () => {
const searchResponse = await userTwo.sharedWithMeDocuments({});
//then::
expect(searchResponse.entities?.length).toEqual(1);
expect(searchResponse.children?.length).toEqual(1);
})
it("did search for an item that doesn't exist", async () => {
@@ -146,7 +146,7 @@ describe("the Drive Search feature", () => {
it("did search a file shared by another user", async () => {
//then file become searchable
expect((await userTwo.sharedWithMeDocuments({})).entities).toHaveLength(1);
expect((await userTwo.sharedWithMeDocuments({})).children).toHaveLength(1);
});
it("did search a file by file owner", async () => {
@@ -20,13 +20,61 @@ Content-Type: application/json
}
}
### Query data
GET https://localhost:9200/drive_files/_search
Authorization: Basic admin admin
Content-Type: application/json
{
"query": {
"bool": {
"boost": 1,
"must": [
{
"bool": {
"should": [
{
"match": {
"access_entities": {
"query": "7f2e4e80-d4be-11ee-8a11-0544b51cf428",
"operator": "AND"
}
}
}
],
"minimum_should_match": 1
}
},
{
"bool": {
"should": [
{
"match": {
"company_id": {
"query": "7efb7eb1-d4be-11ee-8a11-0544b51cf428",
"operator": "AND"
}
}
}
],
"minimum_should_match": 1
}
}
]
}
}
}
### Check that it is created
GET https://localhost:9200/_cat/indices
Authorization: Basic admin admin
Content-Type: application/json
### GET index info
GET https://localhost:9200/drive_files
GET https://localhost:9200/user
Authorization: Basic admin admin
Content-Type: application/json
### GET data to the index
GET https://localhost:9200/drive_files/_doc/8c03c5a1-0146-11ee-82d9-f503f8a58e9d