Skip to content

Commit

Permalink
πŸ› fix only office integration (#379)
Browse files Browse the repository at this point in the history
πŸ”’ Do not expose application API into (#372)"
πŸ› Fix only office integration
  • Loading branch information
shepilov authored Feb 27, 2024
1 parent dcb6fa1 commit ad52ace
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ export class CompanyApplicationServiceImpl implements TdriveServiceProvider, Ini
pk.application_id,
context,
);
//do not expose application secret
application.api = null;

if (!application?.id) {
return null;
}

return {
const app = {
...{
id: pk.application_id,
company_id: pk.company_id,
application_id: pk.application_id,
},
application: application,
application: { ...application },
};
app.application.api = null;
return app;
} catch (err) {
console.error(err);
return null;
Expand All @@ -64,13 +64,14 @@ export class CompanyApplicationServiceImpl implements TdriveServiceProvider, Ini
companyApplication.application_id,
context,
);
//do not expose application secret
application.api = null;
if (application)
applications.push({
if (application) {
const app = {
...companyApplication,
application: application,
});
application: { ...application },
};
app.application.api = null;
applications.push(app);
}
}

return new ListResult<CompanyApplicationWithApplication>("applications", applications, null);
Expand Down
2 changes: 1 addition & 1 deletion tdrive/backend/node/test/e2e/users/users.quota.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("The /users/quota API", () => {
beforeEach(async () => {
platform = await init();
currentUser = await UserApi.getInstance(platform);
});
}, 30000000);

afterEach(async () => {
await platform.tearDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import {
FileTypeUnknownIcon,
} from '@atoms/icons-colored';
import * as Text from '@atoms/text';
import { useCompanyApplications } from '@features/applications/hooks/use-company-applications';
import { DriveItem } from '@features/drive/types';
import FileUploadAPIClient from '@features/files/api/file-upload-api-client';
import { formatDate } from '@features/global/utils/format-date';
import { formatSize } from '@features/global/utils/format-file-size';
import useRouterWorkspace from '@features/router/hooks/use-router-workspace';
import { useSearchModal } from '@features/search/hooks/use-search';
import { SearchInputState } from '@features/search/state/search-input';
import { UserType } from '@features/users/types/user';
Expand All @@ -32,8 +34,14 @@ import useRouterCompany from 'app/features/router/hooks/use-router-company';
export default (props: { driveItem: DriveItem & { user?: UserType }}) => {
const history = useHistory();
const input = useRecoilValue(SearchInputState);
const currentWorkspaceId = useRouterWorkspace();
const companyApplications = useCompanyApplications();
const { user } = useCurrentUser();
const [_, setParentId] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }));
const tdriveDriveApplicationId =
companyApplications.applications.find(application => {
return application.identity.code === 'tdrive_drive';
})?.id || '';
const file = props.driveItem;
const name = file?.name;
const extension = name?.split('.').pop();
Expand Down

0 comments on commit ad52ace

Please sign in to comment.